]> git.eshelyaron.com Git - emacs.git/commitdiff
(describe-function-1): Kluge around cases of functions fset to subrs
authorDave Love <fx@gnu.org>
Tue, 13 Jun 2000 21:06:37 +0000 (21:06 +0000)
committerDave Love <fx@gnu.org>
Tue, 13 Jun 2000 21:06:37 +0000 (21:06 +0000)
whose doc doesn't match their symbol-name.

lisp/ChangeLog
lisp/help.el

index 5fa1e5376dcc08a548c460cf3c75aa7929bba355..47f6ac0858a5a478fc0337142dbf8161ffbb6c93 100644 (file)
@@ -1,5 +1,8 @@
 2000-06-13  Dave Love  <fx@gnu.org>
 
+       * help.el (describe-function-1): Kluge around cases of functions
+       fset to subrs whose doc doesn't match their symbol-name.
+
        * image.el (insert-image): Default STRING to a space.
 
        * info.el Doc fixes.
index c683071ef5b0676c7d83663f0b325337a1fb2743..1a25fe78601e5577c3ef384727b17c43298a8100 100644 (file)
@@ -724,17 +724,28 @@ It can also be nil, if the definition is not associated with any file."
                       ;; 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))