From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jemarch@gnu.org Newsgroups: gmane.emacs.devel Subject: Reusing dead shell buffers Date: Sun, 11 Jan 2009 21:19:21 +0100 Message-ID: <87hc454muu.wl%jemarch@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1231718006 10418 80.91.229.12 (11 Jan 2009 23:53:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 Jan 2009 23:53:26 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 12 00:54:38 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LMA8O-0007fK-UN for ged-emacs-devel@m.gmane.org; Mon, 12 Jan 2009 00:54:25 +0100 Original-Received: from localhost ([127.0.0.1]:47546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMA78-0000kv-CK for ged-emacs-devel@m.gmane.org; Sun, 11 Jan 2009 18:53:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LM6PW-00076k-UD for emacs-devel@gnu.org; Sun, 11 Jan 2009 14:55:50 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LM6PW-00076I-FH for emacs-devel@gnu.org; Sun, 11 Jan 2009 14:55:50 -0500 Original-Received: from [199.232.76.173] (port=34784 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LM6PW-000768-BR for emacs-devel@gnu.org; Sun, 11 Jan 2009 14:55:50 -0500 Original-Received: from p54b14dd8.dip.t-dialin.net ([84.177.77.216]:40976 helo=malditobastardo.gnu.org) by monty-python.gnu.org with esmtpa (Exim 4.60) (envelope-from ) id 1LM6PV-00046q-MZ for emacs-devel@gnu.org; Sun, 11 Jan 2009 14:55:50 -0500 User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (=?UTF-8?B?U2hpasWN?=) APEL/10.6 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Sun, 11 Jan 2009 18:53:02 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:107792 Archived-At: 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).