Autoload more carefully from Lisp. Follow aliases for function properties.
* lisp/subr.el (autoloadp): New function. (symbol-file): Use it. (function-get): New function. * lisp/emacs-lisp/macroexp.el (macroexp--expand-all): Use function-get and autoload-do-load. * lisp/emacs-lisp/lisp-mode.el (lisp-font-lock-syntactic-face-function) (lisp-indent-function): * lisp/emacs-lisp/gv.el (gv-get): * lisp/emacs-lisp/edebug.el (get-edebug-spec, edebug-basic-spec): * lisp/emacs-lisp/byte-opt.el (byte-optimize-form): * lisp/emacs-lisp/bytecomp.el (byte-compile-arglist-warn): * lisp/emacs-lisp/autoload.el (make-autoload, autoload-print-form): Use function-get. * lisp/emacs-lisp/cl.el: Don't propagate function properties any more. * src/eval.c (Fautoload_do_load): Rename from do_autoload, export to Lisp, add argument, tune behavior, and adjust all callers. * lisp/speedbar.el (speedbar-add-localized-speedbar-support): * lisp/emacs-lisp/disass.el (disassemble-internal): * lisp/desktop.el (desktop-load-file): * lisp/help-fns.el (help-function-arglist, find-lisp-object-file-name) (describe-function-1): * lisp/emacs-lisp/find-func.el (find-function-noselect): * lisp/emacs-lisp/elp.el (elp-instrument-function): * lisp/emacs-lisp/advice.el (ad-has-proper-definition): * lisp/apropos.el (apropos-safe-documentation, apropos-macrop): * lisp/emacs-lisp/debug.el (debug-on-entry): * lisp/emacs-lisp/cl-macs.el (cl-compiler-macroexpand): * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): * lisp/calc/calc.el (name): Use autoloadp & autoload-do-load.
This commit is contained in:
parent
b1364986cb
commit
7abaf5ccc9
29 changed files with 190 additions and 136 deletions
33
lisp/subr.el
33
lisp/subr.el
|
@ -1691,6 +1691,23 @@ If TOGGLE has a `:menu-tag', that is used for the menu item's label."
|
|||
|
||||
;;; Load history
|
||||
|
||||
(defsubst autoloadp (object)
|
||||
"Non-nil if OBJECT is an autoload."
|
||||
(eq 'autoload (car-safe object)))
|
||||
|
||||
;; (defun autoload-type (object)
|
||||
;; "Returns the type of OBJECT or `function' or `command' if the type is nil.
|
||||
;; OBJECT should be an autoload object."
|
||||
;; (when (autoloadp object)
|
||||
;; (let ((type (nth 3 object)))
|
||||
;; (cond ((null type) (if (nth 2 object) 'command 'function))
|
||||
;; ((eq 'keymap t) 'macro)
|
||||
;; (type)))))
|
||||
|
||||
;; (defalias 'autoload-file #'cadr
|
||||
;; "Return the name of the file from which AUTOLOAD will be loaded.
|
||||
;; \n\(fn AUTOLOAD)")
|
||||
|
||||
(defun symbol-file (symbol &optional type)
|
||||
"Return the name of the file that defined SYMBOL.
|
||||
The value is normally an absolute file name. It can also be nil,
|
||||
|
@ -1703,7 +1720,7 @@ TYPE is `defun', `defvar', or `defface', that specifies function
|
|||
definition, variable definition, or face definition only."
|
||||
(if (and (or (null type) (eq type 'defun))
|
||||
(symbolp symbol) (fboundp symbol)
|
||||
(eq 'autoload (car-safe (symbol-function symbol))))
|
||||
(autoloadp (symbol-function symbol)))
|
||||
(nth 1 (symbol-function symbol))
|
||||
(let ((files load-history)
|
||||
file)
|
||||
|
@ -2752,6 +2769,20 @@ computing the hash. If BINARY is non-nil, return a string in binary
|
|||
form."
|
||||
(secure-hash 'sha1 object start end binary))
|
||||
|
||||
(defun function-get (f prop &optional autoload)
|
||||
"Return the value of property PROP of function F.
|
||||
If AUTOLOAD is non-nil and F is an autoloaded macro, try to autoload
|
||||
the macro in the hope that it will set PROP."
|
||||
(let ((val nil))
|
||||
(while (and (symbolp f)
|
||||
(null (setq val (get f prop)))
|
||||
(fboundp f))
|
||||
(let ((fundef (symbol-function f)))
|
||||
(if (and autoload (autoloadp fundef)
|
||||
(not (equal fundef (autoload-do-load fundef f 'macro))))
|
||||
nil ;Re-try `get' on the same `f'.
|
||||
(setq f fundef))))
|
||||
val))
|
||||
|
||||
;;;; Support for yanking and text properties.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue