emacs-devel
[Top][All Lists]
Advanced

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

Re: Regexp error scan (March 26)


From: Andy Moreton
Subject: Re: Regexp error scan (March 26)
Date: Wed, 27 Mar 2019 13:55:09 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)

On Wed 27 Mar 2019, Mattias Engdegård wrote:

> 27 mars 2019 kl. 04.43 skrev Basil L. Contovounesios <address@hidden>:
>> 
>> Paul Eggert <address@hidden> writes:
>> 
>>>       (replace-regexp-in-string
>>> -       (format "[%s]"
>>> -               (mapconcat (lambda (char)
>>> -                            (regexp-quote (char-to-string char)))
>>> -                          erc-lurker-ignore-chars ""))
>>> +       (regexp-opt (cl-delete-duplicates
>>> +               (mapcar #'char-to-string erc-lurker-ignore-chars)))
>>>        "" nick)
>>>     nick))
>> 
>> regexp-opt already deletes duplicates, so you can just:
>> 
>> (regexp-opt (mapcar #'char-to-string erc-lurker-ignore-chars))
>> 
>> Besides, cl-delete-duplicates defaults to eql for equality, so it's a
>> no-op here anyway.
>
> Or perhaps:
>
> (regexp-opt-charset (append erc-lurker-ignore-chars nil))

This *-charset naming is helpful, as it reminds users of the expected
argument type.

Given the previously noted problems with incorrect arguments for
`skip-chars-forward' and `skip-chars-backward', would it make sense to
rename these functions to `forward-charset' and `backward-charset' ?

    AndyM
  




reply via email to

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