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: Mon, 22 Dec 2003 22:11:32 -0500 (EST)

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.








reply via email to

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