Subject: bug#1402: closed (Re: bug#4392: (Regexp Functions): The PAREN argument to `regexp-opt' can be `symbols'.)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 09 Jul 2011 18:50:03 +0000

Your bug report

#4392: suggestion: add 'symbol to regexp-opt's second parameter

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
4392: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4392
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#4392: (Regexp Functions): The PAREN argument to `regexp-opt' can be `symbols'.
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Sat, 09 Jul 2011 14:49:16 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.1

There seems no point keeping this report open. A SYMBOLS
option was added 2010-10-07, despire the following:

Stefan Monnier wrote:

> As the person responsible for adding the `words' value to PAREN, I'm
> going to reject this request.  I think the `words' value was itself
> a mistake.  It's just as easy to add (concat "\\<" ... "\\>") around the
> call to regexp-opt.  Actually, the whole `paren' argument should
> disappear (i.e. be hardcoded to "\\(?:").

>From [email-masked] Fri Nov 21 12:11:44 2008
To: [email-masked]
From: xah lee <[email-masked]>
Subject: suggestion: add 'symbol to regexp-opt's second parameter
Date: Fri, 21 Nov 2008 12:11:36 -0800

this is a suggestion.

the function regexp-opt takes a second argument =E2=80=9C'words=E2=80=9D =
to make =20
the regex match word boundary. Perhaps it'd be useful to have =20
=E2=80=9C'symbol=E2=80=9D as the second argument as well.

as far as i know, when people do like this when they need symbol:

(concat "\\_<" (regexp-opt myLang-functions) ">_\\")

having

(regexp-opt myLang-functions 'symbol)

would be convenient and seems to me consistent.

For example, i currently have:

(defvar xlsl-keywords-regexp (regexp-opt xlsl-keywords 'words))
(defvar xlsl-type-regexp (regexp-opt xlsl-types 'words))
(defvar xlsl-constant-regexp (regexp-opt xlsl-constants 'words))
(defvar xlsl-event-regexp (regexp-opt xlsl-events 'words))
(defvar xlsl-functions-regexp (regexp-opt xlsl-functions 'words))

but i'd prefer that each is 'symbol. Using concat makes the code much =20=

longer and less readable.

Also, i think matching on symbol boundary is probably more commonly =20
needed than words, for language major modes.

PS before i send this, i posted to gnu.emacs.help to see if this is =20
sensible question. It seems that either this is already supported in =20
the dev version of emacs, or that this can still use some =20
improvement. I'm logging this suggestion here to be sure. Here's the =20
thread:

http://groups.google.com/group/gnu.emacs.help/browse_frm/thread/=20
289e42f24f21f65c

subject: =E2=80=9Cregex-opt does not accept 'symbol as second arg?=E2=80=9D=

date: 2008-10-11

   Xah
=E2=88=91 http://xahlee.org/

=E2=98=84=