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

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

Re: Interesting problem: eval-after-load and local variables


From: Michael Heerdegen
Subject: Re: Interesting problem: eval-after-load and local variables
Date: Tue, 16 Oct 2012 19:54:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Hello,

I think you need to use `setq-default' instead of `setq' - see the
manual for details.  So, that should work:

(eval-after-load "time-stamp"
  ;; format of the string inserted by `M-x time-stamp'
  '(setq-default time-stamp-format "%:y-%02m-%02d %3a %02H:%02M %u"))


Michael.


"Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com> writes:

> Hello,
>
> In order to speed up my Emacs startup, I've put many customizations in
> eval-after-load's, such as:
>
>   (eval-after-load "time-stamp"
>     '(progn
>        ;; format of the string inserted by `M-x time-stamp'
>        (setq time-stamp-format "%:y-%02m-%02d %3a %02H:%02M %u")))
>
> in order to avoid the require itself in the .emacs file.
>
> Now, this causes a problem, as my local variable customizations aren't
> respected anymore.
>
> For example, I have the following local vars in my file `common.sty'
> to set up
> the format of the time-stamp (à la LaTeX):
>
> %% common.sty -- LaTeX common commands and environments
>
> \NeedsTeXFormat{LaTeX2e}
> \ProvidesPackage{common}[2012/10/15 v1.0 Common stuff between documents and 
> presentations]
>
> % ...
>
> %% End of package
> \endinput % very last line
>
> % Local Variables:
> % time-stamp-format: "%:y/%02m/%02d"
> % time-stamp-start: "Provides\\(Class\\|Package\\){[a-zA-Z-]+}\\["
> % time-stamp-end: " "
> % End:
>
> The problem is the following:
>
> - Upon opening the file, Emacs sees it needs to load time-stamp.
>
> - It does it (via the predefined autoloads), but the eval-after-load
> overrides
>   the local variables' value.
>
> - When saving the file, the time-stamp format provided in local vars is NOT
>   applied.
>
> In a way, that's perfectly normal. In another, not at all: I would
> expect the
> local vars to win over the wide values, in any configuration (even if
> my setq
> were in an eval-after-load construct).
>
> What do you think?
>
> Best regards,
>   Seb



reply via email to

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