* `eval-after-load' broken for symbols?
@ 2011-11-01 15:17 Daniel Brockman
2011-11-07 20:14 ` Johan Bockgård
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Brockman @ 2011-11-01 15:17 UTC (permalink / raw)
To: emacs-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: `eval-after-load' broken for symbols?
2011-11-01 15:17 `eval-after-load' broken for symbols? Daniel Brockman
@ 2011-11-07 20:14 ` Johan Bockgård
0 siblings, 0 replies; 2+ messages in thread
From: Johan Bockgård @ 2011-11-07 20:14 UTC (permalink / raw)
To: emacs-devel
Daniel Brockman <dbrockman@gmail.com> writes:
> (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.
Yes. It works correctly in Emacs 23.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-07 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 15:17 `eval-after-load' broken for symbols? Daniel Brockman
2011-11-07 20:14 ` Johan Bockgård
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.