From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: gebser@speakeasy.net Newsgroups: gmane.emacs.help Subject: Re: "variable [in .emacs] is void" Date: Fri, 2 Jan 2004 09:53:11 -0500 (EST) Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <3FE87DD9.2070508@yahoo.com> Reply-To: gebser@speakeasy.net NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1073056010 11952 80.91.224.253 (2 Jan 2004 15:06:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 2 Jan 2004 15:06:50 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 02 16:06:44 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AcQsu-0003Ev-00 for ; Fri, 02 Jan 2004 16:06:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AcRma-0001wf-D1 for geh-help-gnu-emacs@m.gmane.org; Fri, 02 Jan 2004 11:04:16 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AcRm6-0001uE-GS for help-gnu-emacs@gnu.org; Fri, 02 Jan 2004 11:03:46 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AcRlP-0001p7-Om for help-gnu-emacs@gnu.org; Fri, 02 Jan 2004 11:03:34 -0500 Original-Received: from [216.254.0.202] (helo=mail2.speakeasy.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AcRdQ-0000UT-0V for help-gnu-emacs@gnu.org; Fri, 02 Jan 2004 10:54:48 -0500 Original-Received: (qmail 29873 invoked from network); 2 Jan 2004 14:53:12 -0000 Original-Received: from dsl093-011-017.cle1.dsl.speakeasy.net (HELO heidegger.mousecar.net) ([66.93.11.17]) (envelope-sender ) by mail2.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 2 Jan 2004 14:53:12 -0000 Original-To: Kevin Rodgers In-Reply-To: <3FE87DD9.2070508@yahoo.com> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:15661 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15661 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