mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-21 10:24:55 +00:00
Transform mentions of eval-after-load' to
with-eval-after-load'
* doc/lispref/loading.texi (Hooks for Loading): Update text to
not mention `eval-after-load' (bug#20038).
(cherry picked from commit 9392193be5
)
This commit is contained in:
parent
ec392ff1a3
commit
2abc85e41e
@ -1302,7 +1302,8 @@ it in order for this to take effect.
|
||||
automatically by putting the following in your init file:
|
||||
|
||||
@example
|
||||
(eval-after-load "outline" '(require 'foldout))
|
||||
(with-eval-after-load "outline"
|
||||
(require 'foldout))
|
||||
@end example
|
||||
|
||||
@node Org Mode
|
||||
|
@ -1359,7 +1359,7 @@ Appendix, elisp, Emacs Lisp Reference}.
|
||||
@end ifclear
|
||||
|
||||
@item
|
||||
Avoid using @code{defadvice} or @code{eval-after-load} for Lisp code
|
||||
Avoid using @code{defadvice} or @code{with-eval-after-load} for Lisp code
|
||||
to be included in Emacs.
|
||||
|
||||
@item
|
||||
|
@ -1089,11 +1089,12 @@ execution of the rest of @var{body}.
|
||||
@end defmac
|
||||
|
||||
Normally, well-designed Lisp programs should not use
|
||||
@code{eval-after-load}. If you need to examine and set the variables
|
||||
defined in another library (those meant for outside use), you can do
|
||||
it immediately---there is no need to wait until the library is loaded.
|
||||
If you need to call functions defined by that library, you should load
|
||||
the library, preferably with @code{require} (@pxref{Named Features}).
|
||||
@code{with-eval-after-load}. If you need to examine and set the
|
||||
variables defined in another library (those meant for outside use),
|
||||
you can do it immediately---there is no need to wait until the library
|
||||
is loaded. If you need to call functions defined by that library, you
|
||||
should load the library, preferably with @code{require} (@pxref{Named
|
||||
Features}).
|
||||
|
||||
@node Dynamic Modules
|
||||
@section Emacs Dynamic Modules
|
||||
|
@ -200,12 +200,12 @@ It is likewise a bad idea for one Lisp package to advise a function in
|
||||
another Lisp package (@pxref{Advising Functions}).
|
||||
|
||||
@item
|
||||
Avoid using @code{eval-after-load} in libraries and packages
|
||||
(@pxref{Hooks for Loading}). This feature is meant for personal
|
||||
customizations; using it in a Lisp program is unclean, because it
|
||||
modifies the behavior of another Lisp file in a way that's not visible
|
||||
in that file. This is an obstacle for debugging, much like advising a
|
||||
function in the other package.
|
||||
Avoid using @code{eval-after-load} and @code{with-eval-after-load} in
|
||||
libraries and packages (@pxref{Hooks for Loading}). This feature is
|
||||
meant for personal customizations; using it in a Lisp program is
|
||||
unclean, because it modifies the behavior of another Lisp file in a
|
||||
way that's not visible in that file. This is an obstacle for
|
||||
debugging, much like advising a function in the other package.
|
||||
|
||||
@item
|
||||
If a file does replace any of the standard functions or library
|
||||
|
@ -177,12 +177,10 @@ initialization file to add a shortcut for email address expansion in
|
||||
email composition buffers (@pxref{Inline Query Expansion})
|
||||
|
||||
@lisp
|
||||
(eval-after-load
|
||||
"message"
|
||||
'(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
|
||||
(eval-after-load
|
||||
"sendmail"
|
||||
'(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
|
||||
(with-eval-after-load "message"
|
||||
(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
|
||||
(with-eval-after-load "sendmail"
|
||||
(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
|
||||
@end lisp
|
||||
|
||||
@menu
|
||||
@ -271,8 +269,8 @@ LDAP:
|
||||
@vindex eudc-server-hotlist
|
||||
@vindex ldap-host-parameters-alist
|
||||
@lisp
|
||||
(eval-after-load "message"
|
||||
'(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
|
||||
(with-eval-after-load "message"
|
||||
(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
|
||||
(customize-set-variable 'eudc-server-hotlist
|
||||
'(("" . bbdb)
|
||||
("ldaps://ldap.gnu.org" . ldap)))
|
||||
@ -327,8 +325,8 @@ configure EUDC for LDAP:
|
||||
@vindex eudc-server-hotlist
|
||||
@vindex ldap-host-parameters-alist
|
||||
@lisp
|
||||
(eval-after-load "message"
|
||||
'(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
|
||||
(with-eval-after-load "message"
|
||||
(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
|
||||
(customize-set-variable 'eudc-server-hotlist
|
||||
'(("" . bbdb)
|
||||
("ldaps://ldap.gnu.org" . ldap)))
|
||||
@ -356,8 +354,8 @@ and the @file{.emacs} expressions become:
|
||||
@vindex eudc-server-hotlist
|
||||
@vindex ldap-host-parameters-alist
|
||||
@lisp
|
||||
(eval-after-load "message"
|
||||
'(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
|
||||
(with-eval-after-load "message"
|
||||
(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
|
||||
(customize-set-variable 'eudc-server-hotlist
|
||||
'(("" . bbdb) ("" . ldap)))
|
||||
(customize-set-variable 'ldap-host-parameters-alist
|
||||
|
@ -584,8 +584,8 @@ Now we need to tell Gnus, where to get its mail from. If
|
||||
it's a POP3 server, then you need something like this:
|
||||
|
||||
@example
|
||||
(eval-after-load "mail-source"
|
||||
'(add-to-list 'mail-sources '(pop :server "pop.YourProvider.net"
|
||||
(with-eval-after-load "mail-source"
|
||||
(add-to-list 'mail-sources '(pop :server "pop.YourProvider.net"
|
||||
:user "yourUserName"
|
||||
:password "yourPassword")))
|
||||
@end example
|
||||
@ -596,8 +596,8 @@ your password there. If you want to read your mail from a
|
||||
traditional spool file on your local machine, it's
|
||||
|
||||
@example
|
||||
(eval-after-load "mail-source"
|
||||
'(add-to-list 'mail-sources '(file :path "/path/to/spool/file"))
|
||||
(with-eval-after-load "mail-source"
|
||||
(add-to-list 'mail-sources '(file :path "/path/to/spool/file"))
|
||||
@end example
|
||||
@noindent
|
||||
|
||||
@ -605,8 +605,8 @@ If it's a Maildir, with one file per message as used by
|
||||
postfix, Qmail and (optionally) fetchmail it's
|
||||
|
||||
@example
|
||||
(eval-after-load "mail-source"
|
||||
'(add-to-list 'mail-sources '(maildir :path "/path/to/Maildir/"
|
||||
(with-eval-after-load "mail-source"
|
||||
(add-to-list 'mail-sources '(maildir :path "/path/to/Maildir/"
|
||||
:subdirs ("cur" "new")))
|
||||
@end example
|
||||
@noindent
|
||||
@ -616,8 +616,8 @@ in one directory, for example because procmail already split your
|
||||
mail, it's
|
||||
|
||||
@example
|
||||
(eval-after-load "mail-source"
|
||||
'(add-to-list 'mail-sources
|
||||
(with-eval-after-load "mail-source"
|
||||
(add-to-list 'mail-sources
|
||||
'(directory :path "/path/to/procmail-dir/"
|
||||
:suffix ".prcml")))
|
||||
@end example
|
||||
@ -850,10 +850,9 @@ text part if it's available. How to do it?
|
||||
Say
|
||||
|
||||
@example
|
||||
(eval-after-load "mm-decode"
|
||||
'(progn
|
||||
(with-eval-after-load "mm-decode"
|
||||
(add-to-list 'mm-discouraged-alternatives "text/html")
|
||||
(add-to-list 'mm-discouraged-alternatives "text/richtext")))
|
||||
(add-to-list 'mm-discouraged-alternatives "text/richtext"))
|
||||
@end example
|
||||
@noindent
|
||||
|
||||
@ -1577,8 +1576,8 @@ if you already use Gnus 5.10, if you still use 5.8.8 or
|
||||
5.9 try this instead:
|
||||
|
||||
@example
|
||||
(eval-after-load "gnus-msg"
|
||||
'(unless (boundp 'gnus-confirm-mail-reply-to-news)
|
||||
(with-eval-after-load "gnus-msg"
|
||||
(unless (boundp 'gnus-confirm-mail-reply-to-news)
|
||||
(defadvice gnus-summary-reply (around reply-in-news activate)
|
||||
"Request confirmation when replying to news."
|
||||
(interactive)
|
||||
@ -1599,8 +1598,8 @@ Since 5.10 Gnus doesn't generate a sender header by
|
||||
default. For older Gnus' try this in @file{~/.gnus.el}:
|
||||
|
||||
@example
|
||||
(eval-after-load "message"
|
||||
'(add-to-list 'message-syntax-checks '(sender . disabled)))
|
||||
(with-eval-after-load "message"
|
||||
(add-to-list 'message-syntax-checks '(sender . disabled)))
|
||||
@end example
|
||||
@noindent
|
||||
|
||||
@ -1665,8 +1664,8 @@ in @file{~/.gnus.el}. If you use Gnus 5.9 or earlier, you can use this
|
||||
instead (works for newer versions as well):
|
||||
|
||||
@example
|
||||
(eval-after-load "message"
|
||||
'(let ((fqdn "yourmachine.yourdomain.tld"));; <-- Edit this!
|
||||
(with-eval-after-load "message"
|
||||
(let ((fqdn "yourmachine.yourdomain.tld"));; <-- Edit this!
|
||||
(if (boundp 'message-user-fqdn)
|
||||
(setq message-user-fqdn fqdn)
|
||||
(gnus-message 1 "Redefining `message-make-fqdn'.")
|
||||
@ -2195,7 +2194,7 @@ An other idea would be to byte compile your @file{~/.gnus.el} (say
|
||||
@samp{M-x byte-compile-file RET ~/.gnus.el
|
||||
RET} to do it). Finally, if you have require
|
||||
statements in your .gnus, you could replace them with
|
||||
eval-after-load, which loads the stuff not at startup
|
||||
@code{with-eval-after-load}, which loads the stuff not at startup
|
||||
time, but when it's needed. Say you've got this in your
|
||||
@file{~/.gnus.el}:
|
||||
|
||||
@ -2209,8 +2208,8 @@ then as soon as you start Gnus, message.el is loaded. If
|
||||
you replace it with
|
||||
|
||||
@example
|
||||
(eval-after-load "message"
|
||||
'(add-to-list 'message-syntax-checks '(sender . disabled)))
|
||||
(with-eval-after-load "message"
|
||||
(add-to-list 'message-syntax-checks '(sender . disabled)))
|
||||
@end example
|
||||
@noindent
|
||||
|
||||
|
@ -17147,8 +17147,8 @@ summary buffer.
|
||||
(gnus-summary-mark-as-read-forward 1))
|
||||
(gnus-summary-scroll-up arg))))
|
||||
|
||||
(eval-after-load "gnus"
|
||||
#'(define-key gnus-summary-mode-map
|
||||
(with-eval-after-load "gnus"
|
||||
(define-key gnus-summary-mode-map
|
||||
(kbd "<RET>") 'browse-nnrss-url))
|
||||
(add-to-list 'nnmail-extra-headers nnrss-url-field)
|
||||
@end lisp
|
||||
@ -17165,8 +17165,8 @@ Parameters}) in order to display @samp{text/html} parts only in
|
||||
|
||||
@lisp
|
||||
;; @r{Set the default value of @code{mm-discouraged-alternatives}.}
|
||||
(eval-after-load "gnus-sum"
|
||||
'(add-to-list
|
||||
(with-eval-after-load "gnus-sum"
|
||||
(add-to-list
|
||||
'gnus-newsgroup-variables
|
||||
'(mm-discouraged-alternatives
|
||||
. '("text/html" "image/.*"))))
|
||||
|
@ -880,8 +880,8 @@ because @code{defun-rcirc-command} is not yet available, and without
|
||||
@code{rcirc} loaded, the command wouldn't do us much good anyway.
|
||||
|
||||
@smallexample
|
||||
(eval-after-load 'rcirc
|
||||
'(defun-rcirc-command sv (arg)
|
||||
(with-eval-after-load 'rcirc
|
||||
(defun-rcirc-command sv (arg)
|
||||
"Boast about rcirc."
|
||||
(interactive "i")
|
||||
(rcirc-send-message process target
|
||||
@ -904,8 +904,8 @@ copies of every channel buffer, one dead and one live.
|
||||
The real answer, therefore, is a @code{/reconnect} command:
|
||||
|
||||
@smallexample
|
||||
(eval-after-load 'rcirc
|
||||
'(defun-rcirc-command reconnect (arg)
|
||||
(with-eval-after-load 'rcirc
|
||||
(defun-rcirc-command reconnect (arg)
|
||||
"Reconnect the server process."
|
||||
(interactive "i")
|
||||
(unless process
|
||||
|
@ -3390,8 +3390,8 @@ Since @file{filecache} remembers visited places, add the remote
|
||||
directory to the cache:
|
||||
|
||||
@lisp
|
||||
(eval-after-load "filecache"
|
||||
'(file-cache-add-directory
|
||||
(with-eval-after-load "filecache"
|
||||
(file-cache-add-directory
|
||||
"@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}"))
|
||||
@end lisp
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user