diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index 306deb6f7f5..bc164fa1e6b 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -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 diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el index 2958bd37e91..0e9898ceb2a 100644 --- a/lisp/emacs-lisp/derived.el +++ b/lisp/emacs-lisp/derived.el @@ -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,42 +209,44 @@ See Info node `(elisp)Derived Modes' for more details. parent child docstring syntax abbrev)) `(progn - (defvar ,hook nil) - (unless (get ',hook 'variable-documentation) - (put ',hook 'variable-documentation - ,(format "Hook run after entering `%S'. + (progn + :autoload-end + (defvar ,hook nil) + (unless (get ',hook 'variable-documentation) + (put ',hook 'variable-documentation + ,(format "Hook run after entering `%S'. No problems result if this variable is not bound. `add-hook' automatically binds it. (This is true for all hook variables.)" - child))) - (unless (boundp ',map) - (put ',map 'definition-name ',child)) - (with-no-warnings (defvar-keymap ,map)) - (unless (get ',map 'variable-documentation) - (put ',map 'variable-documentation - ,(format "Keymap for `%s'." child))) - ,(if declare-syntax - `(progn - (defvar ,syntax) - (unless (boundp ',syntax) - (put ',syntax 'definition-name ',child) - (defvar ,syntax (make-syntax-table))) - (unless (get ',syntax 'variable-documentation) - (put ',syntax 'variable-documentation - ,(format "Syntax table for `%s'." child))))) - ,(if declare-abbrev - `(progn - (defvar ,abbrev) - (unless (boundp ',abbrev) - (put ',abbrev 'definition-name ',child) - (defvar ,abbrev - (progn (define-abbrev-table ',abbrev nil) ,abbrev))) - (unless (get ',abbrev 'variable-documentation) - (put ',abbrev 'variable-documentation - ,(format "Abbrev table for `%s'." child))))) - (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)) + child))) + (unless (boundp ',map) + (put ',map 'definition-name ',child)) + (with-no-warnings (defvar-keymap ,map)) + (unless (get ',map 'variable-documentation) + (put ',map 'variable-documentation + ,(format "Keymap for `%s'." child))) + ,(if declare-syntax + `(progn + (defvar ,syntax) + (unless (boundp ',syntax) + (put ',syntax 'definition-name ',child) + (defvar ,syntax (make-syntax-table))) + (unless (get ',syntax 'variable-documentation) + (put ',syntax 'variable-documentation + ,(format "Syntax table for `%s'." child))))) + ,(if declare-abbrev + `(progn + (defvar ,abbrev) + (unless (boundp ',abbrev) + (put ',abbrev 'definition-name ',child) + (defvar ,abbrev + (progn (define-abbrev-table ',abbrev nil) ,abbrev))) + (unless (get ',abbrev 'variable-documentation) + (put ',abbrev 'variable-documentation + ,(format "Abbrev table for `%s'." child))))) + (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))) (defun ,child () ,docstring diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el index 0b36bb480ec..7259cdb127d 100644 --- a/lisp/emacs-lisp/generic.el +++ b/lisp/emacs-lisp/generic.el @@ -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 - ;; Add a new entry. - (add-to-list 'generic-mode-list ,name) + (progn + :autoload-end - ;; Add it to auto-mode-alist - (dolist (re ,auto-mode-list) - (add-to-list 'auto-mode-alist (cons re ',mode))) + ;; 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)))) (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))) diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index a6430cc8f55..3c42bb322a5 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -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. diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 01152328577..9e87434900a 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -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 diff --git a/lisp/skeleton.el b/lisp/skeleton.el index 5de45610463..3bf1de6419f 100644 --- a/lisp/skeleton.el +++ b/lisp/skeleton.el @@ -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