emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 375bfbd: Make sure that `shell' makes BUFFER curren


From: Martin Rudalics
Subject: [Emacs-diffs] master 375bfbd: Make sure that `shell' makes BUFFER current
Date: Mon, 10 Apr 2017 04:26:28 -0400 (EDT)

branch: master
commit 375bfbde06031d7e9ce363a6695b22b47c6a2798
Author: Martin Rudalics <address@hidden>
Commit: Martin Rudalics <address@hidden>

    Make sure that `shell' makes BUFFER current
    
    * lisp/shell.el (shell): Restrict scope of recently added
    `with-current-buffer' to make sure that BUFFER is current when
    `shell' returns.
---
 lisp/shell.el | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/lisp/shell.el b/lisp/shell.el
index e03ccbb..c5e5cbb 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -729,25 +729,26 @@ Otherwise, one argument `-i' is passed to the shell.
                 (file-local-name
                  (read-file-name
                   "Remote shell path: " default-directory shell-file-name
-                  t shell-file-name))))))
-
-    ;; The buffer's window must be correctly set when we call comint
-    ;; (so that comint sets the COLUMNS env var properly).
-    (pop-to-buffer buffer)
-    (unless (comint-check-proc buffer)
-      (let* ((prog (or explicit-shell-file-name
-                       (getenv "ESHELL") shell-file-name))
-             (name (file-name-nondirectory prog))
-             (startfile (concat "~/.emacs_" name))
-             (xargs-name (intern-soft (concat "explicit-" name "-args"))))
-        (unless (file-exists-p startfile)
-          (setq startfile (concat user-emacs-directory "init_" name ".sh")))
-        (apply 'make-comint-in-buffer "shell" buffer prog
-               (if (file-exists-p startfile) startfile)
-               (if (and xargs-name (boundp xargs-name))
-                   (symbol-value xargs-name)
-                 '("-i")))
-        (shell-mode))))
+                  t shell-file-name)))))))
+
+  ;; The buffer's window must be correctly set when we call comint
+  ;; (so that comint sets the COLUMNS env var properly).
+  (pop-to-buffer buffer)
+  ;; Rain or shine, BUFFER must be current by now.
+  (unless (comint-check-proc buffer)
+    (let* ((prog (or explicit-shell-file-name
+                     (getenv "ESHELL") shell-file-name))
+           (name (file-name-nondirectory prog))
+           (startfile (concat "~/.emacs_" name))
+           (xargs-name (intern-soft (concat "explicit-" name "-args"))))
+      (unless (file-exists-p startfile)
+        (setq startfile (concat user-emacs-directory "init_" name ".sh")))
+      (apply 'make-comint-in-buffer "shell" buffer prog
+             (if (file-exists-p startfile) startfile)
+             (if (and xargs-name (boundp xargs-name))
+                 (symbol-value xargs-name)
+               '("-i")))
+      (shell-mode)))
   buffer)
 
 ;;; Directory tracking



reply via email to

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