Commit ba874b64 authored by Shigeru Fukaya's avatar Shigeru Fukaya Committed by Chong Yidong
Browse files

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

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

Fixes: debbugs:13946
parent 150622a1
2013-12-18 Shigeru Fukaya <shigeru.fukaya@gmail.com>
* apropos.el (apropos-words-to-regexp): Fix algorithm (Bug#13946).
2013-12-18 Glenn Morris <rgm@gnu.org>
* Makefile.in (BYTE_COMPILE_FLAGS): Set load-prefer-newer to t.
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment