changeset 29629:855fe2e4005d

(describe-function-1): Kluge around cases of functions fset to subrs whose doc doesn't match their symbol-name.
author Dave Love <fx@gnu.org>
date Tue, 13 Jun 2000 21:04:58 +0000
parents 4580fc7c0a80
children 257b69e2a73e
files lisp/help.el
diffstat 1 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help.el	Tue Jun 13 19:06:07 2000 +0000
+++ b/lisp/help.el	Tue Jun 13 21:04:58 2000 +0000
@@ -724,17 +724,28 @@
 		       ;; Builtins get the calling sequence at the end of
 		       ;; the doc string.  Move it to the same place as
 		       ;; for other functions.
-		       (if (looking-at (format "(%S[ )]" function))
-			   (let ((start (point-marker)))
-			     (goto-char (point-min))
-			     (forward-paragraph)
-			     (insert-buffer-substring (current-buffer) start)
-			     (insert ?\n)
-			     (delete-region (1- start) (point-max)))
-			 (goto-char (point-min))
-			 (forward-paragraph)
-			 (insert
-			  "[Missing arglist.  Please make a bug report.]\n"))
+
+		       ;; In cases where `function' has been fset to a
+		       ;; subr we can't search for function's name in
+		       ;; the doc string.  Kluge round that using the
+		       ;; printed representation.  The arg list then
+		       ;; shows the wrong function name, but that
+		       ;; might be a useful hint.
+		       (let* ((rep (prin1-to-string def))
+			      (name (progn
+				      (string-match " \\([^ ]+\\)>$" rep)
+				      (match-string 1 rep))))
+			 (if (looking-at (format "(%s[ )]" name))
+			     (let ((start (point-marker)))
+			       (goto-char (point-min))
+			       (forward-paragraph)
+			       (insert-buffer-substring (current-buffer) start)
+			       (insert ?\n)
+			       (delete-region (1- start) (point-max)))
+			   (goto-char (point-min))
+			   (forward-paragraph)
+			   (insert
+			    "[Missing arglist.  Please make a bug report.]\n")))
 		       (goto-char (point-max))))
 		 (help-setup-xref (list #'describe-function function)
 				  interactive-p))