]> code.delx.au - gnu-emacs/blobdiff - lisp/apropos.el
(insert-for-yank): Set yank-undo-function after calling FUNCTION,
[gnu-emacs] / lisp / apropos.el
index c91e4da82ae03add0720f38f48a3547fe79ab193..63450adbc62a9ba5eeb43013beeb0d2c3a9ec48c 100644 (file)
@@ -206,7 +206,7 @@ term, and the rest of the words are alternative terms.")
   'apropos-label "Group"
   'help-echo "mouse-2, RET: Display more help on this group"
   'action (lambda (button)
-           (customize-variable-other-window
+           (customize-group-other-window
             (button-get button 'apropos-symbol))))
 
 (define-button-type 'apropos-widget
@@ -431,6 +431,16 @@ satisfy the predicate VAR-PREDICATE."
         (message message))))
 
 
+;;;###autoload
+(defun apropos-documentation-property (symbol property raw)
+  "Like (documentation-property SYMBOL PROPERTY RAW) but handle errors."
+  (condition-case ()
+      (let ((doc (documentation-property symbol property raw)))
+       (if doc (substring doc 0 (string-match "\n" doc))
+         "(not documented)"))
+    (error "(error retrieving documentation)")))
+
+
 ;;;###autoload
 (defun apropos (apropos-regexp &optional do-all)
   "Show all bound symbols whose names match APROPOS-REGEXP.
@@ -463,37 +473,28 @@ time-consuming.  Returns list of symbols and documentation found."
                   (if (setq doc (condition-case nil
                                     (documentation symbol t)
                                   (void-function
-                                   "(alias for undefined function)")))
+                                   "(alias for undefined function)")
+                                  (error
+                                   "(error retrieving function documentation)")))
                       (substring doc 0 (string-match "\n" doc))
                     "(not documented)"))
                 (when (boundp symbol)
-                  (if (setq doc (documentation-property
-                                 symbol 'variable-documentation t))
-                      (substring doc 0 (string-match "\n" doc))
-                    "(not documented)"))
+                  (apropos-documentation-property
+                   symbol 'variable-documentation t))
                 (when (setq properties (symbol-plist symbol))
                   (setq doc (list (car properties)))
                   (while (setq properties (cdr (cdr properties)))
                     (setq doc (cons (car properties) doc)))
                   (mapconcat #'symbol-name (nreverse doc) " "))
                 (when (get symbol 'widget-type)
-                  (if (setq doc (documentation-property
-                                 symbol 'widget-documentation t))
-                      (substring doc 0
-                                 (string-match "\n" doc))
-                    "(not documented)"))
+                  (apropos-documentation-property
+                   symbol 'widget-documentation t))
                 (when (facep symbol)
-                  (if (setq doc (documentation-property
-                                 symbol 'face-documentation t))
-                      (substring doc 0
-                                 (string-match "\n" doc))
-                    "(not documented)"))
+                  (apropos-documentation-property
+                   symbol 'face-documentation t))
                 (when (get symbol 'custom-group)
-                  (if (setq doc (documentation-property
-                                 symbol 'group-documentation t))
-                      (substring doc 0
-                                 (string-match "\n" doc))
-                    "(not documented)"))))
+                  (apropos-documentation-property
+                   symbol 'group-documentation t))))
       (setq p (cdr p))))
   (apropos-print
    (or do-all apropos-do-all)