mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
loaddefs-gen: Weed out some elements from the shortcut path
The predefined macros marked as `autoload-macro expand` can't get to the shortcul path, so simplify it accordingly. Mark a few more macros from the shortcut path as `autoload-macro expand` but don't remove them yet from the shortcut path (need to update `ldefs-boot.el`). * lisp/progmodes/compile.el (define-compilation-mode): * lisp/emacs-lisp/generic.el (define-generic-mode): * lisp/emacs-lisp/derived.el (define-derived-mode): * lisp/cedet/mode-local.el (define-overloadable-function): * lisp/skeleton.el (define-skeleton): Mark as `autoload-macro expand` so as to make the "shortcut" path in `loaddefs-gen.el` redundant. * lisp/emacs-lisp/loaddefs-gen.el (loaddefs--defining-macros): Remove the easy-mmode.el macros since they are already marked as `autoload-macro expand` and they are always defined, so we never check them against that list. (loaddefs-generate--make-autoload): Remove handling of the `easy-mmode.el` macros as well as `defun` and `defmacro` from the shortcut path since we can never get there with them anyway.
This commit is contained in:
parent
dbd2cd2516
commit
74087e252f
6 changed files with 73 additions and 71 deletions
|
|
@ -548,12 +548,15 @@ OVERARGS is a list of arguments passed to the override and
|
|||
`NAME-default' function, in place of those deduced from ARGS."
|
||||
(declare (doc-string 3)
|
||||
(indent defun)
|
||||
(debug (&define name lambda-list stringp def-body)))
|
||||
`(eval-and-compile
|
||||
(debug (&define name lambda-list stringp def-body))
|
||||
(autoload-macro expand))
|
||||
`(progn
|
||||
(defun ,name ,args
|
||||
,docstring
|
||||
,@(mode-local--overload-body name args body))
|
||||
(put ',name 'mode-local-overload t)))
|
||||
:autoload-end
|
||||
(eval-and-compile
|
||||
(put ',name 'mode-local-overload t))))
|
||||
(put :override-with-args 'lisp-indent-function 1)
|
||||
|
||||
(define-obsolete-function-alias 'define-overload
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ See Info node `(elisp)Derived Modes' for more details.
|
|||
(declare (debug (&define name symbolp sexp [&optional stringp]
|
||||
[&rest keywordp sexp] def-body))
|
||||
(doc-string 4)
|
||||
(indent defun))
|
||||
(indent defun)
|
||||
(autoload-macro expand))
|
||||
|
||||
(when (and docstring (not (stringp docstring)))
|
||||
;; Some trickiness, since what appears to be the docstring may really be
|
||||
|
|
@ -208,6 +209,8 @@ See Info node `(elisp)Derived Modes' for more details.
|
|||
parent child docstring syntax abbrev))
|
||||
|
||||
`(progn
|
||||
(progn
|
||||
:autoload-end
|
||||
(defvar ,hook nil)
|
||||
(unless (get ',hook 'variable-documentation)
|
||||
(put ',hook 'variable-documentation
|
||||
|
|
@ -243,7 +246,7 @@ No problems result if this variable is not bound.
|
|||
(if (fboundp 'derived-mode-set-parent) ;; Emacs≥30.1
|
||||
(derived-mode-set-parent ',child ',parent)
|
||||
(put ',child 'derived-mode-parent ',parent))
|
||||
,(if group `(put ',child 'custom-mode-group ,group))
|
||||
,(if group `(put ',child 'custom-mode-group ,group)))
|
||||
|
||||
(defun ,child ()
|
||||
,docstring
|
||||
|
|
|
|||
|
|
@ -152,23 +152,27 @@ See the file generic-x.el for some examples of `define-generic-mode'."
|
|||
(declare (debug (sexp def-form def-form def-form form def-form
|
||||
[&optional stringp] &rest [keywordp form]))
|
||||
(indent 1)
|
||||
(doc-string 7))
|
||||
(doc-string 7)
|
||||
(autoload-macro expand))
|
||||
|
||||
;; Backward compatibility.
|
||||
(when (eq (car-safe mode) 'quote)
|
||||
(setq mode (eval mode)))
|
||||
(setq mode (eval mode t)))
|
||||
|
||||
(let* ((name (symbol-name mode))
|
||||
(pretty-name (capitalize (replace-regexp-in-string
|
||||
"-mode\\'" "" name))))
|
||||
|
||||
`(progn
|
||||
(progn
|
||||
:autoload-end
|
||||
|
||||
;; Add a new entry.
|
||||
(add-to-list 'generic-mode-list ,name)
|
||||
|
||||
;; Add it to auto-mode-alist
|
||||
(dolist (re ,auto-mode-list)
|
||||
(add-to-list 'auto-mode-alist (cons re ',mode)))
|
||||
(add-to-list 'auto-mode-alist (cons re ',mode))))
|
||||
|
||||
(defun ,mode ()
|
||||
,(or docstring
|
||||
|
|
@ -205,7 +209,7 @@ See the file generic-x.el for some examples of `define-generic-mode'."
|
|||
(setq font-lock-defaults '(generic-font-lock-keywords))
|
||||
|
||||
;; Call a list of functions
|
||||
(mapc 'funcall function-list)
|
||||
(mapc #'funcall function-list)
|
||||
|
||||
(run-mode-hooks mode-hook)))
|
||||
|
||||
|
|
|
|||
|
|
@ -155,14 +155,10 @@ scanning for autoloads and will be in the `load-path'."
|
|||
;; employing :autoload-end to omit unneeded forms).
|
||||
(defconst loaddefs--defining-macros
|
||||
'( define-skeleton define-derived-mode define-compilation-mode
|
||||
define-generic-mode define-globalized-minor-mode define-minor-mode
|
||||
define-generic-mode
|
||||
cl-defun defun* cl-defmacro defmacro* define-overloadable-function
|
||||
transient-define-prefix transient-define-suffix transient-define-infix
|
||||
transient-define-argument transient-define-group
|
||||
;; Obsolete; keep until the alias is removed.
|
||||
easy-mmode-define-global-mode
|
||||
easy-mmode-define-minor-mode
|
||||
define-global-minor-mode))
|
||||
transient-define-argument transient-define-group))
|
||||
|
||||
(defvar loaddefs--load-error-files nil)
|
||||
(defun loaddefs-generate--make-autoload (form file &optional expansion)
|
||||
|
|
@ -254,8 +250,7 @@ expand)' among their `declare' forms."
|
|||
(let* ((macrop (memq car '(defmacro cl-defmacro defmacro*)))
|
||||
(name (nth 1 form))
|
||||
(args (pcase car
|
||||
((or 'defun 'defmacro
|
||||
'defun* 'defmacro* 'cl-defun 'cl-defmacro
|
||||
((or 'defun* 'defmacro* 'cl-defun 'cl-defmacro
|
||||
'define-overloadable-function
|
||||
'transient-define-prefix 'transient-define-suffix
|
||||
'transient-define-infix 'transient-define-argument
|
||||
|
|
@ -277,17 +272,11 @@ expand)' among their `declare' forms."
|
|||
,file ,doc
|
||||
,(or (and (memq car '( define-skeleton define-derived-mode
|
||||
define-generic-mode
|
||||
define-globalized-minor-mode
|
||||
define-minor-mode
|
||||
transient-define-prefix
|
||||
transient-define-suffix
|
||||
transient-define-infix
|
||||
transient-define-argument
|
||||
transient-define-group
|
||||
;; Obsolete; keep until the alias is removed.
|
||||
easy-mmode-define-global-mode
|
||||
easy-mmode-define-minor-mode
|
||||
define-global-minor-mode))
|
||||
transient-define-group))
|
||||
t)
|
||||
(and (eq (car-safe (car body)) 'interactive)
|
||||
;; List of modes or just t.
|
||||
|
|
|
|||
|
|
@ -2443,7 +2443,8 @@ The parent is always `compilation-mode' and the customizable `compilation-...'
|
|||
variables are also set from the name of the mode you have chosen,
|
||||
by replacing the first word, e.g., `compilation-scroll-output' from
|
||||
`grep-scroll-output' if that variable exists."
|
||||
(declare (indent defun))
|
||||
(declare (indent defun)
|
||||
(autoload-macro expand))
|
||||
(let ((mode-name (replace-regexp-in-string "-mode\\'" "" (symbol-name mode))))
|
||||
`(define-derived-mode ,mode compilation-mode ,name
|
||||
,doc
|
||||
|
|
|
|||
|
|
@ -116,13 +116,11 @@ are integer buffer positions in the reverse order of the insertion order.")
|
|||
DOCUMENTATION is that of the command.
|
||||
SKELETON is as defined under `skeleton-insert'."
|
||||
(declare (doc-string 2) (debug (&define name stringp skeleton-edebug-spec))
|
||||
(indent defun))
|
||||
(indent defun)
|
||||
(autoload-macro expand))
|
||||
(if skeleton-debug
|
||||
(set command skeleton))
|
||||
`(progn
|
||||
;; Tell self-insert-command that this function, if called by an
|
||||
;; abbrev, should cause the self-insert to be skipped.
|
||||
(put ',command 'no-self-insert t)
|
||||
(defun ,command (&optional str arg)
|
||||
,(concat documentation
|
||||
(if (string-match "\n\\'" documentation)
|
||||
|
|
@ -139,7 +137,11 @@ A prefix argument of zero says to wrap around zero words---that is, nothing.
|
|||
This is a way of overriding the use of a highlighted region.")
|
||||
(interactive "*P\nP")
|
||||
(atomic-change-group
|
||||
(skeleton-proxy-new ',skeleton str arg)))))
|
||||
(skeleton-proxy-new ',skeleton str arg)))
|
||||
:autoload-end
|
||||
;; Tell self-insert-command that this function, if called by an
|
||||
;; abbrev, should cause the self-insert to be skipped.
|
||||
(put ',command 'no-self-insert t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun skeleton-proxy-new (skeleton &optional str arg)
|
||||
|
|
@ -257,7 +259,7 @@ available:
|
|||
(while (and l1 (> skeleton-regions 0))
|
||||
(push (copy-marker (pop l1) t) l2)
|
||||
(setq skeleton-regions (1- skeleton-regions)))
|
||||
(sort l2 '<))))
|
||||
(sort l2 #'<))))
|
||||
(goto-char (car skeleton-regions))
|
||||
(setq skeleton-regions (cdr skeleton-regions)))
|
||||
(let ((beg (point))
|
||||
|
|
@ -327,7 +329,7 @@ automatically, and you are prompted to fill in the variable parts.")))
|
|||
(symbol-value 'input))))))
|
||||
((functionp prompt)
|
||||
(funcall prompt))
|
||||
(t (eval prompt))))
|
||||
(t (eval prompt t))))
|
||||
(or eolp
|
||||
(delete-char 1))))
|
||||
(if (and recursive
|
||||
|
|
@ -436,7 +438,7 @@ automatically, and you are prompted to fill in the variable parts.")))
|
|||
((eq element '@)
|
||||
(push (point) skeleton-positions))
|
||||
((eq 'quote (car-safe element))
|
||||
(eval (nth 1 element)))
|
||||
(eval (nth 1 element) t))
|
||||
((and (consp element)
|
||||
(or (stringp (car element)) (listp (car element))))
|
||||
;; Don't forget: `symbolp' is also true for nil.
|
||||
|
|
@ -449,7 +451,7 @@ automatically, and you are prompted to fill in the variable parts.")))
|
|||
(skeleton-internal-list element (car literal))
|
||||
(setq literal (cdr literal)))))
|
||||
((null element))
|
||||
(t (skeleton-internal-1 (eval element) t recursive))))
|
||||
(t (skeleton-internal-1 (eval element t) t recursive))))
|
||||
|
||||
;; Maybe belongs into simple.el or elsewhere
|
||||
;; ;;;###autoload
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue