* "variable [in .emacs] is void"
@ 2003-12-20 13:16 gebser
0 siblings, 0 replies; 17+ messages in thread
From: gebser @ 2003-12-20 13:16 UTC (permalink / raw)
When starting emacs, an error is reported in *Messages*:
Error in init file: Symbol's value as variable is void: mail-mode-map
The first place in .emacs where that variable occurs is:
(add-hook 'mail-setup-hook
'(lambda ()
(substitute-key-definition
'next-line 'mail-abbrev-next-line
mail-mode-map global-map)
(substitute-key-definition
'end-of-buffer 'mail-abbrev-end-of-buffer
mail-mode-map global-map)))
My guess is that some other code is required prior to this. After emacs
is loaded and I do "M-x mail", I can evaluate it fine (in .emacs).
Any ideas?
tnx,
ken
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.408.1071929942.868.help-gnu-emacs@gnu.org>
@ 2003-12-20 15:29 ` Tim McNamara
2003-12-20 23:58 ` gebser
2003-12-20 16:24 ` Karl Pflästerer
1 sibling, 1 reply; 17+ messages in thread
From: Tim McNamara @ 2003-12-20 15:29 UTC (permalink / raw)
gebser@speakeasy.net writes:
> When starting emacs, an error is reported in *Messages*:
>
> Error in init file: Symbol's value as variable is void:
> mail-mode-map
>
> The first place in .emacs where that variable occurs is:
>
> (add-hook 'mail-setup-hook
> '(lambda ()
> (substitute-key-definition
> 'next-line 'mail-abbrev-next-line
> mail-mode-map global-map)
> (substitute-key-definition
> 'end-of-buffer 'mail-abbrev-end-of-buffer
> mail-mode-map global-map)))
>
> My guess is that some other code is required prior to this. After
> emacs is loaded and I do "M-x mail", I can evaluate it fine (in
> .emacs).
>
> Any ideas?
Does that need to be (... mail-mode-map global-map t) or (... nil) as
the case may be?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.408.1071929942.868.help-gnu-emacs@gnu.org>
2003-12-20 15:29 ` "variable [in .emacs] is void" Tim McNamara
@ 2003-12-20 16:24 ` Karl Pflästerer
2003-12-20 22:42 ` gebser
1 sibling, 1 reply; 17+ messages in thread
From: Karl Pflästerer @ 2003-12-20 16:24 UTC (permalink / raw)
An unnamed person wrote:
> When starting emacs, an error is reported in *Messages*:
> Error in init file: Symbol's value as variable is void: mail-mode-map
`mail-mode-map' is defined in sendmail.el.
> The first place in .emacs where that variable occurs is:
[...]
> My guess is that some other code is required prior to this. After emacs
> is loaded and I do "M-x mail", I can evaluate it fine (in .emacs).
> Any ideas?
Try to wrap your code in an
(eval-after-load "sendmail"
'(substitute-key-definition ...
))
KP
--
Der wahre Weltuntergang ist die Vernichtung des Geistes, der andere hängt von
dem gleichgiltigen Versuch ab, ob nach der Vernichtung des Geistes noch eine
Welt bestehen kann.
Karl Kraus 'Untergang der Welt durch schwarze Magie'
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-20 16:24 ` Karl Pflästerer
@ 2003-12-20 22:42 ` gebser
0 siblings, 0 replies; 17+ messages in thread
From: gebser @ 2003-12-20 22:42 UTC (permalink / raw)
At 17:24 (UTC+0100) on Sat, 20 Dec 2003 Karl Pflästerer said:
= An unnamed person wrote:
=
= > When starting emacs, an error is reported in *Messages*:
=
= > Error in init file: Symbol's value as variable is void: mail-mode-map
=
= `mail-mode-map' is defined in sendmail.el.
=
= > The first place in .emacs where that variable occurs is:
=
= [...]
= > My guess is that some other code is required prior to this. After emacs
= > is loaded and I do "M-x mail", I can evaluate it fine (in .emacs).
=
= > Any ideas?
=
= Try to wrap your code in an
=
= (eval-after-load "sendmail"
= '(substitute-key-definition ...
= ))
=
Did this, but I'm still getting an error in *Messages*, albeit a
different one:
Error in init file: Symbol's value as variable is void: mail-mode-map
You're correct, though. sendmail.el is the place where it's defined:
(defvar mail-mode-map nil)
Anything else I could try?
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-20 15:29 ` "variable [in .emacs] is void" Tim McNamara
@ 2003-12-20 23:58 ` gebser
0 siblings, 0 replies; 17+ messages in thread
From: gebser @ 2003-12-20 23:58 UTC (permalink / raw)
At 09:29 (UTC-0600) on 20 Dec 2003 Tim McNamara said:
= gebser@speakeasy.net writes:
=
= > When starting emacs, an error is reported in *Messages*:
= >
= > Error in init file: Symbol's value as variable is void:
= > mail-mode-map
= >
= > The first place in .emacs where that variable occurs is:
= >
= > (add-hook 'mail-setup-hook
= > '(lambda ()
= > (substitute-key-definition
= > 'next-line 'mail-abbrev-next-line
= > mail-mode-map global-map)
= > (substitute-key-definition
= > 'end-of-buffer 'mail-abbrev-end-of-buffer
= > mail-mode-map global-map)))
= >
= > My guess is that some other code is required prior to this. After
= > emacs is loaded and I do "M-x mail", I can evaluate it fine (in
= > .emacs).
= >
= > Any ideas?
=
= Does that need to be (... mail-mode-map global-map t) or (... nil) as
= the case may be?
The notes I made in my .emacs for this item tell me that I cut-n-pasted
it from the emacs manual.... Yep, just found it in the section "Mail
Aliases". That's a naughty manual.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.415.1071963863.868.help-gnu-emacs@gnu.org>
@ 2003-12-21 17:18 ` Karl Pflästerer
2003-12-21 19:28 ` gebser
0 siblings, 1 reply; 17+ messages in thread
From: Karl Pflästerer @ 2003-12-21 17:18 UTC (permalink / raw)
An unnamed person wrote:
> At 17:24 (UTC+0100) on Sat, 20 Dec 2003 Karl Pflästerer said:
> = Try to wrap your code in an
> =
> = (eval-after-load "sendmail"
> = '(substitute-key-definition ...
> = ))
> =
> Did this, but I'm still getting an error in *Messages*, albeit a
> different one:
> Error in init file: Symbol's value as variable is void: mail-mode-map
Post the code you wrote in your .emacs (c&p).
> You're correct, though. sendmail.el is the place where it's defined:
> (defvar mail-mode-map nil)
You can find that yourself; just do: `C-h v mail-mode-map RET' (or any
other variable you're interested in).
KP
--
Männer der Wissenschaft! Man sagt ihr viele nach,
aber die meisten mit Unrecht.
Karl Kraus 'Aphorismen'
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-21 17:18 ` Karl Pflästerer
@ 2003-12-21 19:28 ` gebser
0 siblings, 0 replies; 17+ messages in thread
From: gebser @ 2003-12-21 19:28 UTC (permalink / raw)
Cc: help-gnu-emacs
At 18:18 (UTC+0100) on Sun, 21 Dec 2003 Karl Pflästerer said:
= An unnamed person wrote:
=
= > At 17:24 (UTC+0100) on Sat, 20 Dec 2003 Karl Pflästerer said:
=
= > = Try to wrap your code in an
= > =
= > = (eval-after-load "sendmail"
= > = '(substitute-key-definition ...
= > = ))
= > =
=
= > Did this, but I'm still getting an error in *Messages*, albeit a
= > different one:
=
= > Error in init file: Symbol's value as variable is void: mail-mode-map
=
= Post the code you wrote in your .emacs (c&p).
(eval-after-load "sendmail"
(add-hook 'mail-setup-hook
'(substitute-key-definition
'(lambda ()
(substitute-key-definition
'next-line 'mail-abbrev-next-line
mail-mode-map global-map)
(substitute-key-definition
'end-of-buffer 'mail-abbrev-end-of-buffer
mail-mode-map global-map)))))
=
= > You're correct, though. sendmail.el is the place where it's defined:
=
= > (defvar mail-mode-map nil)
=
= You can find that yourself; just do: `C-h v mail-mode-map RET' (or any
= other variable you're interested in).
Sometimes that works with this variable, other times it doesn't. My
almost educated guess is that it depends on whether or not I've first
opened a mail session (M-x mail).
tnx some more,
ken
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.431.1072038664.868.help-gnu-emacs@gnu.org>
@ 2003-12-21 20:07 ` Karl Pflästerer
2003-12-22 15:14 ` gebser
2003-12-22 19:27 ` Kevin Rodgers
1 sibling, 1 reply; 17+ messages in thread
From: Karl Pflästerer @ 2003-12-21 20:07 UTC (permalink / raw)
An unnamed person wrote:
> (eval-after-load "sendmail"
> (add-hook 'mail-setup-hook
^
Here is the error. You need to quote that list.
[...]
so it becomes:
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook ...
> Sometimes that works with this variable, other times it doesn't. My
> almost educated guess is that it depends on whether or not I've first
> opened a mail session (M-x mail).
Right.
KP
--
"But it has nothing to do with what a _value_ is. This has to do with
whether you pass whatever-a-value-is or wherever-whatever-is-a-value-is
whenever you pass an argument to a function. (Call it the Shakira
theory. :)" [Erik Naggum in cllisp über call-by-value und call-by-reference]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-21 20:07 ` Karl Pflästerer
@ 2003-12-22 15:14 ` gebser
0 siblings, 0 replies; 17+ messages in thread
From: gebser @ 2003-12-22 15:14 UTC (permalink / raw)
Cc: help-gnu-emacs
At 21:07 (UTC+0100) on Sun, 21 Dec 2003 Karl Pflästerer said:
= An unnamed person wrote:
=
= > (eval-after-load "sendmail"
= > (add-hook 'mail-setup-hook
= ^
=
= Here is the error. You need to quote that list.
= [...]
=
= so it becomes:
=
= (eval-after-load "sendmail"
= '(add-hook 'mail-setup-hook ...
Great. That works. Now, I have some other functions which also use
mail-mode-map. Can I wrap them in the same '(add-hook ...? Or do I
need to duplicate the lines for each? ... like this?
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map mail-foo...
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map mail-bar...
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map foo-be-do-be-do...
Even tidier and more readable, can I put all the sendmail-dependent
defines in a separate (possibly byte-compiled) file and then have
something like an "include" in my emacs evaluate them all subject to an
(eval-after-load "sendmail" ...)?
tnx++;
ken
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.471.1072109811.868.help-gnu-emacs@gnu.org>
@ 2003-12-22 16:01 ` Karl Pflästerer
2003-12-22 18:28 ` Karl Pflästerer
2003-12-23 3:11 ` gebser
0 siblings, 2 replies; 17+ messages in thread
From: Karl Pflästerer @ 2003-12-22 16:01 UTC (permalink / raw)
An unnamed person wrote:
> Great. That works. Now, I have some other functions which also use
> mail-mode-map. Can I wrap them in the same '(add-hook ...? Or do I
> need to duplicate the lines for each? ... like this?
> (eval-after-load "sendmail"
> '(add-hook 'mail-setup-hook
> '(define-key mail-mode-map mail-foo...
> (eval-after-load "sendmail"
> '(add-hook 'mail-setup-hook
> '(define-key mail-mode-map mail-bar...
> (eval-after-load "sendmail"
> '(add-hook 'mail-setup-hook
> '(define-key mail-mode-map foo-be-do-be-do...
That depends on what you want to achive; to have multiple functions in a
hook you can wrap them in a lambda form or you can add them each
separately to the hook.
So either:
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map mail-foo...))
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map mail-bar...))
'(add-hook 'mail-setup-hook
'(define-key mail-mode-map foo-be-do-be-do...)))
or:
(eval-after-load "sendmail"
'(add-hook 'mail-setup-hook
(lambda ()
(define-key mail-mode-map mail-foo...)
(define-key mail-mode-map mail-bar...)
(define-key mail-mode-map foo-be-do-be-do...))))
You needn't duplicate the `eval-after-load' macro.
> Even tidier and more readable, can I put all the sendmail-dependent
> defines in a separate (possibly byte-compiled) file and then have
> something like an "include" in my emacs evaluate them all subject to an
> (eval-after-load "sendmail" ...)?
Yes. That's the way a lot of people prefer. Like that you don't lose
the oversight over your config files.
(eval-after-load "sendmail"
(load "privhooks"))
;; privhooks.el
(add-hook 'mail-setup-hook
(lambda ()
(define-key mail-mode-map mail-foo...)
(define-key mail-mode-map mail-bar...)
(define-key mail-mode-map foo-be-do-be-do...))))
To byte-compile it you might need an
(eval-when-compile
(require 'sendmail))
in the top of your privhooks.el.
KP
--
"Lisp is worth learning for the profound enlightenment experience you
will have when you finally get it; that experience will make you a
better programmer for the rest of your days, even if you never
actually use Lisp itself a lot." -- Eric S. Raymond
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-22 16:01 ` Karl Pflästerer
@ 2003-12-22 18:28 ` Karl Pflästerer
2003-12-23 3:11 ` gebser
1 sibling, 0 replies; 17+ messages in thread
From: Karl Pflästerer @ 2003-12-22 18:28 UTC (permalink / raw)
On 22 Dec 2003, Karl Pflästerer <- sigurd@12move.de wrote:
> (eval-after-load "sendmail"
> (load "privhooks"))
Upps. I forgot the quote here myself. It must be:
(eval-after-load "sendmail"
'(load "privhooks"))
KP
--
If you have nothing to say on a subject, replying with a line such as,
"I agree with this." puts you in the TO:'s for all future messages, and
establishes you as "one who really cares", if not an actual expert, on
the topic at hand. -- from the Symbolics Guidelines for Sending Mail
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.431.1072038664.868.help-gnu-emacs@gnu.org>
2003-12-21 20:07 ` Karl Pflästerer
@ 2003-12-22 19:27 ` Kevin Rodgers
2003-12-23 0:49 ` gebser
1 sibling, 1 reply; 17+ messages in thread
From: Kevin Rodgers @ 2003-12-22 19:27 UTC (permalink / raw)
gebser@speakeasy.net wrote:
> At 18:18 (UTC+0100) on Sun, 21 Dec 2003 Karl Pflästerer said:
> = Post the code you wrote in your .emacs (c&p).
>
> (eval-after-load "sendmail"
> (add-hook 'mail-setup-hook
> '(substitute-key-definition
The above line is wrong. Get rid of it and its terminating close parenthesis.
> '(lambda ()
> (substitute-key-definition
> 'next-line 'mail-abbrev-next-line
> mail-mode-map global-map)
> (substitute-key-definition
> 'end-of-buffer 'mail-abbrev-end-of-buffer
> mail-mode-map global-map)))))
>
I still don't understand why that hook function can't be added until after
sendmail.el is loaded, though. The hook variable is quoted, as is the function
(twice actually: once by lambda, and once unnecessarily by the quote character).
> = You can find that yourself; just do: `C-h v mail-mode-map RET' (or any
> = other variable you're interested in).
>
> Sometimes that works with this variable, other times it doesn't. My
> almost educated guess is that it depends on whether or not I've first
> opened a mail session (M-x mail).
The variable is defined in sendmail.el, which is not dumped into the
emacs executable. Nor is the variable marked with an autoload cookie,
which would have gotten it included in loaddefs.el and dumped into the
executable. So it is not defined until sendmail.el is loaded, which
happens when one of its autoloaded functions is called, e.g. the mail
command.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-22 19:27 ` Kevin Rodgers
@ 2003-12-23 0:49 ` gebser
0 siblings, 0 replies; 17+ messages in thread
From: gebser @ 2003-12-23 0:49 UTC (permalink / raw)
Cc: help-gnu-emacs
At 12:27 (UTC-0700) on Mon, 22 Dec 2003 Kevin Rodgers said:
= gebser@speakeasy.net wrote:
=
= > At 18:18 (UTC+0100) on Sun, 21 Dec 2003 Karl Pflästerer said:
= > = Post the code you wrote in your .emacs (c&p).
= >
= > (eval-after-load "sendmail"
= > (add-hook 'mail-setup-hook
= > '(substitute-key-definition
=
=
= The above line is wrong. Get rid of it and its terminating close parenthesis.
Sorry, I don't understand what you mean here.
=
=
= > '(lambda ()
= > (substitute-key-definition
= > 'next-line 'mail-abbrev-next-line
= > mail-mode-map global-map)
= > (substitute-key-definition
= > 'end-of-buffer 'mail-abbrev-end-of-buffer
= > mail-mode-map global-map)))))
= >
= ...
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-22 16:01 ` Karl Pflästerer
2003-12-22 18:28 ` Karl Pflästerer
@ 2003-12-23 3:11 ` gebser
1 sibling, 0 replies; 17+ messages in thread
From: gebser @ 2003-12-23 3:11 UTC (permalink / raw)
At 17:01 (UTC+0100) on Mon, 22 Dec 2003 Karl Pflästerer said:
= An unnamed person wrote:
=
= ...
=
= You needn't duplicate the `eval-after-load' macro.
=
= > Even tidier and more readable, can I put all the sendmail-dependent
= > defines in a separate (possibly byte-compiled) file and then have
= > something like an "include" in my emacs evaluate them all subject to an
= > (eval-after-load "sendmail" ...)?
=
= Yes. That's the way a lot of people prefer. Like that you don't lose
= the oversight over your config files.
=
; first-try... didn't work
= (eval-after-load "sendmail"
= (load "privhooks"))
For some reason this first try didn't work. But specifying the entire
name and path did-- ungefaehr:
;second-try... worked
(eval-after-load "sendmail"
(load "~/privhooks.el"))
The "load" function, according to the docs, searches the loadpath, not
my home directory. So that part of the failure is understandable.
Then I thought that in the event I later compile privhooks.el, I want
the normal emacs behavior: first look for an *.elc and if that's not
found, then use the *.el. So I tried:
;third-try... didn't work
(eval-after-load "sendmail"
(load "~/privhooks"))
But this didn't work either. So I went back to the full filespec. But
being the fastidious sort, I'd like to make "~/privhooks" work.
The "load" doc says (in part):
(load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)
If optional fourth arg NOSUFFIX is non-nil, don't try adding
suffixes `.elc' or `.el' to the specified name FILE.
If optional fifth arg MUST-SUFFIX is non-nil, insist on
the suffix `.elc' or `.el'; don't accept just FILE unless
it ends in one of those suffixes or includes a directory name.
I would think that load's default behavior would make third-try
workable. But testing shows this isn't the case. So then I must
specify the arg to accomplish this-- I'm guessing something like this:
;fourth try, guessing syntax for five args: all Messaging on.
(eval-after-load "sendmail"
'(load "~/privhooks" nil nil nil t))
Nope. The world still sucks. But hang on... dance around the cauldron
one more time... toss in that eye of newt.
;fifth try, guessing syntax again. Works!
(eval-after-load "sendmail"
(load "~/privhooks" nil nil nil t))
Note the lack of a quote beginning the second line.
Two other things tell me this works, two lines which appear in
*Messages*:
Loading ~/.privhooks (source)...
Error in init file: Symbol's value as variable is void: mail-mode-map
The first line appears approximately whenever the syntax has been
without the quote. (And actually I tried a lot more than what I've
written here.) The second line confirms that the file is being loaded
because "mail-mode-map" only occurs in this file. (Now to figure out
why that part isn't working... again.)
So it's all good now... well, almost all of it. Thanks very much to
Kevin and especially Karl for advancing the emacs movement.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.498.1072144317.868.help-gnu-emacs@gnu.org>
@ 2003-12-23 17:27 ` Kevin Rodgers
0 siblings, 0 replies; 17+ messages in thread
From: Kevin Rodgers @ 2003-12-23 17:27 UTC (permalink / raw)
gebser@speakeasy.net wrote:
> At 12:27 (UTC-0700) on Mon, 22 Dec 2003 Kevin Rodgers said:
>
> = gebser@speakeasy.net wrote:
> =
> = > At 18:18 (UTC+0100) on Sun, 21 Dec 2003 Karl Pflästerer said:
> = > = Post the code you wrote in your .emacs (c&p).
> = >
> = > (eval-after-load "sendmail"
> = > (add-hook 'mail-setup-hook
> = > '(substitute-key-definition
> =
> =
> = The above line is wrong. Get rid of it and its terminating close parenthesis.
>
> Sorry, I don't understand what you mean here.
I can't say it any simpler: Delete that line, because it is wrong. That line
contains an open parenthesis, so you must also delete the corresponding close
parenthesis that occurs several lines later.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
[not found] <mailman.501.1072152815.868.help-gnu-emacs@gnu.org>
@ 2003-12-23 17:39 ` Kevin Rodgers
2004-01-02 14:53 ` gebser
0 siblings, 1 reply; 17+ messages in thread
From: Kevin Rodgers @ 2003-12-23 17:39 UTC (permalink / raw)
gebser@speakeasy.net wrote:
> ; first-try... didn't work
> = (eval-after-load "sendmail"
> = (load "privhooks"))
>
> For some reason this first try didn't work. But specifying the entire
> name and path did-- ungefaehr:
>
> ;second-try... worked
> (eval-after-load "sendmail"
> (load "~/privhooks.el"))
>
> The "load" function, according to the docs, searches the loadpath, not
> my home directory. So that part of the failure is understandable.
> Then I thought that in the event I later compile privhooks.el, I want
> the normal emacs behavior: first look for an *.elc and if that's not
> found, then use the *.el. So I tried:
>
> ;third-try... didn't work
> (eval-after-load "sendmail"
> (load "~/privhooks"))
>
> But this didn't work either. So I went back to the full filespec. But
> being the fastidious sort, I'd like to make "~/privhooks" work.
>
> The "load" doc says (in part):
>
> (load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX)
>
> If optional fourth arg NOSUFFIX is non-nil, don't try adding
> suffixes `.elc' or `.el' to the specified name FILE.
> If optional fifth arg MUST-SUFFIX is non-nil, insist on
> the suffix `.elc' or `.el'; don't accept just FILE unless
> it ends in one of those suffixes or includes a directory name.
>
> I would think that load's default behavior would make third-try
> workable. But testing shows this isn't the case. So then I must
> specify the arg to accomplish this-- I'm guessing something like this:
>
> ;fourth try, guessing syntax for five args: all Messaging on.
> (eval-after-load "sendmail"
> '(load "~/privhooks" nil nil nil t))
It would be a lot easier to add your home directory to load-path, and then
call (load-library "privhooks").
> Nope. The world still sucks. But hang on... dance around the cauldron
> one more time... toss in that eye of newt.
>
> ;fifth try, guessing syntax again. Works!
> (eval-after-load "sendmail"
> (load "~/privhooks" nil nil nil t))
>
> Note the lack of a quote beginning the second line.
That does not do what you want it to. You want your privhooks.el[c]
file to be automatically loaded after the sendmail library is loaded.
But by removing the quote, the form is evaluated immediately (i.e. when
.emacs is loaded, which is when emacs is invoked) rather than later.
The load form returns t (assuming your privhooks.el[c] file is found and
has no errors); so when the sendmail library is loaded, t is evaluated
(trivially returning t, with no side effects).
> Two other things tell me this works, two lines which appear in
> *Messages*:
>
> Loading ~/.privhooks (source)...
> Error in init file: Symbol's value as variable is void: mail-mode-map
>
> The first line appears approximately whenever the syntax has been
> without the quote. (And actually I tried a lot more than what I've
> written here.) The second line confirms that the file is being loaded
> because "mail-mode-map" only occurs in this file. (Now to figure out
> why that part isn't working... again.)
The first message is due to the fact that loading your .emacs file causes
your privhooks.el[c] file to be loaded, as explained above. The second
message is due to the fact your privhooks.el file references mail-mode-map
in a form that is evaluated when the file is loaded, rather than when the
hook function defined in the file is actually run.
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: "variable [in .emacs] is void"
2003-12-23 17:39 ` Kevin Rodgers
@ 2004-01-02 14:53 ` gebser
0 siblings, 0 replies; 17+ messages in thread
From: gebser @ 2004-01-02 14:53 UTC (permalink / raw)
Cc: help-gnu-emacs
At 10:39 (UTC-0700) on Tue, 23 Dec 2003 Kevin Rodgers said:
= gebser@speakeasy.net wrote:
=
= > ...
= >
= > ;fourth try, guessing syntax for five args: all Messaging on.
= > (eval-after-load "sendmail"
= > '(load "~/privhooks" nil nil nil t))
=
=
= It would be a lot easier to add your home directory to load-path, and then
= call (load-library "privhooks").
Understood. But at some time in future I could (unthinkingly) throw a
.el file into $HOME and probably get undesirable results. Ultimately
I'm going to move privhooks.el out of $HOME, probably to some site-lisp
that's already in load-path.
= >
= > ;fifth try, guessing syntax again. Works!
= > (eval-after-load "sendmail"
= > (load "~/privhooks" nil nil nil t))
= >
= > Note the lack of a quote beginning the second line.
=
=
= That does not do what you want it to. You want your privhooks.el[c]
= file to be automatically loaded after the sendmail library is loaded.
= But by removing the quote, the form is evaluated immediately (i.e. when
= .emacs is loaded, which is when emacs is invoked) rather than later.
= The load form returns t (assuming your privhooks.el[c] file is found and
= has no errors); so when the sendmail library is loaded, t is evaluated
= (trivially returning t, with no side effects).
Okay, I see what you're saying now. You're right.
=
=
= > Two other things tell me this works, two lines which appear in
= > *Messages*:
= >
= > Loading ~/.privhooks (source)...
= > Error in init file: Symbol's value as variable is void: mail-mode-map
= >
= > The first line appears approximately whenever the syntax has been
= > without the quote. (And actually I tried a lot more than what I've
= > written here.) The second line confirms that the file is being loaded
= > because "mail-mode-map" only occurs in this file. (Now to figure out
= > why that part isn't working... again.)
=
= The first message is due to the fact that loading your .emacs file causes
= your privhooks.el[c] file to be loaded, as explained above. The second
= message is due to the fact your privhooks.el file references mail-mode-map
= in a form that is evaluated when the file is loaded, rather than when the
= hook function defined in the file is actually run.
Yeah, okay, I put the quote back in and (now that I see how things are
supposed to work) it's working fine.
Kevin, thanks very much. There ought to be a medal for guys like you.
ken
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2004-01-02 14:53 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.408.1071929942.868.help-gnu-emacs@gnu.org>
2003-12-20 15:29 ` "variable [in .emacs] is void" Tim McNamara
2003-12-20 23:58 ` gebser
2003-12-20 16:24 ` Karl Pflästerer
2003-12-20 22:42 ` gebser
[not found] <mailman.501.1072152815.868.help-gnu-emacs@gnu.org>
2003-12-23 17:39 ` Kevin Rodgers
2004-01-02 14:53 ` gebser
[not found] <mailman.498.1072144317.868.help-gnu-emacs@gnu.org>
2003-12-23 17:27 ` Kevin Rodgers
[not found] <mailman.471.1072109811.868.help-gnu-emacs@gnu.org>
2003-12-22 16:01 ` Karl Pflästerer
2003-12-22 18:28 ` Karl Pflästerer
2003-12-23 3:11 ` gebser
[not found] <mailman.431.1072038664.868.help-gnu-emacs@gnu.org>
2003-12-21 20:07 ` Karl Pflästerer
2003-12-22 15:14 ` gebser
2003-12-22 19:27 ` Kevin Rodgers
2003-12-23 0:49 ` gebser
[not found] <mailman.415.1071963863.868.help-gnu-emacs@gnu.org>
2003-12-21 17:18 ` Karl Pflästerer
2003-12-21 19:28 ` gebser
2003-12-20 13:16 gebser
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).