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

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

Re: eval-after-load causes void-variable error


From: Barry Margolin
Subject: Re: eval-after-load causes void-variable error
Date: Thu, 17 Jan 2013 19:07:00 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <bp8ip6vs6xk.fsf@usca1uw-JZWWPM1.sanmateo.corp.akamai.com>,
 Sean McAfee <eefacm@gmail.com> wrote:

> For a long time I had this in my .emacs file:
> 
> (require 'ffap)
> (add-to-list 'ffap-alist (cons +my-ffap-regexp+ #'my-ffap-hook))
> 
> I recently decided to optimize it a bit and changed it to:
> 
> (eval-after-load 'ffap
>   '(add-to-list 'ffap-alist (cons +my-ffap-regexp+ #'my-ffap-hook)))
> 
> Now, however, as soon as the ffap command is activated, I get an error:
> 
> Lisp error: (void-variable ffap-alist)
> 
> Somehow, using eval-after-load is causing the variable ffap-alist to be
> unbound, or not bound in the first place.  Does anyone have any idea
> what's going on?

When you use a feature name rather than a filename (i.e. a symbol rather 
than a string) in eval-after-load, it evals as soon as the feature is 
provided, not after the file is loaded. ffap.el contains

(provide 'ffap)

at the beginning of the file, so your expression gets evaluated before 
ffap-alist has been initialized. It really should be at the end, since 
the feature doesn't really exist until the whole file is loaded.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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