From: Devon Sean McCullough <emacs-hacker@Jovi.Net>
To: bug-gnu-emacs@gnu.org
Subject: bug#4392: (Regexp Functions): The PAREN argument to `regexp-opt' can be `symbols'.
Date: Thu, 10 Sep 2009 14:48:08 -0700 (PDT) [thread overview]
Message-ID: <200909102148.n8ALm8wq058841@jovi.net> (raw)
Please patch REGEXP-OPT to take a PAREN 'symbols argument.
Index: emacs/doc/lispref/searching.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/lispref/searching.texi,v
retrieving revision 1.18
diff -u -r1.18 searching.texi
--- emacs/doc/lispref/searching.texi 27 Aug 2009 04:24:02 -0000 1.18
+++ emacs/doc/lispref/searching.texi 10 Sep 2009 20:20:36 -0000
@@ -921,6 +921,7 @@
returned regular expression is always enclosed by at least one
parentheses-grouping construct. If @var{paren} is @code{words}, then
that construct is additionally surrounded by @samp{\<} and @samp{\>}.
+Likewise if @var{paren} is @code{symbols}, by @samp{\_<} and @samp{\_>}.
This simplified definition of @code{regexp-opt} produces a
regular expression which is equivalent to the actual value
Index: emacs/lisp/emacs-lisp/regexp-opt.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/regexp-opt.el,v
retrieving revision 1.42
diff -u -r1.42 regexp-opt.el
--- emacs/lisp/emacs-lisp/regexp-opt.el 5 Jan 2009 03:21:08 -0000 1.42
+++ emacs/lisp/emacs-lisp/regexp-opt.el 10 Sep 2009 20:20:36 -0000
@@ -96,7 +96,7 @@
(concat open (mapconcat 'regexp-quote STRINGS \"\\\\|\") close))
If PAREN is `words', then the resulting regexp is additionally surrounded
-by \\=\\< and \\>."
+by \\=\\< and \\>. Likewise if PAREN is `symbols', by \\_< and \\_>."
(save-match-data
;; Recurse on the sorted list.
(let* ((max-lisp-eval-depth 10000)
@@ -104,11 +104,14 @@
(completion-ignore-case nil)
(completion-regexp-list nil)
(words (eq paren 'words))
+ (symbols (eq paren 'symbols))
(open (cond ((stringp paren) paren) (paren "\\(")))
(sorted-strings (delete-dups
(sort (copy-sequence strings) 'string-lessp)))
(re (regexp-opt-group sorted-strings (or open t) (not open))))
- (if words (concat "\\<" re "\\>") re))))
+ (cond (words (concat "\\<" re "\\>"))
+ (symbols (concat "\\_<" re "\\_>"))
+ (t re)))))
;;;###autoload
(defun regexp-opt-depth (regexp)
Peace
--Devon
/~\
\ / Health Care
X not warfare
/ \
next reply other threads:[~2009-09-10 21:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-10 21:48 Devon Sean McCullough [this message]
2009-09-11 19:17 ` bug#4392: (Regexp Functions): The PAREN argument to `regexp-opt' can be `symbols' Stefan Monnier
2009-09-11 19:25 ` Processed: " Emacs bug Tracking System
2011-07-09 18:49 ` Glenn Morris
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=200909102148.n8ALm8wq058841@jovi.net \
--to=emacs-hacker@jovi.net \
--cc=4392@emacsbugs.donarmstrong.com \
--cc=bug-gnu-emacs@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).