emacs-devel
[Top][All Lists]
Advanced

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

Reusing dead shell buffers


From: jemarch
Subject: Reusing dead shell buffers
Date: Sun, 11 Jan 2009 21:19:21 +0100
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Hi.

Just a tiny patch for shell.

The patch assumes that the person launching M-xshell while in a
shell-mode buffer with a terminated process really wants to launch a
shell process in the current buffer instead to switch to "*shell*".

The semantics of C-uM-xshell are not changed by the patch.

Index: shell.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/shell.el,v
retrieving revision 1.165
diff -u -r1.165 shell.el
--- shell.el    5 Jan 2009 03:19:45 -0000       1.165
+++ shell.el    11 Jan 2009 19:46:35 -0000
@@ -555,6 +555,9 @@
                      (read-file-name
                       "Default directory: " default-directory default-directory
                       t nil 'file-directory-p))))))))
+  ;; If the current buffer is a dead shell buffer, use it.
+  (if (and (not buffer) (eq major-mode 'shell-mode))
+      (setq buffer (current-buffer)))
   (setq buffer (get-buffer-create (or buffer "*shell*")))
   ;; Pop to buffer, so that the buffer's window will be correctly set
   ;; when we call comint (so that comint sets the COLUMNS env var properly).




reply via email to

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