From: Noam Postavsky <npostavs@gmail.com>
To: Luis Gerhorst <privat@luisgerhorst.de>
Cc: 32129@debbugs.gnu.org
Subject: bug#32129: 26.1; Bug in add-dir-local-variable when used with eval, progn and setenv
Date: Wed, 11 Jul 2018 19:20:27 -0400 [thread overview]
Message-ID: <87a7qxbbr8.fsf@gmail.com> (raw)
In-Reply-To: <m2zhyx2wyi.fsf@luis-imac.fritz.box> (Luis Gerhorst's message of "Thu, 12 Jul 2018 01:07:17 +0200")
Luis Gerhorst <privat@luisgerhorst.de> writes:
> (1) Open Emacs with emacs -Q
> (2) Type the following code into *scratch*
>
> (add-dir-local-variable
> 'c-mode
> 'eval
> '(progn (make-local-variable 'process-environment)
> (setq process-environment (copy-sequence process-environment))
> (setenv "TEST" "hello")))
>
> (3) M-x eval-buffer
>
> Expected .dir-locals.el contents:
> ((c-mode (eval . (progn (make-local-variable 'process-environment)
> (setq process-environment (copy-sequence process-environment))
> (setenv "TEST" "hello")))))
>
> Actual contents:
> ((c-mode (eval progn (make-local-variable 'process-environment)
> (setq process-environment (copy-sequence process-environment))
> (setenv "TEST" "hello"))))
>
> When I open a C file and inspect process-environment, TEST is not set.
>
> When I manually create a .dir-locals.el with the expected contents, it
> works.
When I manually create a .dir-locals.el with the actual contents it
works too.
> Please correct me if I'm using add-dir-local-variable wrong, I was not
> able to find a version that works as expected with the above
> progn. Strangely, if I use (progn (message "hello")), instead of the
> progn with setenv, "hello" gets printed every time I open a C file.
I think add-dir-local-variable is fine, both the expected and actual
values you posted are the same (the expected one just happens to use
dotted pair notation).
Maybe the problem is that you need to use
(setq-local process-environment ...)
Otherwise your eval clause sets the global value (which is possibly
being clobbered by other things in your config?).
prev parent reply other threads:[~2018-07-11 23:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 23:07 bug#32129: 26.1; Bug in add-dir-local-variable when used with eval, progn and setenv Luis Gerhorst
2018-07-11 23:18 ` Luis Gerhorst
2018-07-13 9:26 ` Noam Postavsky
2018-07-11 23:20 ` Noam Postavsky [this message]
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=87a7qxbbr8.fsf@gmail.com \
--to=npostavs@gmail.com \
--cc=32129@debbugs.gnu.org \
--cc=privat@luisgerhorst.de \
/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).