unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: jemarch@gnu.org
To: emacs-devel@gnu.org
Subject: Reusing dead shell buffers
Date: Sun, 11 Jan 2009 21:19:21 +0100	[thread overview]
Message-ID: <87hc454muu.wl%jemarch@gnu.org> (raw)


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	other threads:[~2009-01-11 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-11 20:19 jemarch [this message]
2009-01-13 23:27 ` Reusing dead shell buffers Juri Linkov
2010-11-17 15:16 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hc454muu.wl%jemarch@gnu.org \
    --to=jemarch@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).