changeset 2275:445bd1969ed0

[xemacs-hg @ 2004-09-15 08:30:25 by stephent] fix void-function error in apropos <87656glyun.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Wed, 15 Sep 2004 08:30:27 +0000
parents 8e1339255ca7
children de0e5e7132db
files lisp/ChangeLog lisp/apropos.el lisp/help-macro.el lisp/help.el lisp/hyper-apropos.el
diffstat 5 files changed, 42 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Sep 15 04:26:16 2004 +0000
+++ b/lisp/ChangeLog	Wed Sep 15 08:30:27 2004 +0000
@@ -1,3 +1,16 @@
+2004-09-15  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	Fix bug: apropos errors if a defalias refers to an undefined
+	function.  <87pt4pmdcs.fsf@tleepslib.sk.tsukuba.ac.jp>
+
+	* apropos.el (apropos):
+	(apropos-command):
+	* help.el (frob-help-extents):
+	* help-macro.el (make-help-screen):
+	* hyper-apropos.el (hyper-apropos-grok-functions):
+	(hyper-apropos-get-doc):
+	Catch void-function error thrown by `documentation'.
+
 2004-09-07  Steve Youngs  <steve@youngs.au.com>
 
 	* packages.el (package-require): Fix incorrect arg to format.
--- a/lisp/apropos.el	Wed Sep 15 04:26:16 2004 +0000
+++ b/lisp/apropos.el	Wed Sep 15 08:30:27 2004 +0000
@@ -175,7 +175,10 @@
 				  ;; XEmacs change: if obsolete,
 				  ;; only mention that.
 				  (or (function-obsoleteness-doc symbol)
-				      (documentation symbol t)))
+				      (condition-case nil
+					  (documentation symbol t)
+					(void-function "(aliased to undefined function)")
+					(error "(unexpected error from `documention')"))))
 			    (substring doc 0 (string-match "\n" doc))
 			  "(not documented)"))
 		    (and do-all
@@ -225,7 +228,10 @@
 				  ;; XEmacs change: if obsolete,
 				  ;; only mention that.
 				  (or (function-obsoleteness-doc symbol)
-				      (documentation symbol t)))
+				      (condition-case nil
+					  (documentation symbol t)
+					(void-function "(aliased to undefined function)")
+					(error "(unexpected error from `documention')"))))
 			    (substring doc 0 (string-match "\n" doc))
 			  "(not documented)"))
 		    (if (boundp symbol)
--- a/lisp/help-macro.el	Wed Sep 15 04:26:16 2004 +0000
+++ b/lisp/help-macro.el	Wed Sep 15 08:30:27 2004 +0000
@@ -110,7 +110,11 @@
 	      (substitute-command-keys ,(eval help-line))))
 	 (when three-step-help
 	   (message "%s" line-prompt))
-	 (let* ((help-screen (documentation (quote ,fname)))
+	 (let* ((help-screen
+		 (condition-case nil
+		     (documentation (quote ,fname))
+		   (void-function "(alias for undefined function)")
+		   (error "(unexpected error from `documention')")))
 		;; We bind overriding-local-map for very small
 		;; sections, *excluding* where we switch buffers and
 		;; where we execute the chosen help command.
--- a/lisp/help.el	Wed Sep 15 04:26:16 2004 +0000
+++ b/lisp/help.el	Wed Sep 15 08:30:27 2004 +0000
@@ -1214,7 +1214,8 @@
   (let ((doc (condition-case nil
 		 (or (documentation function)
 		     (gettext "not documented"))
-	       (void-function ""))))
+	       (void-function "(alias for undefined function)")
+	       (error "(unexpected error from `documention')"))))
     (if (and strip-arglist
 	     (string-match "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'" doc))
 	(setq doc (substring doc 0 (match-beginning 0))))
@@ -1324,7 +1325,10 @@
 			 (documentation-property sym
 						 'variable-documentation t)))
 	       (fun (and sym (fboundp sym)
-			 (documentation sym t))))
+			 (condition-case nil
+			     (documentation sym t)
+			   (void-function "(alias for undefined function)")
+			   (error "(unexpected error from `documention')")))))
 	  (when (or var fun)
 	    (let ((ex (make-extent b e)))
 	      (require 'hyper-apropos)
--- a/lisp/hyper-apropos.el	Wed Sep 15 04:26:16 2004 +0000
+++ b/lisp/hyper-apropos.el	Wed Sep 15 08:30:27 2004 +0000
@@ -342,8 +342,10 @@
 		      (function-obsoleteness-doc fn)
 		    ;; A symbol's function slot can point to an unbound symbol.
 		    ;; In that case, `documentation' will fail.
-		    (ignore-errors
-		      (documentation fn)))))
+		    (condition-case nil
+			(documentation fn)
+		      (void-function "(alias for undefined function)")
+		      (error "(unexpected error from `documention')")))))
 	     (if (and
 		  doc
 		  (string-match
@@ -771,7 +773,12 @@
 		     local (current-local-map)
 		     global (current-global-map)
 		     obsolete (get symbol 'byte-obsolete-info)
-		     doc (or (documentation symbol) "function not documented"))
+		     doc (or (condition-case nil
+				 (documentation symbol)
+			       (void-function
+				"(alias for undefined function)")
+			       (error "(unexpected error from `documention')"))
+			     "function not documented"))
 	       (save-excursion
 		 (set-buffer hyper-apropos-help-buf)
 		 (goto-char (point-max))