unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andy Moreton <andrewjmoreton@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Regexp error scan (March 26)
Date: Wed, 27 Mar 2019 13:55:09 +0000	[thread overview]
Message-ID: <vz1ef6sifr6.fsf@gmail.com> (raw)
In-Reply-To: 7E84CED0-9E85-45FB-8BBF-B87ED51F4818@acm.org

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

> 27 mars 2019 kl. 04.43 skrev Basil L. Contovounesios <contovob@tcd.ie>:
>> 
>> Paul Eggert <eggert@cs.ucla.edu> 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	other threads:[~2019-03-27 13:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 17:38 Regexp error scan (March 26) Mattias Engdegård
2019-03-27  2:10 ` Paul Eggert
2019-03-27  3:43   ` Basil L. Contovounesios
2019-03-27  9:14     ` Mattias Engdegård
2019-03-27 13:55       ` Andy Moreton [this message]
2019-03-27 14:36         ` Stefan Monnier
2019-03-27 14:41           ` Mattias Engdegård
2019-03-27 14:45             ` Stefan Monnier
2019-03-27 14:49               ` Noam Postavsky
2019-03-27 15:45                 ` Mattias Engdegård
2019-03-27 15:48                 ` Stefan Monnier
2019-03-27 18:50                   ` Paul Eggert
2019-03-27 15:28             ` Damien Collard
2019-03-27 12:09   ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vz1ef6sifr6.fsf@gmail.com \
    --to=andrewjmoreton@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).