changeset 97442:5be4c494e1d5

(eshell/which): Handle the case where no description is found.
author Glenn Morris <rgm@gnu.org>
date Wed, 13 Aug 2008 03:12:36 +0000
parents 3f5d22fa3877
children 34df0af1cb93
files lisp/eshell/esh-cmd.el
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/eshell/esh-cmd.el	Tue Aug 12 20:00:18 2008 +0000
+++ b/lisp/eshell/esh-cmd.el	Wed Aug 13 03:12:36 2008 +0000
@@ -1252,9 +1252,12 @@
 			      (prog1
 				  (describe-function sym)
 				(message nil))))))
-		(setq desc (substring desc 0
-				      (1- (or (string-match "\n" desc)
-					      (length desc)))))
+		(setq desc (if desc (substring desc 0
+					       (1- (or (string-match "\n" desc)
+						       (length desc))))
+			     ;; This should not happen.
+			     (format "%s is defined, \
+but no documentation was found" name)))
 		(if (buffer-live-p (get-buffer "*Help*"))
 		    (kill-buffer "*Help*"))
 		(setq program (or desc name))))))