emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package-quickstart: Error from transient etc after Emacs Rebuild


From: Jonas Bernoulli
Subject: Re: package-quickstart: Error from transient etc after Emacs Rebuild
Date: Tue, 20 Feb 2024 19:19:41 +0100

Eli Zaretskii <eliz@gnu.org> writes:

> I guess I was confused by the fact that you raised the issue here,
> which led me to think the problem was in Emacs, and specifically in
> transient.

The issue was in Forge in this case, but its easy to make this sort of
mistake (I've done it before), so I would like to apply the following
commit, which prevents this, by allowing the use of plain
";;;###autoload".  That's also more convenient and has the benefit that
the autoload will also contain the docstring.

Unfortunately authors of packages, which are not part of Emacs, won't be
able to take advantage of this until they require at least Emacs 30.

Maybe packages should be able to inform loaddefs-generate--make-autoload
if macros, which they define, should be treated the same as defun, using
some thing like:

  (put 'specialized-defun 'autoload-function 'defun)

---

commit cd0d8dc86f5ad8ee800ab031c31c26af9667d8e9 (HEAD -> master)
Author: Jonas Bernoulli <jonas@bernoul.li>
Date:   Tue Feb 20 18:49:20 2024 +0100

    Allow trivially autoloading uses of transient's define macros
    
    Since 49e41991b2f transient-define-prefix itself was autoloaded, but
    that meant that when ever an autoload file was loaded which contained
    an autoload for a command defined using that macro, transient itself
    had to be loaded.
    
    That shouldn't be necessary.  For commands using these macros, an
    autoload that is identical to what would have been generated if it
    had been defined using defun, works just fine.
    
    * lisp/emacs-lisp/loaddefs-gen.el
    (loaddefs-generate--make-autoload): Allow uses of
    transient-define-prefix, transient-define-suffix,
    transient-define-infix and transient-define-argument
    to be autoloaded using just ";;;autoload".
    
    * lisp/transient.el (transient-define-prefix): No longer autoload.

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 238ec9d179b..581053f6304 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -201,8 +201,7 @@ loaddefs-generate--make-autoload
                        define-globalized-minor-mode defun defmacro
                       easy-mmode-define-minor-mode define-minor-mode
                        define-inline cl-defun cl-defmacro cl-defgeneric
-                       cl-defstruct pcase-defmacro iter-defun cl-iter-defun
-                       transient-define-prefix))
+                       cl-defstruct pcase-defmacro iter-defun cl-iter-defun))
            (macrop car)
           (setq expand (let ((load-true-file-name file)
                               (load-file-name file))
@@ -218,13 +217,17 @@ loaddefs-generate--make-autoload
                   define-globalized-minor-mode
                   easy-mmode-define-minor-mode define-minor-mode
                   cl-defun defun* cl-defmacro defmacro*
-                   define-overloadable-function))
+                   define-overloadable-function
+                   transient-define-prefix transient-define-suffix
+                   transient-define-infix transient-define-argument))
       (let* ((macrop (memq car '(defmacro cl-defmacro defmacro*)))
             (name (nth 1 form))
             (args (pcase car
                      ((or 'defun 'defmacro
                           'defun* 'defmacro* 'cl-defun 'cl-defmacro
-                          'define-overloadable-function)
+                          'define-overloadable-function
+                          'transient-define-prefix 'transient-define-suffix
+                          'transient-define-infix 'transient-define-argument)
                       (nth 2 form))
                      ('define-skeleton '(&optional str arg))
                      ((or 'define-generic-mode 'define-derived-mode
@@ -246,7 +249,11 @@ loaddefs-generate--make-autoload
                                    define-global-minor-mode
                                    define-globalized-minor-mode
                                    easy-mmode-define-minor-mode
-                                   define-minor-mode))
+                                   define-minor-mode
+                                   transient-define-prefix
+                                   transient-define-suffix
+                                   transient-define-infix
+                                   transient-define-argument))
                       t)
                  (and (eq (car-safe (car body)) 'interactive)
                       ;; List of modes or just t.
diff --git a/lisp/transient.el b/lisp/transient.el
index f9060f5ba85..bb35746e186 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -855,7 +855,6 @@ transient-subgroups
 
 ;;; Define
 
-;;;###autoload
 (defmacro transient-define-prefix (name arglist &rest args)
   "Define NAME as a transient prefix command.
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]