# HG changeset patch # User Richard M. Stallman # Date 1042445238 0 # Node ID bcb6272077494bf2731092a7ecef4fd4b7431d0f # Parent 7739522ac6f2a6b88538815295ac8347aa7854f1 (apropos-documentation-property): New function. (apropos): Use apropos-documentation-property. diff -r 7739522ac6f2 -r bcb627207749 lisp/apropos.el --- a/lisp/apropos.el Mon Jan 13 08:05:13 2003 +0000 +++ b/lisp/apropos.el Mon Jan 13 08:07:18 2003 +0000 @@ -432,6 +432,14 @@ ;;;###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)"))) + (defun apropos (apropos-regexp &optional do-all) "Show all bound symbols whose names match APROPOS-REGEXP. With optional prefix DO-ALL or if `apropos-do-all' is non-nil, also @@ -463,37 +471,28 @@ (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)