* bug#13946: 24.3; [PATCH] fix of apropos with words
@ 2013-03-13 15:21 Shigeru Fukaya
2013-12-18 4:47 ` Chong Yidong
0 siblings, 1 reply; 2+ messages in thread
From: Shigeru Fukaya @ 2013-03-13 15:21 UTC (permalink / raw)
To: 13946
Hello,
`apropos' family with plural words returns unexpected symbols and are
annoying. It is because `apropos-words-to-regexp' doesn't work as
documented/expected.
The following is revised `apropos-words-to-regexp'.
(defun apropos-words-to-regexp (words wild)
"Make regexp matching any two of the words in WORDS."
(if (null (cdr words))
(car words)
;; assure all words are independent objects for delq
(setq words (mapcar 'copy-sequence words))
(mapconcat
(lambda (w)
(concat "\\(?:" w "\\)" ;; parens for synonyms
wild
"\\(?:"
(mapconcat
'identity
(delete-dups (delq w (copy-sequence words)))
"\\|")
"\\)"))
(delete-dups (copy-sequence words))
"\\|")))
results:
(apropos-words-to-regexp '("A" "B") ".*?")
"\\(?:A\\).*?\\(?:B\\)\\|\\(?:B\\).*?\\(?:A\\)"
(apropos-words-to-regexp '("A" "B" "C") ".*?")
"\\(?:A\\).*?\\(?:B\\|C\\)\\|\\(?:B\\).*?\\(?:A\\|C\\)\\|\\(?:C\\).*?\\(?:A\\|B\\)"
(apropos-words-to-regexp '("A" "B" "B") ".*?")
"\\(?:A\\).*?\\(?:B\\)\\|\\(?:B\\).*?\\(?:A\\|B\\)"
(apropos-words-to-regexp '("A" "A" "B" "C" "C") ".*?")
"\\(?:A\\).*?\\(?:A\\|B\\|C\\)\\|\\(?:B\\).*?\\(?:A\\|C\\)\\|\\(?:C\\).*?\\(?:A\\|B\\|C\\)"
Additionally, in `apropos-parse-pattern', ".+" passed to
`apropos-words-to-regexp' wolud be better if ".+?".
Regards,
Shigeru.
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#13946: 24.3; [PATCH] fix of apropos with words
2013-03-13 15:21 bug#13946: 24.3; [PATCH] fix of apropos with words Shigeru Fukaya
@ 2013-12-18 4:47 ` Chong Yidong
0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2013-12-18 4:47 UTC (permalink / raw)
To: Shigeru Fukaya; +Cc: 13946-done
Shigeru Fukaya <shigeru.fukaya@gmail.com> writes:
> `apropos' family with plural words returns unexpected symbols and are
> annoying. It is because `apropos-words-to-regexp' doesn't work as
> documented/expected.
>
> The following is revised `apropos-words-to-regexp'.
Thanks, committed to trunk.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-18 4:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 15:21 bug#13946: 24.3; [PATCH] fix of apropos with words Shigeru Fukaya
2013-12-18 4:47 ` Chong Yidong
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.