From: Juri Linkov <juri@jurta.org>
To: jemarch@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: Reusing dead shell buffers
Date: Wed, 14 Jan 2009 01:27:57 +0200 [thread overview]
Message-ID: <87ocyaer7n.fsf@jurta.org> (raw)
In-Reply-To: <87hc454muu.wl%jemarch@gnu.org> (jemarch@gnu.org's message of "Sun, 11 Jan 2009 21:19:21 +0100")
> 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/
next prev parent reply other threads:[~2009-01-13 23:27 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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ocyaer7n.fsf@jurta.org \
--to=juri@jurta.org \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.