GNU bug report logs - #13946
24.3; [PATCH] fix of apropos with words

Previous Next

Package: emacs;

Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>

Date: Wed, 13 Mar 2013 15:24:02 UTC

Severity: normal

Tags: patch

Found in version 24.3

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13946 in the body.
You can then email your comments to 13946 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13946; Package emacs. (Wed, 13 Mar 2013 15:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Shigeru Fukaya <shigeru.fukaya <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 13 Mar 2013 15:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
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.




Reply sent to Chong Yidong <cyd <at> gnu.org>:
You have taken responsibility. (Wed, 18 Dec 2013 04:48:01 GMT) Full text and rfc822 format available.

Notification sent to Shigeru Fukaya <shigeru.fukaya <at> gmail.com>:
bug acknowledged by developer. (Wed, 18 Dec 2013 04:48:02 GMT) Full text and rfc822 format available.

Message #10 received at 13946-done <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Cc: 13946-done <at> debbugs.gnu.org
Subject: Re: bug#13946: 24.3; [PATCH] fix of apropos with words
Date: Wed, 18 Dec 2013 12:47:11 +0800
Shigeru Fukaya <shigeru.fukaya <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 15 Jan 2014 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 126 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.