From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: "variable [in .emacs] is void"
Date: Tue, 23 Dec 2003 10:39:37 -0700 [thread overview]
Message-ID: <3FE87DD9.2070508@yahoo.com> (raw)
In-Reply-To: mailman.501.1072152815.868.help-gnu-emacs@gnu.org
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
next parent reply other threads:[~2003-12-23 17:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.501.1072152815.868.help-gnu-emacs@gnu.org>
2003-12-23 17:39 ` Kevin Rodgers [this message]
2004-01-02 14:53 ` "variable [in .emacs] is void" gebser
[not found] <mailman.498.1072144317.868.help-gnu-emacs@gnu.org>
2003-12-23 17:27 ` Kevin Rodgers
[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.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.415.1071963863.868.help-gnu-emacs@gnu.org>
2003-12-21 17:18 ` Karl Pflästerer
2003-12-21 19:28 ` gebser
[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
2003-12-20 22:42 ` gebser
2003-12-20 13:16 gebser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FE87DD9.2070508@yahoo.com \
--to=ihs_4664@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).