GNU bug report logs - #79128
31.0.50; shortdoc doesn't always display the correct arglist

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Wed, 30 Jul 2025 13:27:02 UTC

Severity: normal

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Full log


Message #17 received at 79128 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79128 <at> debbugs.gnu.org, Robert Pluim <rpluim <at> gmail.com>
Subject: Re: bug#79128: 31.0.50; shortdoc doesn't always display the correct
 arglist
Date: Sat, 02 Aug 2025 15:35:44 -0400
>> Shortdoc:
>> 
>>     >> (seq-empty-p arg &rest args)

Hmm... I suggest the patch below.


        Stefan


diff --git a/lisp/help.el b/lisp/help.el
index 65950a2b3a8..d1522ee392d 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -2282,8 +2282,9 @@
   "Return a formal argument list for the function DEF.
 If PRESERVE-NAMES is non-nil, return a formal arglist that uses
 the same names as used in the original source code, when possible."
-  ;; Handle symbols aliased to other symbols.
-  (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def)))
+  (let ((orig def)
+        ;; Follow symbols aliased to other symbols.
+        (def (indirect-function def)))
   ;; Advice wrappers have "catch all" args, so fetch the actual underlying
   ;; function to find the real arguments.
   (setq def (advice--cd*r def))
@@ -2299,7 +2300,10 @@
    ((or (and (byte-code-function-p def) (integerp (aref def 0)))
         (subrp def) (module-function-p def))
     (or (when preserve-names
-          (let* ((doc (condition-case nil (documentation def 'raw) (error nil)))
+            (let* ((doc (condition-case nil
+                            ;; Use `orig' to obey `function-documentation'.
+                           (documentation orig 'raw)
+                          (error nil)))
                  (docargs (if doc (car (help-split-fundoc doc nil))))
                  (arglist (if docargs
                               (cdar (read-from-string (downcase docargs)))))
@@ -2328,7 +2332,7 @@
           (nreverse arglist))))
    ((not (member (autoloadp def) '(nil keymap)))
     "[Arg list not available until function definition is loaded.]")
-   (t t)))
+     (t t))))
 
 (defun help--make-usage (function arglist)
   (cons (if (symbolp function) function 'anonymous)





This bug report was last modified 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.