emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/with-editor 89280a6 133/140: with-editor-export-editor: Ch


From: Jonas Bernoulli
Subject: [nongnu] elpa/with-editor 89280a6 133/140: with-editor-export-editor: Check whether there is a buffer process
Date: Fri, 6 Aug 2021 12:51:35 -0400 (EDT)

branch: elpa/with-editor
commit 89280a653f8cb6947d886f7cbd42de6d57838229
Author: Mario Rodas <marsam@users.noreply.github.com>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    with-editor-export-editor: Check whether there is a buffer process
    
    When `with-editor-export-editor' is added to the `shell-mode-hook', it's
    also executed by `shell-command', because it calls `shell-mode', which
    inherits from `comint-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.
---
 with-editor.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/with-editor.el b/with-editor.el
index 9950fff..ed1841c 100644
--- a/with-editor.el
+++ b/with-editor.el
@@ -697,7 +697,7 @@ This works in `shell-mode', `term-mode', `eshell-mode' and
   (interactive (list (with-editor-read-envvar)))
   (cond
    ((derived-mode-p 'comint-mode 'term-mode)
-    (let ((process (get-buffer-process (current-buffer))))
+    (when-let ((process (get-buffer-process (current-buffer))))
       (goto-char (process-mark process))
       (process-send-string
        process (format " export %s=%s\n" envvar



reply via email to

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