1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 07:40:39 -08:00

(loaddefs-generate--make-autoload): Fix bug#79852

As JD Smith <jdtsmith@gmail.com> said we had 3 paths:

1. macro has `autoload-macro expand` and is already loaded: expand
2. macro has `autoload-macro expand` but is /not/ yet loaded: shortcut
3. macro does not have `autoload-macro expand`: shortcut

and the co-existence of 1 and 2 is a problem because it means
that same macro is sometimes handled one way and sometimes
another, with different results.
Remove number 2 by removing from the shortcut all the remaining
macros that have `autoload-macro expand`.

The immediate effect is that `make autoloads` now (auto)loads three
more files:

    [...]
    loaddefs-gen: loading file frameset (for cl-defun)
    Loading frameset...
      INFO     Scraping 1547 files for loaddefs...10%
      INFO     Scraping 1547 files for loaddefs...20%
    loaddefs-gen: loading file semantic/analyze (for define-overloadable-function)
    Loading semantic/analyze...
      INFO     Scraping 1547 files for loaddefs...30%
      INFO     Scraping 1547 files for loaddefs...40%
      INFO     Scraping 1547 files for loaddefs...50%
      INFO     Scraping 1547 files for loaddefs...60%
      INFO     Scraping 1547 files for loaddefs...70%
    loaddefs-gen: loading file tramp-adb (for tramp--with-startup)
    Loading tramp-adb...
      INFO     Scraping 1547 files for loaddefs...80%
    loaddefs-gen: loading file grep (for define-compilation-mode)
    Loading grep...
    [...]

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros):
Remove macros that are marked `autoload-macro expand`, even if they are
not predefined.
(loaddefs-generate--make-autoload): Simplify accordingly.
This commit is contained in:
Stefan Monnier 2025-11-22 06:52:55 -05:00
parent b193a78a6f
commit 46d0f1fef1

View file

@ -154,9 +154,7 @@ scanning for autoloads and will be in the `load-path'."
;; they request such expansion and produce suitable output (e.g. by
;; employing :autoload-end to omit unneeded forms).
(defconst loaddefs--defining-macros
'( define-compilation-mode
cl-defun defun* cl-defmacro defmacro* define-overloadable-function
transient-define-prefix transient-define-suffix transient-define-infix
'( transient-define-prefix transient-define-suffix transient-define-infix
transient-define-argument transient-define-group))
(defvar loaddefs--load-error-files nil)
@ -246,17 +244,12 @@ expand)' among their `declare' forms."
;; For known special macros which define functions, use `autoload'
;; directly.
((memq car loaddefs--defining-macros)
(let* ((macrop (memq car '(defmacro cl-defmacro defmacro*)))
(name (nth 1 form))
(let* ((name (nth 1 form))
(args (pcase car
((or 'defun* 'defmacro* 'cl-defun 'cl-defmacro
'define-overloadable-function
'transient-define-prefix 'transient-define-suffix
((or 'transient-define-prefix 'transient-define-suffix
'transient-define-infix 'transient-define-argument
'transient-define-group)
(nth 2 form))
('define-compilation-mode
nil)
(_ t)))
(body (nthcdr (or (function-get car 'doc-string-elt) 3) form))
(doc (if (stringp (car body)) (pop body))))
@ -277,8 +270,7 @@ expand)' among their `declare' forms."
;; List of modes or just t.
(or (if (nthcdr 2 (car body))
(list 'quote (nthcdr 2 (car body)))
t))))
,(if macrop ''macro nil)))))
t))))))))
;; For defclass forms, use `eieio-defclass-autoload'.
((eq car 'defclass)