emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#13946: closed (24.3; [PATCH] fix of apropos with w


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#13946: closed (24.3; [PATCH] fix of apropos with words)
Date: Wed, 18 Dec 2013 04:48:02 +0000

Your message dated Wed, 18 Dec 2013 12:47:11 +0800
with message-id <address@hidden>
and subject line Re: bug#13946: 24.3; [PATCH] fix of apropos with words
has caused the debbugs.gnu.org bug report #13946,
regarding 24.3; [PATCH] fix of apropos with words
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
13946: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13946
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.3; [PATCH] fix of apropos with words Date: Thu, 14 Mar 2013 00:21:29 +0900
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.



--- End Message ---
--- Begin Message --- Subject: Re: bug#13946: 24.3; [PATCH] fix of apropos with words Date: Wed, 18 Dec 2013 12:47:11 +0800 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
Shigeru Fukaya <address@hidden> 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.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]