emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 96f9595: * lisp/shell.el (shell): Make shell buffer


From: Michael Albinus
Subject: [Emacs-diffs] master 96f9595: * lisp/shell.el (shell): Make shell buffer the current buffer. (Bug#37745)
Date: Thu, 17 Oct 2019 12:47:01 -0400 (EDT)

branch: master
commit 96f959521996399b7d75132d9f913577ba59cfb5
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    * lisp/shell.el (shell): Make shell buffer the current buffer.  (Bug#37745)
---
 lisp/shell.el | 69 ++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 35 insertions(+), 34 deletions(-)

diff --git a/lisp/shell.el b/lisp/shell.el
index 38b0ef8..9593c79 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -708,6 +708,8 @@ such as `explicit-csh-args'.  If that symbol is a variable,
 its value is used as a list of arguments when invoking the shell.
 Otherwise, one argument `-i' is passed to the shell.
 
+Make the shell buffer the current buffer, and return it.
+
 \(Type \\[describe-mode] in the shell buffer for a list of commands.)"
   (interactive
    (list
@@ -734,40 +736,39 @@ Otherwise, one argument `-i' is passed to the shell.
                    (get-buffer-create (or buffer "*shell*"))
                  ;; If the current buffer is a dead shell buffer, use it.
                  (current-buffer)))
-
-  (with-current-buffer buffer
-    (with-connection-local-variables
-     ;; On remote hosts, the local `shell-file-name' might be useless.
-     (when (file-remote-p default-directory)
-       (if (and (called-interactively-p 'any)
-                (null explicit-shell-file-name)
-                (null (getenv "ESHELL")))
-           (set (make-local-variable 'explicit-shell-file-name)
-                (file-local-name
-                (expand-file-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)
-     ;; 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")))
-         (setq-local shell--start-prog (file-name-nondirectory prog))
-         (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)))))
+  ;; 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)
+
+  (with-connection-local-variables
+   ;; On remote hosts, the local `shell-file-name' might be useless.
+   (when (file-remote-p default-directory)
+     (if (and (called-interactively-p 'any)
+              (null explicit-shell-file-name)
+              (null (getenv "ESHELL")))
+         (set (make-local-variable 'explicit-shell-file-name)
+              (file-local-name
+              (expand-file-name
+                (read-file-name
+                 "Remote shell path: " default-directory shell-file-name
+                 t shell-file-name))))))
+
+   ;; 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")))
+       (setq-local shell--start-prog (file-name-nondirectory prog))
+       (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]