1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

apropos.el (apropos-words-to-regexp): Fix algorithm.

* apropos.el (apropos-words-to-regexp): Fix algorithm.

Fixes: debbugs:13946
This commit is contained in:
Shigeru Fukaya 2013-12-18 12:46:49 +08:00 committed by Chong Yidong
parent 150622a173
commit ba874b6430
2 changed files with 19 additions and 10 deletions

View file

@ -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)