From: Daniel Brockman <dbrockman@gmail.com>
To: emacs-devel@gnu.org
Subject: `eval-after-load' broken for symbols?
Date: Tue, 1 Nov 2011 16:17:58 +0100 [thread overview]
Message-ID: <980A1209-F9FB-4B2F-95A3-592EA5206B7A@gmail.com> (raw)
The ubiquitous function `eval-after-load` seems to be broken.
The following code causes the message to be displayed:
(require 'dired)
(eval-after-load "dired"
'(message "String works!"))
But the following code doesn’t:
(require 'dired)
(eval-after-load 'dired
'(message "Symbol works!"))
From the docstring of `eval-after-load`:
Arrange that if FILE is loaded, FORM will be run immediately afterwards.
If FILE is already loaded, evaluate FORM right now.
[…]
Alternatively, FILE can be a feature (i.e. a symbol), in which case FORM
is evaluated at the end of any file that `provide's this feature.
I guess that _could_ be trying to say that "when FILE is a symbol"
it *shouldn’t* "evaluate FORM right now", but if you look at the source
code for `eval-after-load` it doesn’t actually avoid evaluating FORM,
it just happens for an unrelated reason to wrap it in a false conditional:
(when (symbolp regexp-or-feature)
;; For features, the after-load-alist elements get run when `provide' is
;; called rather than at the end of the file. So add an indirection to
;; make sure that `form' is really run "after-load" in case the provide
;; call happens early.
(setq form
`(when load-file-name
…
So, is this actually a bug? The behavior sure seems broken anyway.
--
Daniel Brockman, partner & developer
Go Interactive <http://gointeractive.se>
Twitter: http://twitter.com/dbrock
Telephone: +46706880739
next reply other threads:[~2011-11-01 15:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-01 15:17 Daniel Brockman [this message]
2011-11-07 20:14 ` `eval-after-load' broken for symbols? Johan Bockgård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=980A1209-F9FB-4B2F-95A3-592EA5206B7A@gmail.com \
--to=dbrockman@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.