From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: jemarch@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: Reusing dead shell buffers
Date: Wed, 17 Nov 2010 10:16:07 -0500 [thread overview]
Message-ID: <jwvk4kelijx.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87hc454muu.wl%jemarch@gnu.org> (jemarch@gnu.org's message of "Sun, 11 Jan 2009 21:19:21 +0100")
> 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 problem with this patch if that if the user really wanted to jump
from *shell*<2> to the *shell* buffer instead (current behavior), he'll
be surprised because the command will end up not doing anything.
I think your idea is right, but it needs two fixes:
- check that the process is indeed dead.
- replace (eq major-mode 'shell-mode) with (derived-mode-p 'shell-mode)
I promise that I'll install such a patch much quicker than it took me to
reply to this email.
Stefan "going through some of his voluminous backlog"
> 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).
prev parent reply other threads:[~2010-11-17 15:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-11 20:19 Reusing dead shell buffers jemarch
2009-01-13 23:27 ` Juri Linkov
2010-11-17 15:16 ` Stefan Monnier [this message]
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=jwvk4kelijx.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=jemarch@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).