From: Reuben Thomas <rrt@sc3d.org>
To: 17051@debbugs.gnu.org
Subject: bug#17051: Order of evaluation in .dir-locals.el
Date: Thu, 20 Mar 2014 15:01:12 +0000 [thread overview]
Message-ID: <CAOnWdogi4gQtDAY5imOsS1tHyhvsO5niztG687LyD2hwh4xMKw@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]
I have the following .dir-locals.el for a project:
((nil . ((show-trailing-whitespace . nil)
(eval . (c-add-style "fontforge"
'("stroustrup"
(indent-tabs-mode . t)
(tab-width . 8)
(c-offsets-alist
(case-label . *)))))))
(c-mode . ((c-file-style . "fontforge"))))
The idea is to define a new c-style and apply it to all files in that
project.
When I first visit a file under that project, I get the error: "Undefined
style: fontforge"
When I examine c-style-alist, "fontforge" is the first entry, and when I
look at c-file-style for that buffer, its value is "fontforge". However, as
the error implies, the style has not been applied to that buffer: if I
check the value of indent-tabs-mode, which I have configured globally to
"nil", it is still nil.
If I then run M-x c-set-style RET fontforge RET, the style is applied as
expected.
Hence, it appears my error has to do with the order of evaluation. I tried
putting the "eval" sexp under the "c-mode" section of the .dir-locals.el,
but that still gives the same error, even when I put it before the
c-file-style sexp.
I can't find anything about this in the manual, or online (i.e. examples
where the result of an "eval" entry are relied on by another entry). In
hack-local-variables-apply files.el I found this bit of code:
;; Any 'evals must run in the Right sequence.
(setq file-local-variables-alist
(nreverse file-local-variables-alist))
so I tried putting the "eval" part at the end of c-mode's list, but that
didn't help either. (I checked file-local-variables-alist in each case to
make sure that in one the eval was before c-file-style, and in the other,
after).
Can someone please set me straight?
--
http://rrt.sc3d.org
[-- Attachment #2: Type: text/html, Size: 2328 bytes --]
next reply other threads:[~2014-03-20 15:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 15:01 Reuben Thomas [this message]
2016-06-04 22:02 ` bug#17051: Order of evaluation in .dir-locals.el Noam Postavsky
2016-06-05 19:38 ` Reuben Thomas
2016-06-07 0:41 ` Noam Postavsky
2016-06-07 11:23 ` Alan Mackenzie
[not found] ` <20160607112313.GA3681@acm.fritz.box>
2016-06-07 12:53 ` Reuben Thomas
2021-12-04 3:19 ` Lars Ingebrigtsen
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=CAOnWdogi4gQtDAY5imOsS1tHyhvsO5niztG687LyD2hwh4xMKw@mail.gmail.com \
--to=rrt@sc3d.org \
--cc=17051@debbugs.gnu.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).