aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShigeru Fukaya2013-12-18 12:46:49 +0800
committerChong Yidong2013-12-18 12:46:49 +0800
commitba874b6430893be55d48840a901aac4e64a4befc (patch)
treea8f4474807dde0a2984ae4c31fae7bb6690dd6ce
parent150622a1734d33e7d72f6161d645f38b88f4e839 (diff)
downloademacs-ba874b6430893be55d48840a901aac4e64a4befc.tar.gz
emacs-ba874b6430893be55d48840a901aac4e64a4befc.zip
apropos.el (apropos-words-to-regexp): Fix algorithm.
* apropos.el (apropos-words-to-regexp): Fix algorithm. Fixes: debbugs:13946
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/apropos.el25
2 files changed, 19 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 96410c6c929..fa79352e7a2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12013-12-18 Shigeru Fukaya <shigeru.fukaya@gmail.com>
2
3 * apropos.el (apropos-words-to-regexp): Fix algorithm (Bug#13946).
4
12013-12-18 Glenn Morris <rgm@gnu.org> 52013-12-18 Glenn Morris <rgm@gnu.org>
2 6
3 * Makefile.in (BYTE_COMPILE_FLAGS): Set load-prefer-newer to t. 7 * Makefile.in (BYTE_COMPILE_FLAGS): Set load-prefer-newer to t.
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."
341 341
342 342
343(defun apropos-words-to-regexp (words wild) 343(defun apropos-words-to-regexp (words wild)
344 "Make regexp matching any two of the words in WORDS." 344 "Make regexp matching any two of the words in WORDS.
345 (concat "\\(" 345WILD should be a subexpression matching wildcards between matches."
346 (mapconcat 'identity words "\\|") 346 (setq words (delete-dups (copy-sequence words)))
347 "\\)" 347 (if (null (cdr words))
348 (if (cdr words) 348 (car words)
349 (concat wild 349 (mapconcat
350 "\\(" 350 (lambda (w)
351 (mapconcat 'identity words "\\|") 351 (concat "\\(?:" w "\\)" ;; parens for synonyms
352 "\\)") 352 wild "\\(?:"
353 ""))) 353 (mapconcat 'identity
354 (delq w (copy-sequence words))
355 "\\|")
356 "\\)"))
357 words
358 "\\|")))
354 359
355;;;###autoload 360;;;###autoload
356(defun apropos-read-pattern (subject) 361(defun apropos-read-pattern (subject)