--- Begin Message ---
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 “'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/
☄
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#4392: (Regexp Functions): The PAREN argument to `regexp-opt' can be `symbols'. |
Date: |
Sat, 09 Jul 2011 14:49:16 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
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 "\\(?:").
--- End Message ---