]> code.delx.au - gnu-emacs/blobdiff - lisp/apropos.el
(diary-entry-marker, calendar-today-marker)
[gnu-emacs] / lisp / apropos.el
index a56cd4218e3a3ebd99d45302bebf574494182556..7a427b0c6f18d725ddd0487637a090918e00ebb4 100644 (file)
@@ -1,7 +1,7 @@
 ;;; apropos.el --- apropos commands for users and programmers
 
 ;; Copyright (C) 1989, 1994, 1995, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Joe Wells <jbw@bigbird.bu.edu>
 ;; Rewritten: Daniel Pfeiffer <occitan@esperanto.org>
@@ -112,7 +112,7 @@ If value is `verbose', the computed score is shown for each match."
                 (const :tag "show scores" verbose)))
 
 (defcustom apropos-documentation-sort-by-scores t
-  "*Non-nil means sort matches by scores; best match is shown first.
+  "Non-nil means sort matches by scores; best match is shown first.
 This applies to `apropos-documentation' only.
 If value is `verbose', the computed score is shown for each match."
   :group 'apropos
@@ -179,8 +179,7 @@ term, and the rest of the words are alternative terms.")
   'face apropos-symbol-face
   'help-echo "mouse-2, RET: Display more help on this symbol"
   'follow-link t
-  'action #'apropos-symbol-button-display-help
-  'skip t)
+  'action #'apropos-symbol-button-display-help)
 
 (defun apropos-symbol-button-display-help (button)
   "Display further help for the `apropos-symbol' button BUTTON."
@@ -490,8 +489,12 @@ while a list of strings is used as a word list."
                   (setq score (apropos-score-symbol symbol))
                   (unless var-predicate
                     (if (fboundp symbol)
-                        (if (setq doc (documentation symbol t))
-                            (progn
+                        (if (setq doc (condition-case nil
+                                           (documentation symbol t)
+                                         (error 'error)))
+                             ;; Eg alias to undefined function.
+                             (if (eq doc 'error)
+                                 "(documentation error)"
                               (setq score (+ score (apropos-score-doc doc)))
                               (substring doc 0 (string-match "\n" doc)))
                           "(not documented)")))
@@ -980,6 +983,7 @@ If non-nil TEXT is a string that will be printed as a heading."
                          (cons nil (cdr apropos-item)))))
          (insert-text-button (symbol-name symbol)
                              'type 'apropos-symbol
+                             'skip apropos-multi-type
                              ;; Can't use default, since user may have
                              ;; changed the variable!
                              ;; Just say `no' to variables containing faces!
@@ -1068,20 +1072,25 @@ If non-nil TEXT is a string that will be printed as a heading."
     (if apropos-compact-layout
         (insert (propertize "\t" 'display '(space :align-to 32)) " ")
       (insert "  "))
-    ;; If the query is only for a single type, there's
-    ;; no point writing it over and over again.
-    (when apropos-multi-type
+    (if (null apropos-multi-type)
+       ;; If the query is only for a single type, there's no point
+       ;; writing it over and over again.  Insert a blank button, and
+       ;; put the 'apropos-label property there (needed by
+       ;; apropos-symbol-button-display-help).
+       (insert-text-button
+        " " 'type type 'skip t
+        'face 'default 'apropos-symbol (car apropos-item))
       (insert-text-button
        (if apropos-compact-layout
-           (button-type-get type 'apropos-label)
-         (format "<%s>" (button-type-get type 'apropos-short-label)))
+           (format "<%s>" (button-type-get type 'apropos-short-label))
+         (button-type-get type 'apropos-label))
        'type type
        ;; Can't use the default button face, since user may have changed the
        ;; variable!  Just say `no' to variables containing faces!
        'face apropos-label-face
        'apropos-symbol (car apropos-item))
       (insert (if apropos-compact-layout " " ": ")))
-       (insert (if do-keys (substitute-command-keys i) i))
+    (insert (if do-keys (substitute-command-keys i) i))
     (or (bolp) (terpri))))
 
 (defun apropos-follow ()