emacs-devel
[Top][All Lists]
Advanced

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

Re: new apropos feature in Emacs-22


From: Kim F. Storm
Subject: Re: new apropos feature in Emacs-22
Date: Sun, 06 Nov 2005 19:47:07 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Luc Teirlinck <address@hidden> 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





reply via email to

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