help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "variable [in .emacs] is void"


From: gebser
Subject: Re: "variable [in .emacs] is void"
Date: Fri, 2 Jan 2004 09:53:11 -0500 (EST)

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]