emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reusing dead shell buffers


From: Juri Linkov
Subject: Re: Reusing dead shell buffers
Date: Wed, 14 Jan 2009 01:27:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

> 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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]