help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bounds for strings with - between subwords


From: Emanuel Berg
Subject: Re: bounds for strings with - between subwords
Date: Fri, 07 May 2021 01:44:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech wrote:

>> > (defun alpha-bounds ()
>> >    "Gets bounds of a subword unit defined by regular expression [a-zA-Z]."
>> >    (let ( ($bounds nil) $ma $mb )
>> >       (skip-chars-backward "[:alpha:]")
>> >       (setq $ma (point))
>> >       (skip-chars-forward "[:alpha:]")
>> >       (setq $mb (point))
>> >       (setq $bounds (bounds-of-thing-at-point 'word))
>> >       (cons $ma $mb) ))
>>
>> You can put all that in the `let' to avoid the use of `setq'.
>>
>> Also $bounds doesn't seem to do anything?
>
> bounds are used in another function. You can see there is
> (cons $ma $mb) at the end,
> which is used as output when you call "alpha-bounds".

$bounds still isn't used anywhere else and cannot be, either.

>> And what's the purpose of the $?
>
> I use $ no tell me the variable is local and not being
> modified from outside. It is coming from the $1, $2, $3, ...
> function parameter idea.

But they cannot be modified from the outside so no need to
worry about that.

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]