Subject: bug#1402: suggestion: add 'symbol to regexp-opt's second parameter

From: xah lee <[email-masked]>
Date: Fri, 21 Nov 2008 12:11:36 -0800

this is a suggestion.

the function regexp-opt takes a second argument “'words” to make  
the regex match word boundary. Perhaps it'd be useful to have  
“'symbol” 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  
longer and less readable.

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

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

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

subject: “regex-opt does not accept 'symbol as second arg?”
date: 2008-10-11

   Xah
∑ http://xahlee.org/

☄