mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-29 07:58:28 +00:00
(eval-at-startup): New macro.
This commit is contained in:
parent
55f77e1ce3
commit
adbe2d11a7
18
lisp/subr.el
18
lisp/subr.el
@ -1322,7 +1322,23 @@ definition only or variable definition only.
|
||||
file)))
|
||||
|
||||
|
||||
;;;; Specifying things to do after certain files are loaded.
|
||||
;;;; Specifying things to do later.
|
||||
|
||||
(defmacro eval-at-startup (&rest body)
|
||||
"Make arrangements to evaluate BODY when Emacs starts up.
|
||||
If this is run after Emacs startup, evaluate BODY immediately.
|
||||
Always returns nil.
|
||||
|
||||
This works by adding a function to `before-init-hook'.
|
||||
That function's doc string says which file created it."
|
||||
`(progn
|
||||
(if command-line-processed
|
||||
(progn . ,body)
|
||||
(add-hook 'before-init-hook
|
||||
'(lambda () ,(concat "From " (or load-file-name "no file"))
|
||||
. ,body)
|
||||
t))
|
||||
nil))
|
||||
|
||||
(defun eval-after-load (file form)
|
||||
"Arrange that, if FILE is ever loaded, FORM will be run at that time.
|
||||
|
Loading…
Reference in New Issue
Block a user