diff options
author | Shigeru Fukaya <shigeru.fukaya@gmail.com> | 2013-12-18 12:46:49 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2013-12-18 12:46:49 +0800 |
commit | ba874b6430893be55d48840a901aac4e64a4befc (patch) | |
tree | a8f4474807dde0a2984ae4c31fae7bb6690dd6ce /lisp/apropos.el | |
parent | 150622a1734d33e7d72f6161d645f38b88f4e839 (diff) | |
download | emacs-ba874b6430893be55d48840a901aac4e64a4befc.tar.gz |
apropos.el (apropos-words-to-regexp): Fix algorithm.
* apropos.el (apropos-words-to-regexp): Fix algorithm.
Fixes: debbugs:13946
Diffstat (limited to 'lisp/apropos.el')
-rw-r--r-- | lisp/apropos.el | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/apropos.el b/lisp/apropos.el index 7a1a6f6a75a..b7c5aaddcb1 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -341,16 +341,21 @@ before finding a label." (defun apropos-words-to-regexp (words wild) - "Make regexp matching any two of the words in WORDS." - (concat "\\(" - (mapconcat 'identity words "\\|") - "\\)" - (if (cdr words) - (concat wild - "\\(" - (mapconcat 'identity words "\\|") - "\\)") - ""))) + "Make regexp matching any two of the words in WORDS. +WILD should be a subexpression matching wildcards between matches." + (setq words (delete-dups (copy-sequence words))) + (if (null (cdr words)) + (car words) + (mapconcat + (lambda (w) + (concat "\\(?:" w "\\)" ;; parens for synonyms + wild "\\(?:" + (mapconcat 'identity + (delq w (copy-sequence words)) + "\\|") + "\\)")) + words + "\\|"))) ;;;###autoload (defun apropos-read-pattern (subject) |