[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reusing dead shell buffers
From: |
Stefan Monnier |
Subject: |
Re: Reusing dead shell buffers |
Date: |
Wed, 17 Nov 2010 10:16:07 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> 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 in Thread] |
Current Thread |
[Next in Thread] |
- Re: Reusing dead shell buffers,
Stefan Monnier <=