Closed marsam closed 3 years ago
Thanks!
Please briefly explain in the commit message why the (derived-mode-p 'comint-mode 'term-mode)
code-path is relevant for commands that "use shell-mode
" and also what previously happened because we didn't do this. And use elisp-style symbol-quoting not markdown code-quoting in commit message. And capitalize "Check".
Friendly ping!
Please complete the commit message. Thanks!
I'm so sorry for the late response 🙏 , somehow this got lost in my notifications. I've updated the commit with your suggestions.
I investigated a bit further and seems to happen when shell-command
process exits too quickly.
I'm not sure what is the best way to reproduce it, but I have the following in my init.el and happened to me a few times:
(dolist (hook '(shell-mode-hook term-exec-hook eshell-mode-hook))
(dolist (envvar with-editor-envvars)
(add-hook hook (apply-partially 'with-editor-export-editor envvar))))
Well, that happens. Np. Thanks!
When
with-editor-export-editor
is added to theshell-mode-hook
, it's also executed byshell-command
, because it callsshell-mode
, which inherits fromcomint-mode'
Usually,shell-command
is used to execute short-lived process, hence there might not be a process associated to the buffer when the hook is executed.The previous implementation assumed the existence of a process associated to a buffer, which might not be a case on
shell-command
buffers. This change intends to checks whether there is a process associated before sending the environment variables.