From: Damien Merenne <dam@cosinux.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 52178@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#52178: 29.0.50; process-environment not used in async-shell-command
Date: Sun, 16 Jan 2022 10:49:18 +0000 [thread overview]
Message-ID: <CAAgrLvhbNBQoJC6f9pH_bFkJTOGV7A881kB-R7uFv3vMPUZU_Q@mail.gmail.com> (raw)
In-Reply-To: <87bl0c65ld.fsf@web.de>
Thanks for the reminder and the pointer to the watcher! I finally
found that it happens due to the `envrc` package.
That package is meant to set `process-environment` buffer local for
some buffers. Somehow it sets
process-environment globally local but only when emacs is started as a
daemon from the systemd unit. Running
it normally or with --fg-daemon from a terminal does not set the
variable globally local. I'll check with the envrc
maintainer why that would be but there is still something strange
going on, I would not expect Emacs behaviour to
change when started in systemd.
For people stumbling upon this, here is the code I used to pinpoint the problem:
```
(defvar pltraces (list (cons "early-init.el" (local-variable-p
'process-environment))))
(add-hook 'after-load-functions
(lambda (fn)
(setq pltraces (cons (cons fn (local-variable-p
'process-environment)) pltraces))))
(add-variable-watcher 'process-environment
(lambda (symbol newval operation where)
(when where
(setq pltraces (cons (cons (buffer-name
where) (local-variable-p 'process-environment)) pltraces)))))
```
It records the place where the variable is set and its local status in
the `pltraces` variable.
--
Damien MERENNE <dam@cosinux.org>
Le sam. 15 janv. 2022 à 21:39, Michael Heerdegen
<michael_heerdegen@web.de> a écrit :
>
> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
> > Damien Merenne <dam@cosinux.org> writes:
> >
> > > I'll try to find what's triggering it but its not obvious.
> >
> > Did you make any progress here?
>
> Damien, maybe using a variable watcher:
>
> (info "(elisp) Watching Variables")
>
> could help to understand what's going on? They are able to notice
> changes in buffer-localness.
>
> Michael.
next prev parent reply other threads:[~2022-01-16 10:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 12:33 bug#52178: 29.0.50; process-environment not used in async-shell-command Damien Merenne
2021-11-29 14:38 ` Lars Ingebrigtsen
2021-11-29 20:34 ` Damien Merenne
2022-01-15 13:07 ` Lars Ingebrigtsen
2022-01-15 21:39 ` Michael Heerdegen
2022-01-16 10:49 ` Damien Merenne [this message]
2022-01-16 10:51 ` Damien Merenne
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=CAAgrLvhbNBQoJC6f9pH_bFkJTOGV7A881kB-R7uFv3vMPUZU_Q@mail.gmail.com \
--to=dam@cosinux.org \
--cc=52178@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=michael_heerdegen@web.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).