* eval-after-load confusion
@ 2014-04-30 8:36 Eric Abrahamsen
2014-04-30 9:18 ` Nicolas Richard
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2014-04-30 8:36 UTC (permalink / raw)
To: help-gnu-emacs
I have the following in a library that is required at startup:
;; (eval-after-load 'message
;; (let ((ign-headers-list
;; (split-string message-ignored-mail-headers
;; "|"))
;; (our-val (concat gnorb-mail-header "\\")))
;; (unless (member our-val ign-headers-list)
;; (setq ign-headers-list
;; `(,@(butlast ign-headers-list 1) ,our-val
;; ,@(last ign-headers-list 1)))
;; (setq message-ignored-mail-headers
;; (mapconcat
;; 'identity ign-headers-list "|")))))
If I leave this block uncommented, I get a "void variable" error on
startup, referencing 'message-ignored-mail-headers.
I thought the whole point of `eval-after-load' was to avoid this: the
block should only be run *after* message.el is loaded, and
'message-ignored-mail-headers is defined. I've also tried with "message"
as a string, though that shouldn't matter.
Is it because it's referenced inside a `let' form? What am I not
understanding?!
emacs-version -> "24.3.1"
Thanks,
Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: eval-after-load confusion
2014-04-30 8:36 eval-after-load confusion Eric Abrahamsen
@ 2014-04-30 9:18 ` Nicolas Richard
2014-04-30 9:28 ` Eric Abrahamsen
2014-04-30 9:36 ` Thien-Thi Nguyen
2014-04-30 12:28 ` Stefan Monnier
2 siblings, 1 reply; 7+ messages in thread
From: Nicolas Richard @ 2014-04-30 9:18 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: help-gnu-emacs
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> ;; (eval-after-load 'message
> ;; (let ((ign-headers-list
> ;; (split-string message-ignored-mail-headers
> ;; "|"))
> ;; (our-val (concat gnorb-mail-header "\\")))
> ;; (unless (member our-val ign-headers-list)
> ;; (setq ign-headers-list
> ;; `(,@(butlast ign-headers-list 1) ,our-val
> ;; ,@(last ign-headers-list 1)))
> ;; (setq message-ignored-mail-headers
> ;; (mapconcat
> ;; 'identity ign-headers-list "|")))))
>
> If I leave this block uncommented, I get a "void variable" error on
> startup, referencing 'message-ignored-mail-headers.
eval-after-load is a (normal) function, which means that each of its
argument is evaluated first, then eval-after-load is called with those
values. Adding a single quote before the (let ...) form should help.
--
Nico.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: eval-after-load confusion
2014-04-30 9:18 ` Nicolas Richard
@ 2014-04-30 9:28 ` Eric Abrahamsen
0 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2014-04-30 9:28 UTC (permalink / raw)
To: help-gnu-emacs
Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>> ;; (eval-after-load 'message
>> ;; (let ((ign-headers-list
>> ;; (split-string message-ignored-mail-headers
>> ;; "|"))
>> ;; (our-val (concat gnorb-mail-header "\\")))
>> ;; (unless (member our-val ign-headers-list)
>> ;; (setq ign-headers-list
>> ;; `(,@(butlast ign-headers-list 1) ,our-val
>> ;; ,@(last ign-headers-list 1)))
>> ;; (setq message-ignored-mail-headers
>> ;; (mapconcat
>> ;; 'identity ign-headers-list "|")))))
>>
>> If I leave this block uncommented, I get a "void variable" error on
>> startup, referencing 'message-ignored-mail-headers.
>
> eval-after-load is a (normal) function, which means that each of its
> argument is evaluated first, then eval-after-load is called with those
> values. Adding a single quote before the (let ...) form should help.
Gah, I knew it was something stupid, thank you. And apologies for
wasting the internet...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: eval-after-load confusion
2014-04-30 8:36 eval-after-load confusion Eric Abrahamsen
2014-04-30 9:18 ` Nicolas Richard
@ 2014-04-30 9:36 ` Thien-Thi Nguyen
2014-04-30 9:41 ` Eric Abrahamsen
2014-04-30 12:28 ` Stefan Monnier
2 siblings, 1 reply; 7+ messages in thread
From: Thien-Thi Nguyen @ 2014-04-30 9:36 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1446 bytes --]
() Eric Abrahamsen <eric@ericabrahamsen.net>
() Wed, 30 Apr 2014 16:36:50 +0800
;; (eval-after-load 'message
;; (let ...)
What am I not understanding?!
If you ‘C-h f eval-after-load’, you will see the template:
(eval-after-load FILE FORM)
and can match symbol ‘eval-after-load’ to the first element
of the same name, the expression
'message
to the second element FILE, and the expression
(let ...)
to the third element FORM. So order seems to be correct. No easy
answers in this life! Trundle on! Next step, do the "types" match?
The first element is for dispatch so we ignore it. The second one,
FILE, seems to be correct per this fragment:
Alternatively, FILE can be a feature (i.e. a symbol),
and the expression does indeed evaluate to a symbol, i.e.,
(quote SYMBOL) => SYMBOL
That leaves the third element, FORM. It appears the ‘(let ...)’ does
not evaluate to a proper FORM. Hmm...
"But ttn, why all this "evaluate to" noise? Why didn't you just say
that ‘(quote message)’ *is* a symbol? Same for "does not evaluate to"
for the third arg! What, are you getting old and crufty?!"
Well, yes! Everything has its time.
--
Thien-Thi Nguyen
GPG key: 4C807502
(if you're human and you know it)
read my lisp: (responsep (questions 'technical)
(not (via 'mailing-list)))
=> nil
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: eval-after-load confusion
2014-04-30 9:36 ` Thien-Thi Nguyen
@ 2014-04-30 9:41 ` Eric Abrahamsen
0 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2014-04-30 9:41 UTC (permalink / raw)
To: help-gnu-emacs
Thien-Thi Nguyen <ttn@gnu.org> writes:
> () Eric Abrahamsen <eric@ericabrahamsen.net>
> () Wed, 30 Apr 2014 16:36:50 +0800
>
> ;; (eval-after-load 'message
> ;; (let ...)
>
> What am I not understanding?!
>
> If you ‘C-h f eval-after-load’, you will see the template:
>
> (eval-after-load FILE FORM)
>
> and can match symbol ‘eval-after-load’ to the first element
> of the same name, the expression
>
> 'message
>
> to the second element FILE, and the expression
>
> (let ...)
>
> to the third element FORM. So order seems to be correct. No easy
> answers in this life! Trundle on! Next step, do the "types" match?
> The first element is for dispatch so we ignore it. The second one,
> FILE, seems to be correct per this fragment:
>
> Alternatively, FILE can be a feature (i.e. a symbol),
>
> and the expression does indeed evaluate to a symbol, i.e.,
>
> (quote SYMBOL) => SYMBOL
>
> That leaves the third element, FORM. It appears the ‘(let ...)’ does
> not evaluate to a proper FORM. Hmm...
>
> "But ttn, why all this "evaluate to" noise? Why didn't you just say
> that ‘(quote message)’ *is* a symbol? Same for "does not evaluate to"
> for the third arg! What, are you getting old and crufty?!"
>
> Well, yes! Everything has its time.
If a fellow's got to be schooled (in something he already should have
known), one might hope for worse than to be schooled by Thien-Thi
Nguyen. If only the question had been more worthy of the answer!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: eval-after-load confusion
2014-04-30 8:36 eval-after-load confusion Eric Abrahamsen
2014-04-30 9:18 ` Nicolas Richard
2014-04-30 9:36 ` Thien-Thi Nguyen
@ 2014-04-30 12:28 ` Stefan Monnier
2014-05-02 5:28 ` Eric Abrahamsen
2 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2014-04-30 12:28 UTC (permalink / raw)
To: help-gnu-emacs
> I thought the whole point of `eval-after-load' was to avoid this: the
In 24.4, we have finally introduced the with-eval-after-load macro,
which works the way you expected eval-after-load to work.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-05-02 5:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-30 8:36 eval-after-load confusion Eric Abrahamsen
2014-04-30 9:18 ` Nicolas Richard
2014-04-30 9:28 ` Eric Abrahamsen
2014-04-30 9:36 ` Thien-Thi Nguyen
2014-04-30 9:41 ` Eric Abrahamsen
2014-04-30 12:28 ` Stefan Monnier
2014-05-02 5:28 ` Eric Abrahamsen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).