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: Mon, 22 Dec 2003 22:11:32 -0500 (EST) Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: Reply-To: gebser@speakeasy.net NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT X-Trace: sea.gmane.org 1072149150 3490 80.91.224.253 (23 Dec 2003 03:12:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 Dec 2003 03:12:30 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 23 04:12:25 2003 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 1AYcy8-0003Mc-00 for ; Tue, 23 Dec 2003 04:12:24 +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 1AYdva-0007JN-NA for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Dec 2003 23:13:50 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AYdvJ-0007JB-10 for help-gnu-emacs@gnu.org; Mon, 22 Dec 2003 23:13:33 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AYdun-0006yR-7G for help-gnu-emacs@gnu.org; Mon, 22 Dec 2003 23:13:32 -0500 Original-Received: from [216.254.0.204] (helo=mail4.speakeasy.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AYdum-0006yM-Sn for help-gnu-emacs@gnu.org; Mon, 22 Dec 2003 23:13:00 -0500 Original-Received: (qmail 9688 invoked from network); 23 Dec 2003 03:11:32 -0000 Original-Received: from dsl093-011-017.cle1.dsl.speakeasy.net (HELO heidegger.mousecar.net) ([66.93.11.17]) (envelope-sender ) by mail4.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 23 Dec 2003 03:11:32 -0000 Original-To: help-gnu-emacs@gnu.org In-Reply-To: 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:15526 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15526 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.