GNU bug report logs -
#79463
[PATCH] term: Add 'term-other-window' command
Previous Next
Full log
Message #8 received at 79463 <at> debbugs.gnu.org (full text, mbox):
> Cc: per <at> bothner.com, dann <at> ics.uci.edu
> From: ERIC Frederickson <ericfrederickson68 <at> gmail.com>
> Date: Wed, 17 Sep 2025 20:41:50 -0500
>
> The patch attached to this message adds a command to lisp/term.el called
> 'term-other-window', which is a sibling command to 'term' but which
> opens the *terminal* buffer in another window.
Thanks.
> I think that the functionality of having a terminal emulator pop to
> another window can be extremely useful to those who use a terminal
> emulator within their text editor, and would hence be a great thing to
> ship with Emacs's built-in 'term' package. Additionally, I think that
> this addition would be especially useful to people coming to Emacs from
> other text/code editing environments such as VS Code, wherein the
> "pop-up terminal" / "split terminal" workflow is very widely used and is
> seen as standard.
It's a no-brainer to have a command that does something we already do,
but in another window. However, please note that Emacs 31 is already
capable to do this generically with many/most commands, by using the
"C-x 4 4" prefix. Thus, "C-x 4 4 M-x term RET" already does what you
want, and I'm therefore wondering whether we need a new command for
this, let alone a new keybinding "C-x 4 t".
I'm writing some comments below, both for the case we decide to accept
this patch nonetheless, and for making you aware of our conventions
for your future contributions.
> +*** New command 'term-other-window'.
> +This command is like 'term', but opens the resulting Term mode buffer in
> +another window. With the addition of this command, Emacs now gives users
> +an out-of-the-box way to use the common "pop-up terminal" workflow that
> +many users may be expecting, especially if they're coming from other
> +popular text editing environments in which this workflow is standard.
Our conventions are to leave two spaces between sentences. Also, the
second sentence seems to be unnecessary, because NEWS doesn't have to
advertise new features, as long as the functionality is clear.
> +;;;###autoload
> +(defun term-other-window (program)
> + "Start a terminal-emulator in a new buffer, in another window.
> +The buffer is in Term mode; see `term-mode' for the
> +commands to use in that buffer.
> +
> +\\<term-raw-map>Type \\[other-window] to switch back to another window,
> +or \\[switch-to-buffer] to switch to another buffer."
> + (interactive (list (read-shell-command "Run program in other window: "
> + (or explicit-shell-file-name
> + (getenv "ESHELL")
> + shell-file-name))))
> + (let ((prog (split-string-shell-command program)))
> + (set-buffer (apply #'make-term "terminal" (car prog) nil (cdr prog))))
> + (term-char-mode)
> + (pop-to-buffer "*terminal*"))
Since this is almost an exact copy of 'term', maybe making them both
use the same subroutine with most of the body would be slightly
better. E.g., what if someone wants to add term-other-frame?
This bug report was last modified 1 day ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.