GNU bug report logs - #1402
suggestion: add 'symbol to regexp-opt's second parameter

Previous Next

Package: emacs;

Reported by: xah lee <xah <at> xahlee.org>

Date: Fri, 21 Nov 2008 20:20:02 UTC

Severity: wishlist

Tags: wontfix

Merged with 4392

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1402 in the body.
You can then email your comments to 1402 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1402; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to xah lee <xah <at> xahlee.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: xah lee <xah <at> xahlee.org>
To: bug-gnu-emacs <at> gnu.org
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/

Severity set to `wishlist' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sat, 22 Nov 2008 21:50:05 GMT) Full text and rfc822 format available.

Forcibly Merged 1402 4392. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Fri, 11 Sep 2009 00:15:08 GMT) Full text and rfc822 format available.

Added tag(s) wontfix. Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> emacsbugs.donarmstrong.com. (Fri, 11 Sep 2009 19:25:07 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Aug 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.