emacs-diffs
[Top][All Lists]
Advanced

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

master 66d1513: Fix problems with 'C-c C-n' in sh-script-mode


From: Lars Ingebrigtsen
Subject: master 66d1513: Fix problems with 'C-c C-n' in sh-script-mode
Date: Thu, 23 Sep 2021 17:19:15 -0400 (EDT)

branch: master
commit 66d15137629a5224e16a0269e0e3181500962de2
Author: Miha Rihtaršič <miha@kamnitnik.top>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix problems with 'C-c C-n' in sh-script-mode
    
    * lisp/progmodes/sh-script.el (sh-shell-process): If a *shell* buffer
    doesn't exist, 'C-c C-n' creates one and displays it.  This patch
    prevents it from being displayed in the selected window.
    Additionally, it ensures that the local `sh-shell-process' variable is
    set in the correct buffer (bug#50765).
---
 lisp/progmodes/sh-script.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index cccd70f..3b6774a 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1396,8 +1396,15 @@ If FORCE is non-nil and no process found, create one."
             (or found
                 (and force
                      (get-buffer-process
-                      (let ((explicit-shell-file-name sh-shell-file))
-                        (shell)))))))))
+                      (let ((explicit-shell-file-name sh-shell-file)
+                            (display-buffer-overriding-action
+                             '(nil . ((inhibit-same-window . t)))))
+                        ;; We must prevent this `(shell)' call from
+                        ;; switching buffers, so that the variable
+                        ;; `sh-shell-process' is set locally in the
+                        ;; correct buffer.
+                        (save-current-buffer
+                          (shell))))))))))
 
 (defun sh-show-shell ()
   "Pop the shell interaction buffer."



reply via email to

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