From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: new apropos feature in Emacs-22 Date: Sun, 06 Nov 2005 19:47:07 +0100 Message-ID: References: <200511060157.jA61vca26394@raven.dms.auburn.edu> <200511060536.jA65aHY28505@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1131302977 11264 80.91.229.2 (6 Nov 2005 18:49:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 6 Nov 2005 18:49:37 +0000 (UTC) Cc: eliz@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 06 19:49:29 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EYpZ1-0007H9-Gt for ged-emacs-devel@m.gmane.org; Sun, 06 Nov 2005 19:48:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EYpZ1-0001wV-1Q for ged-emacs-devel@m.gmane.org; Sun, 06 Nov 2005 13:48:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EYpYo-0001wF-9y for emacs-devel@gnu.org; Sun, 06 Nov 2005 13:48:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EYpYn-0001w3-OT for emacs-devel@gnu.org; Sun, 06 Nov 2005 13:48:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EYpYn-0001w0-LP for emacs-devel@gnu.org; Sun, 06 Nov 2005 13:48:09 -0500 Original-Received: from [195.41.46.236] (helo=pfepb.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EYpYm-0007nM-P3; Sun, 06 Nov 2005 13:48:09 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepb.post.tele.dk (Postfix) with SMTP id E4B6D5EE0BE; Sun, 6 Nov 2005 19:48:05 +0100 (CET) Original-To: Luc Teirlinck In-Reply-To: <200511060536.jA65aHY28505@raven.dms.auburn.edu> (Luc Teirlinck's message of "Sat, 5 Nov 2005 23:36:17 -0600 (CST)") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45515 Archived-At: Luc Teirlinck writes: > > Because you may want to search for, say, the words "overwrite mode" in > that order, separated only by non-word constituents. The fact that > "mode" occurs somewhere in a doc string and "overwrite" somewhere else > is usually completely irrelevant and produces many false hits. > Sequential occurrence is _much_ less likely to be an accident than two > distinct keywords matching miles away in unrelated contexts. Just do: > > M-x apropos-documentation RET overwrite mode RET > > and then: `C-s overwrite' and you will notice that the vast majority > of the matches in the 919 lines long buffer have absolutely nothing to > do with overwrite mode. If we set apropos-sort-by-scores to t, then the most relevant entries would be listed first. The lesser important entries are showed later. IIRC, sort by scores was not turned on by default because it was said to confuse people who expect at least the simple apropos commands to list e.g. variables and functions in alphabetical order. But for apropos-documentation, it doesn't really make much sense to ever sort things alphabetically, so maybe it makes sense to unconditionally set apropos-sort-by-scores to t for apropos-documentation. Then the "false matches" will at least be listed after the good ones. A patch is attached below. It seems to improve things "a lot". > _And_ because sometimes you might want to search for keywords > containing characters that happen to be special in regexps, say > .emacs, .mailrc, whatever. Why are these only for experienced users? Yes, .emacs is a hard one -- but it is a very special case IMO. Perhaps we could make an expection for it. In any case C-s .emacs easily finds the relevant matches. Did you try to do C-h C-d .mailrc ? I don't see any false matches there. And for C-h C-d *scratch* RET, it finds all the relevant matches AFAICS. I still don't see the "serious" problem here. *** apropos.el 19 Sep 2005 00:24:21 +0200 1.106 --- apropos.el 06 Nov 2005 19:04:04 +0100 *************** *** 106,114 **** (defcustom apropos-sort-by-scores nil "*Non-nil means sort matches by scores; best match is shown first. ! The computed score is shown for each match." :group 'apropos ! :type 'boolean) (defvar apropos-mode-map (let ((map (make-sparse-keymap))) --- 106,116 ---- (defcustom apropos-sort-by-scores nil "*Non-nil means sort matches by scores; best match is shown first. ! If value is `verbose', the computed score is shown for each match." :group 'apropos ! :type '(choice (const :tag "off" nil) ! (const :tag "on" t) ! (const :tag "show scores" verbose))) (defvar apropos-mode-map (let ((map (make-sparse-keymap))) *************** *** 570,575 **** --- 572,578 ---- (or do-all (setq do-all apropos-do-all)) (setq apropos-accumulator () apropos-files-scanned ()) (let ((standard-input (get-buffer-create " apropos-temp")) + (apropos-sort-by-scores (or apropos-sort-by-scores t)) ;; verbose? f v sf sv) (unwind-protect (save-excursion *************** *** 822,828 **** ;; changed the variable! ;; Just say `no' to variables containing faces! 'face apropos-symbol-face) ! (if apropos-sort-by-scores (insert " (" (number-to-string (cadr apropos-item)) ") ")) ;; Calculate key-bindings if we want them. (and do-keys --- 825,831 ---- ;; changed the variable! ;; Just say `no' to variables containing faces! 'face apropos-symbol-face) ! (if (eq apropos-sort-by-scores 'verbose) (insert " (" (number-to-string (cadr apropos-item)) ") ")) ;; Calculate key-bindings if we want them. (and do-keys