Mercurial > emacs
diff lisp/emacs-lisp/regexp-opt.el @ 110801:37b955157790
(regexp-opt): Add `symbols' mode.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 07 Oct 2010 16:24:21 +0900 |
parents | b10051866f51 |
children | 1e7d8f405703 |
line wrap: on
line diff
--- a/lisp/emacs-lisp/regexp-opt.el Thu Oct 07 06:47:37 2010 +0000 +++ b/lisp/emacs-lisp/regexp-opt.el Thu Oct 07 16:24:21 2010 +0900 @@ -96,19 +96,24 @@ (concat open (mapconcat 'regexp-quote STRINGS \"\\\\|\") close)) If PAREN is `words', then the resulting regexp is additionally surrounded -by \\=\\< and \\>." +by \\=\\< and \\>. +If PAREN is `symbols', then the resulting regexp is additionally surrounded +by \\=\\_< and \\_>." (save-match-data ;; Recurse on the sorted list. (let* ((max-lisp-eval-depth 10000) (max-specpdl-size 10000) (completion-ignore-case nil) (completion-regexp-list nil) - (words (eq paren 'words)) (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 ((eq paren 'words) + (concat "\\<" re "\\>")) + ((eq paren 'symbols) + (concat "\\_<" re "\\_>")) + (t re))))) ;;;###autoload (defun regexp-opt-depth (regexp)