From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Reusing dead shell buffers Date: Wed, 14 Jan 2009 01:27:57 +0200 Organization: JURTA Message-ID: <87ocyaer7n.fsf@jurta.org> References: <87hc454muu.wl%jemarch@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1231889452 8643 80.91.229.12 (13 Jan 2009 23:30:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 Jan 2009 23:30:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: jemarch@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 14 00:32:04 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 1LMsjr-0006Zq-Gg for ged-emacs-devel@m.gmane.org; Wed, 14 Jan 2009 00:32:03 +0100 Original-Received: from localhost ([127.0.0.1]:43280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMsib-0004WR-A7 for ged-emacs-devel@m.gmane.org; Tue, 13 Jan 2009 18:30:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LMshZ-0003Gk-0f for emacs-devel@gnu.org; Tue, 13 Jan 2009 18:29:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LMshW-0003EZ-Q5 for emacs-devel@gnu.org; Tue, 13 Jan 2009 18:29:40 -0500 Original-Received: from [199.232.76.173] (port=53407 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LMshW-0003Dz-Gt for emacs-devel@gnu.org; Tue, 13 Jan 2009 18:29:38 -0500 Original-Received: from relay03.kiev.sovam.com ([62.64.120.201]:53722) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LMshR-0002NY-UH; Tue, 13 Jan 2009 18:29:34 -0500 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay03.kiev.sovam.com with esmtp (Exim 4.69) (envelope-from ) id 1LMshL-00089G-08; Wed, 14 Jan 2009 01:29:27 +0200 In-Reply-To: <87hc454muu.wl%jemarch@gnu.org> (jemarch@gnu.org's message of "Sun, 11 Jan 2009 21:19:21 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: b22dd54e5e410b0526d530b08df0ebb5 X-DrWeb-checked: yes X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:107834 Archived-At: > Just a tiny patch for shell. > > The patch assumes that the person launching M-x shell 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-u M-x shell 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*"))) Some other modes do similar things (e.g. compilation/grep) reusing the current buffer, so I think it would be natural to revive the current buffer with `M-x shell' unless a numeric prefix is given. BTW, what I still desperately need from shell.el is using a prefix arg to add a numeric suffix to the shell buffer name in the same way as eshell already does: "A numeric prefix arg (as in `C-u 42 M-x eshell RET') switches to the session with that number, creating it if necessary." -- Juri Linkov http://www.jurta.org/emacs/