1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-26 08:41:47 -07: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:
Lars Ingebrigtsen 2016-04-30 19:20:12 +02:00
parent ec392ff1a3
commit 2abc85e41e
9 changed files with 101 additions and 102 deletions

View file

@ -1302,7 +1302,8 @@ it in order for this to take effect.
automatically by putting the following in your init file: automatically by putting the following in your init file:
@example @example
(eval-after-load "outline" '(require 'foldout)) (with-eval-after-load "outline"
(require 'foldout))
@end example @end example
@node Org Mode @node Org Mode

View file

@ -1359,7 +1359,7 @@ Appendix, elisp, Emacs Lisp Reference}.
@end ifclear @end ifclear
@item @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. to be included in Emacs.
@item @item

View file

@ -1089,11 +1089,12 @@ execution of the rest of @var{body}.
@end defmac @end defmac
Normally, well-designed Lisp programs should not use Normally, well-designed Lisp programs should not use
@code{eval-after-load}. If you need to examine and set the variables @code{with-eval-after-load}. If you need to examine and set the
defined in another library (those meant for outside use), you can do variables defined in another library (those meant for outside use),
it immediately---there is no need to wait until the library is loaded. you can do it immediately---there is no need to wait until the library
If you need to call functions defined by that library, you should load is loaded. If you need to call functions defined by that library, you
the library, preferably with @code{require} (@pxref{Named Features}). should load the library, preferably with @code{require} (@pxref{Named
Features}).
@node Dynamic Modules @node Dynamic Modules
@section Emacs Dynamic Modules @section Emacs Dynamic Modules

View file

@ -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}). another Lisp package (@pxref{Advising Functions}).
@item @item
Avoid using @code{eval-after-load} in libraries and packages Avoid using @code{eval-after-load} and @code{with-eval-after-load} in
(@pxref{Hooks for Loading}). This feature is meant for personal libraries and packages (@pxref{Hooks for Loading}). This feature is
customizations; using it in a Lisp program is unclean, because it meant for personal customizations; using it in a Lisp program is
modifies the behavior of another Lisp file in a way that's not visible unclean, because it modifies the behavior of another Lisp file in a
in that file. This is an obstacle for debugging, much like advising a way that's not visible in that file. This is an obstacle for
function in the other package. debugging, much like advising a function in the other package.
@item @item
If a file does replace any of the standard functions or library If a file does replace any of the standard functions or library

View file

@ -177,12 +177,10 @@ initialization file to add a shortcut for email address expansion in
email composition buffers (@pxref{Inline Query Expansion}) email composition buffers (@pxref{Inline Query Expansion})
@lisp @lisp
(eval-after-load (with-eval-after-load "message"
"message" (define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
'(define-key message-mode-map [(control ?c) (tab)] 'eudc-expand-inline)) (with-eval-after-load "sendmail"
(eval-after-load (define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
"sendmail"
'(define-key mail-mode-map [(control ?c) (tab)] 'eudc-expand-inline))
@end lisp @end lisp
@menu @menu
@ -271,8 +269,8 @@ LDAP:
@vindex eudc-server-hotlist @vindex eudc-server-hotlist
@vindex ldap-host-parameters-alist @vindex ldap-host-parameters-alist
@lisp @lisp
(eval-after-load "message" (with-eval-after-load "message"
'(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline)) (define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
(customize-set-variable 'eudc-server-hotlist (customize-set-variable 'eudc-server-hotlist
'(("" . bbdb) '(("" . bbdb)
("ldaps://ldap.gnu.org" . ldap))) ("ldaps://ldap.gnu.org" . ldap)))
@ -327,8 +325,8 @@ configure EUDC for LDAP:
@vindex eudc-server-hotlist @vindex eudc-server-hotlist
@vindex ldap-host-parameters-alist @vindex ldap-host-parameters-alist
@lisp @lisp
(eval-after-load "message" (with-eval-after-load "message"
'(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline)) (define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
(customize-set-variable 'eudc-server-hotlist (customize-set-variable 'eudc-server-hotlist
'(("" . bbdb) '(("" . bbdb)
("ldaps://ldap.gnu.org" . ldap))) ("ldaps://ldap.gnu.org" . ldap)))
@ -356,8 +354,8 @@ and the @file{.emacs} expressions become:
@vindex eudc-server-hotlist @vindex eudc-server-hotlist
@vindex ldap-host-parameters-alist @vindex ldap-host-parameters-alist
@lisp @lisp
(eval-after-load "message" (with-eval-after-load "message"
'(define-key message-mode-map (kbd "TAB") 'eudc-expand-inline)) (define-key message-mode-map (kbd "TAB") 'eudc-expand-inline))
(customize-set-variable 'eudc-server-hotlist (customize-set-variable 'eudc-server-hotlist
'(("" . bbdb) ("" . ldap))) '(("" . bbdb) ("" . ldap)))
(customize-set-variable 'ldap-host-parameters-alist (customize-set-variable 'ldap-host-parameters-alist

View file

@ -584,10 +584,10 @@ Now we need to tell Gnus, where to get its mail from. If
it's a POP3 server, then you need something like this: it's a POP3 server, then you need something like this:
@example @example
(eval-after-load "mail-source" (with-eval-after-load "mail-source"
'(add-to-list 'mail-sources '(pop :server "pop.YourProvider.net" (add-to-list 'mail-sources '(pop :server "pop.YourProvider.net"
:user "yourUserName" :user "yourUserName"
:password "yourPassword"))) :password "yourPassword")))
@end example @end example
@noindent @noindent
@ -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 traditional spool file on your local machine, it's
@example @example
(eval-after-load "mail-source" (with-eval-after-load "mail-source"
'(add-to-list 'mail-sources '(file :path "/path/to/spool/file")) (add-to-list 'mail-sources '(file :path "/path/to/spool/file"))
@end example @end example
@noindent @noindent
@ -605,9 +605,9 @@ If it's a Maildir, with one file per message as used by
postfix, Qmail and (optionally) fetchmail it's postfix, Qmail and (optionally) fetchmail it's
@example @example
(eval-after-load "mail-source" (with-eval-after-load "mail-source"
'(add-to-list 'mail-sources '(maildir :path "/path/to/Maildir/" (add-to-list 'mail-sources '(maildir :path "/path/to/Maildir/"
:subdirs ("cur" "new"))) :subdirs ("cur" "new")))
@end example @end example
@noindent @noindent
@ -616,10 +616,10 @@ in one directory, for example because procmail already split your
mail, it's mail, it's
@example @example
(eval-after-load "mail-source" (with-eval-after-load "mail-source"
'(add-to-list 'mail-sources (add-to-list 'mail-sources
'(directory :path "/path/to/procmail-dir/" '(directory :path "/path/to/procmail-dir/"
:suffix ".prcml"))) :suffix ".prcml")))
@end example @end example
@noindent @noindent
@ -850,10 +850,9 @@ text part if it's available. How to do it?
Say Say
@example @example
(eval-after-load "mm-decode" (with-eval-after-load "mm-decode"
'(progn (add-to-list 'mm-discouraged-alternatives "text/html")
(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 @end example
@noindent @noindent
@ -1577,14 +1576,14 @@ if you already use Gnus 5.10, if you still use 5.8.8 or
5.9 try this instead: 5.9 try this instead:
@example @example
(eval-after-load "gnus-msg" (with-eval-after-load "gnus-msg"
'(unless (boundp 'gnus-confirm-mail-reply-to-news) (unless (boundp 'gnus-confirm-mail-reply-to-news)
(defadvice gnus-summary-reply (around reply-in-news activate) (defadvice gnus-summary-reply (around reply-in-news activate)
"Request confirmation when replying to news." "Request confirmation when replying to news."
(interactive) (interactive)
(when (or (not (gnus-news-group-p gnus-newsgroup-name)) (when (or (not (gnus-news-group-p gnus-newsgroup-name))
(y-or-n-p "Really reply by mail to article author? ")) (y-or-n-p "Really reply by mail to article author? "))
ad-do-it)))) ad-do-it))))
@end example @end example
@noindent @noindent
@ -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}: default. For older Gnus' try this in @file{~/.gnus.el}:
@example @example
(eval-after-load "message" (with-eval-after-load "message"
'(add-to-list 'message-syntax-checks '(sender . disabled))) (add-to-list 'message-syntax-checks '(sender . disabled)))
@end example @end example
@noindent @noindent
@ -1665,14 +1664,14 @@ in @file{~/.gnus.el}. If you use Gnus 5.9 or earlier, you can use this
instead (works for newer versions as well): instead (works for newer versions as well):
@example @example
(eval-after-load "message" (with-eval-after-load "message"
'(let ((fqdn "yourmachine.yourdomain.tld"));; <-- Edit this! (let ((fqdn "yourmachine.yourdomain.tld"));; <-- Edit this!
(if (boundp 'message-user-fqdn) (if (boundp 'message-user-fqdn)
(setq message-user-fqdn fqdn) (setq message-user-fqdn fqdn)
(gnus-message 1 "Redefining `message-make-fqdn'.") (gnus-message 1 "Redefining `message-make-fqdn'.")
(defun message-make-fqdn () (defun message-make-fqdn ()
"Return user's fully qualified domain name." "Return user's fully qualified domain name."
fqdn)))) fqdn))))
@end example @end example
@noindent @noindent
@ -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 @samp{M-x byte-compile-file RET ~/.gnus.el
RET} to do it). Finally, if you have require RET} to do it). Finally, if you have require
statements in your .gnus, you could replace them with 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 time, but when it's needed. Say you've got this in your
@file{~/.gnus.el}: @file{~/.gnus.el}:
@ -2209,8 +2208,8 @@ then as soon as you start Gnus, message.el is loaded. If
you replace it with you replace it with
@example @example
(eval-after-load "message" (with-eval-after-load "message"
'(add-to-list 'message-syntax-checks '(sender . disabled))) (add-to-list 'message-syntax-checks '(sender . disabled)))
@end example @end example
@noindent @noindent

View file

@ -17147,9 +17147,9 @@ summary buffer.
(gnus-summary-mark-as-read-forward 1)) (gnus-summary-mark-as-read-forward 1))
(gnus-summary-scroll-up arg)))) (gnus-summary-scroll-up arg))))
(eval-after-load "gnus" (with-eval-after-load "gnus"
#'(define-key gnus-summary-mode-map (define-key gnus-summary-mode-map
(kbd "<RET>") 'browse-nnrss-url)) (kbd "<RET>") 'browse-nnrss-url))
(add-to-list 'nnmail-extra-headers nnrss-url-field) (add-to-list 'nnmail-extra-headers nnrss-url-field)
@end lisp @end lisp
@ -17165,11 +17165,11 @@ Parameters}) in order to display @samp{text/html} parts only in
@lisp @lisp
;; @r{Set the default value of @code{mm-discouraged-alternatives}.} ;; @r{Set the default value of @code{mm-discouraged-alternatives}.}
(eval-after-load "gnus-sum" (with-eval-after-load "gnus-sum"
'(add-to-list (add-to-list
'gnus-newsgroup-variables 'gnus-newsgroup-variables
'(mm-discouraged-alternatives '(mm-discouraged-alternatives
. '("text/html" "image/.*")))) . '("text/html" "image/.*"))))
;; @r{Display @samp{text/html} parts in @code{nnrss} groups.} ;; @r{Display @samp{text/html} parts in @code{nnrss} groups.}
(add-to-list (add-to-list

View file

@ -880,11 +880,11 @@ because @code{defun-rcirc-command} is not yet available, and without
@code{rcirc} loaded, the command wouldn't do us much good anyway. @code{rcirc} loaded, the command wouldn't do us much good anyway.
@smallexample @smallexample
(eval-after-load 'rcirc (with-eval-after-load 'rcirc
'(defun-rcirc-command sv (arg) (defun-rcirc-command sv (arg)
"Boast about rcirc." "Boast about rcirc."
(interactive "i") (interactive "i")
(rcirc-send-message process target (rcirc-send-message process target
(concat "I use " rcirc-id-string)))) (concat "I use " rcirc-id-string))))
@end smallexample @end smallexample
@ -904,29 +904,29 @@ copies of every channel buffer, one dead and one live.
The real answer, therefore, is a @code{/reconnect} command: The real answer, therefore, is a @code{/reconnect} command:
@smallexample @smallexample
(eval-after-load 'rcirc (with-eval-after-load 'rcirc
'(defun-rcirc-command reconnect (arg) (defun-rcirc-command reconnect (arg)
"Reconnect the server process." "Reconnect the server process."
(interactive "i") (interactive "i")
(unless process (unless process
(error "There's no process for this target")) (error "There's no process for this target"))
(let* ((server (car (process-contact process))) (let* ((server (car (process-contact process)))
(port (process-contact process :service)) (port (process-contact process :service))
(nick (rcirc-nick process)) (nick (rcirc-nick process))
channels query-buffers) channels query-buffers)
(dolist (buf (buffer-list)) (dolist (buf (buffer-list))
(with-current-buffer buf (with-current-buffer buf
(when (eq process (rcirc-buffer-process)) (when (eq process (rcirc-buffer-process))
(remove-hook 'change-major-mode-hook (remove-hook 'change-major-mode-hook
'rcirc-change-major-mode-hook) 'rcirc-change-major-mode-hook)
(if (rcirc-channel-p rcirc-target) (if (rcirc-channel-p rcirc-target)
(setq channels (cons rcirc-target channels)) (setq channels (cons rcirc-target channels))
(setq query-buffers (cons buf query-buffers)))))) (setq query-buffers (cons buf query-buffers))))))
(delete-process process) (delete-process process)
(rcirc-connect server port nick (rcirc-connect server port nick
rcirc-default-user-name rcirc-default-user-name
rcirc-default-full-name rcirc-default-full-name
channels)))) channels))))
@end smallexample @end smallexample
@node GNU Free Documentation License @node GNU Free Documentation License

View file

@ -3390,9 +3390,9 @@ Since @file{filecache} remembers visited places, add the remote
directory to the cache: directory to the cache:
@lisp @lisp
(eval-after-load "filecache" (with-eval-after-load "filecache"
'(file-cache-add-directory (file-cache-add-directory
"@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}")) "@trampfn{ssh,news@@news.my.domain,/opt/news/etc/}"))
@end lisp @end lisp
Then use directory completion in the minibuffer with @kbd{C-x C-f Then use directory completion in the minibuffer with @kbd{C-x C-f