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

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

bug#52178: 29.0.50; process-environment not used in async-shell-command


From: Damien Merenne
Subject: bug#52178: 29.0.50; process-environment not used in async-shell-command
Date: Sun, 16 Jan 2022 10:49:18 +0000

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.





reply via email to

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