On Sun, 1 Nov 2026, Jonas Bernoulli wrote:
> Zach Jibben <[email protected]> writes: > >> I added it to my init after my use-package magit setup. Is that the >> right place? > > This won't work because it is a macro. If a file that uses the macro > was compiled while the old definition was still in use, then the > respective *.elc continues to use the expansion of that old definition, > even if the definition itself gets recompiled. You have to edit the > actual definition and the recompile all of Magit (or at least remove > all *.elc). > >> It sounds like I should report this issue to magit? > > Someone actually already opened an issue yesterday, but that was not > necessary because I am the Magit maintainer and I am already here. > >>> (defmacro magit--with-temp-process-buffer (&rest body) >>> (let ((p (gensym))) >>> `(let ((,p (seq-filter >>> (lambda (elt) >>> (and (string-search "=" elt) >>> (not (tramp-local-environment-variable-p elt)))) >>> process-environment))) >>> (with-temp-buffer >>> (let ((process-environment ,p)) >>> ,@body))))) > > Actually: > > (defmacro magit--with-temp-process-buffer (&rest body) > (let ((rmt (gensym)) > (env (gensym))) > `(let* ((,rmt (file-remote-p default-directory)) > (,env (and ,rmt > (seq-filter > (lambda (elt) > (and (string-search "=" elt) > (not (tramp-local-environment-variable-p elt)))) > process-environment)))) > (with-temp-buffer > (if ,rmt > (let ((process-environment ,env)) > ,@body) > ,@body))))) > > I won't be releasing today. > The cat loudly demands attention. This duplicates BODY in the macro expansion, you should wrap it in inside a lambda. But more importantly, if the solution to this problem (which is general, i.e., applies to every call to make-process in a temp buffer) is so complicated, then Tramp itself should provide a helper. However, I think what I wrote at the end of my previous message does the trick.
