From unknown Fri Sep 19 23:54:02 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#79463 <79463@debbugs.gnu.org> To: bug#79463 <79463@debbugs.gnu.org> Subject: Status: [PATCH] term: Add 'term-other-window' command Reply-To: bug#79463 <79463@debbugs.gnu.org> Date: Sat, 20 Sep 2025 06:54:02 +0000 retitle 79463 [PATCH] term: Add 'term-other-window' command reassign 79463 emacs submitter 79463 ERIC Frederickson severity 79463 normal tag 79463 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 17 21:42:16 2025 Received: (at submit) by debbugs.gnu.org; 18 Sep 2025 01:42:16 +0000 Received: from localhost ([127.0.0.1]:58800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uz3f6-0002Ve-8J for submit@debbugs.gnu.org; Wed, 17 Sep 2025 21:42:16 -0400 Received: from lists.gnu.org ([2001:470:142::17]:51240) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uz3f3-0002VN-71 for submit@debbugs.gnu.org; Wed, 17 Sep 2025 21:42:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uz3ex-00024o-Rk for bug-gnu-emacs@gnu.org; Wed, 17 Sep 2025 21:42:07 -0400 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uz3et-0000zV-BD for bug-gnu-emacs@gnu.org; Wed, 17 Sep 2025 21:42:07 -0400 Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-81076e81aabso45807985a.3 for ; Wed, 17 Sep 2025 18:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758159721; x=1758764521; darn=gnu.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=XyfBDuT2MsVw18XTHrQ9BOVNpjOtS6h3V35lqOFIa8s=; b=H7v2J4qC5nKawSNlS29wp8vAI0nCueNfiTpsyHiK6PhpTDb6f8ESBSIgSWXoisMNYU 2xoHSfSNdMSfJuzaxRdEKHueWXuXGn4706lQqSzbPLfTyEsrNS1CU4K8b5Cd4Rj+P+IE hBxUD0gGPyftIZg6lJEDzmzUfRlNo/vBoq10Beofxm/Hv9fgSp7mL5lF2uatn2T9IzYE RuURtcfrL5Fjqg9S50aNjZnsuOdMT/CcNqDD3Vhko4ib/HcvYNQqtqKlLmNGts05kdX0 NRmfGqzkHiIjJ+luciqQYaS3c+7qjDhaCEbd40y8EnU7ZvJhRJXKOjrXG63NkAYIUTYi I8lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758159721; x=1758764521; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XyfBDuT2MsVw18XTHrQ9BOVNpjOtS6h3V35lqOFIa8s=; b=MQpIleVC3vn2YQmmNRw7LbDyFaAY5C26XHQoZsr251iTZszh5sH5p6H6PM3QtkVKG9 WW8UfiIbAO/yA89/k6VmqQyNFjY/c69fNokz0f8IgHUm5zVWU3CCbsT2qdJyAwFsMJOv N8UZwuIt1XZXvRHOPd5e6LG5L4y7iWp5KZQUrWgXL12m5pZX0LJ216+AhobDIRy+weqk WwoTZL8MBgjOQSYTJblNKkTYwFfIS5nEfhupkjczTDQnBONugKKxnwWDa+XE4rWTM5Xy a2nkQCzGCbB6ztYL5J9KliHwOGh87upo6k2HjTIgdgdbwldtytMzD3qbRiPub/zWSdsF Oaog== X-Gm-Message-State: AOJu0Yzyk6wQNJpFpGx0phoCOkCCX9y4VSWm0F9PQlG5TGJVx31kPXoN y7ugU3j8KRLuiszq96xQl5b2MKJmdoFI5veUQ8Z0t0UBSWxvjUE9XtmeZnSl9vZmFfRbDI7J8xm m8TymJ1m+y2gSULrQ2AdlO5uybB72+jsXRL4S X-Gm-Gg: ASbGncuxCOeXa+/0pk0KJnoyS8cQQl0dZFZnhb2Ij29kicWzicmsDVjMZggzithwXk5 NaJoK6XPPXRvYWne4JQybXKP/Ju/TWQVqKbAup0bG2YxIpMWpflAkZskcQ4OurlSfdTD2W3F9s8 6PVlGqfizSYVyPu99QpvDMlc+jijthfTzVBKW8HxadEIL7nuYBdCxKc8o2n9bO4no/rlqUXf6kS 7zEeU73q+iL2aZ2X5GANdqoWf95QK1+si+SJLpQB/kgax0QHZ7f6FDnEKHYLX3hQiUJtg== X-Google-Smtp-Source: AGHT+IFm718TYpbu6mgF8JZP/A8zRwDhaJF3rKAYRojsYsW1c3reBsRjHaxVrgeKS5ZaqKBOUi0xV5OpogaK4IkLGXg= X-Received: by 2002:a05:620a:7013:b0:809:7ac4:e5d with SMTP id af79cd13be357-8310ec4f688mr464994585a.38.1758159721322; Wed, 17 Sep 2025 18:42:01 -0700 (PDT) MIME-Version: 1.0 From: ERIC Frederickson Date: Wed, 17 Sep 2025 20:41:50 -0500 X-Gm-Features: AS18NWDsP4xN06Q2ZhkCT4ijQ2vuKy1Ubw3kfAzGLQAM195VxNoxgwUTSchlE18 Message-ID: Subject: [PATCH] term: Add 'term-other-window' command To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="000000000000a6648b063f097584" Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=ericfrederickson68@gmail.com; helo=mail-qk1-x72f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello everyone, 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. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ericfrederickson68[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (ericfrederickson68[at]gmail.com) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) X-Debbugs-Envelope-To: submit Cc: per@bothner.com, dann@ics.uci.edu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --000000000000a6648b063f097584 Content-Type: text/plain; charset="UTF-8" Hello everyone, 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. 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. If this patch is well received, I'd like to follow it up by sending an RFC patch to emacs-devel@gnu.org proposing to bind this new command to "C-x 4 t", as I think that having 'term-other-window' bound to a key by default would make pop-up terminal users feel very comfortable on an out-of-the-box Emacs installation. Note: I'm currently waiting on a response for my FSF copyright assignment, so if someone would like to install this patch, please ask me to confirm that my assignment has been completed before installing. Thank you, -- Eric Frederickson https://emfred.com --000000000000a6648b063f097584 Content-Type: application/octet-stream; name="0001-Add-term-other-window-command.patch" Content-Disposition: attachment; filename="0001-Add-term-other-window-command.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_mfoqv6oi0 RnJvbSA3Yjg2MDk3ZjBiYmE2NTU3MGU0NWM4MjEyMTc4NDllMDA2MzY2YzhmIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBFcmljIEZyZWRlcmlja3NvbiA8ZXJpY2ZyZWRlcmlja3NvbjY4 QGdtYWlsLmNvbT4KRGF0ZTogV2VkLCAxNyBTZXAgMjAyNSAyMDowMDowOSAtMDUwMApTdWJqZWN0 OiBbUEFUQ0hdIEFkZCAndGVybS1vdGhlci13aW5kb3cnIGNvbW1hbmQKClRoaXMgY29tbWFuZCB3 b3JrcyBpZGVudGljYWxseSB0byB0aGUgZXhpc3RpbmcgJ3Rlcm0nIGNvbW1hbmQsIGV4Y2VwdAp0 aGF0IGl0IG9wZW5zIHRoZSByZXN1bHRpbmcgVGVybSBtb2RlIGJ1ZmZlciBpbiBhbm90aGVyIHdp bmRvdywgaW4gdGhlCnN0eWxlIG9mIG90aGVyICcqLW90aGVyLXdpbmRvdycgY29tbWFuZHMuIFRo aXMgbmV3IGNvbW1hbmQgZ2l2ZXMgdXNlcnMKYW4gb3V0LW9mLXRoZS1ib3ggc29sdXRpb24gZm9y IHNwYXduaW5nIGEgcG9wLXVwIHRlcm1pbmFsIHdpbmRvdywgd2hpY2gKaXMgYSBwb3B1bGFyIHdv cmtm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XIgd2luZG93OiAiCisJCQkJCSAob3IgZXhwbGljaXQtc2hlbGwtZmlsZS1uYW1l CisJCQkJCSAgICAgKGdldGVudiAiRVNIRUxMIikKKwkJCQkJICAgICBzaGVsbC1maWxlLW5hbWUp KSkpCisgIChsZXQgKChwcm9nIChzcGxpdC1zdHJpbmctc2hlbGwtY29tbWFuZCBwcm9ncmFtKSkp CisgICAgKHNldC1idWZmZXIgKGFwcGx5ICMnbWFrZS10ZXJtICJ0ZXJtaW5hbCIgKGNhciBwcm9n KSBuaWwgKGNkciBwcm9nKSkpKQorICAodGVybS1jaGFyLW1vZGUpCisgIChwb3AtdG8tYnVmZmVy ICIqdGVybWluYWwqIikpCisKIChkZWZ1biB0ZXJtLWV4ZWMgKGJ1ZmZlciBuYW1lIGNvbW1hbmQg c3RhcnRmaWxlIHN3aXRjaGVzKQogICAiU3RhcnQgdXAgYSBwcm9jZXNzIGluIGJ1ZmZlciBmb3Ig dGVybSBtb2Rlcy4KIEJsYXN0cyBhbnkgb2xkIHByb2Nlc3MgcnVubmluZyBpbiB0aGUgYnVmZmVy LiAgRG9lc24ndCBzZXQgdGhlIGJ1ZmZlciBtb2RlLgotLSAKMi41MC4xLjM2OS5nM2YyYTk0ODc1 ZC5kaXJ0eQoK --000000000000a6648b063f097584-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 18 01:35:34 2025 Received: (at 79463) by debbugs.gnu.org; 18 Sep 2025 05:35:34 +0000 Received: from localhost ([127.0.0.1]:59475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uz7Ir-0000pS-Kq for submit@debbugs.gnu.org; Thu, 18 Sep 2025 01:35:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37500) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uz7Ip-0000op-2o for 79463@debbugs.gnu.org; Thu, 18 Sep 2025 01:35:32 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uz7Ii-0000EK-LT; Thu, 18 Sep 2025 01:35:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=E8UV2s72FcDj1LfTjfgYzRDRb4IXRL8Tn5UNzjH8Uxo=; b=QBDxhb2F0CH4 CVpxvAROXy7DdsOGv2SiY5PtBHGaah4G8bOktec8VAgAzT04I9es+IdLzceiW1qwXGQNGmAQon9Yb nExhoG94V9G5nDvVLf2++an+gIItl5+/ZJvPdgD1w+e8NBhc8ToppjINjNsqWrl8ZcGevDHC74lXE JW5lcHKCuTpwwxHAvEcUYvM7boWjNg069pix8iygvkJLcZAco3T1wgGWmLf9Bcv7Y9TqPKcIHWz9a FuLExxyHgvgMISTNwHsD/UdO2SQwGynKbXgxiSjF5T/FX4EPI4bjJbtwTVdhYpR24hLowJ9ZDdzjp n9acRdZgTdEG5uU5+nZ5Dg==; Date: Thu, 18 Sep 2025 08:35:20 +0300 Message-Id: <86ikhgl3vr.fsf@gnu.org> From: Eli Zaretskii To: ERIC Frederickson In-Reply-To: (message from ERIC Frederickson on Wed, 17 Sep 2025 20:41:50 -0500) Subject: Re: bug#79463: [PATCH] term: Add 'term-other-window' command References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79463 Cc: dann@ics.uci.edu, per@bothner.com, 79463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: per@bothner.com, dann@ics.uci.edu > From: ERIC Frederickson > 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. > + > +\\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? From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 18 14:09:57 2025 Received: (at 79463) by debbugs.gnu.org; 18 Sep 2025 18:09:57 +0000 Received: from localhost ([127.0.0.1]:34059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uzJ4t-0005EV-QL for submit@debbugs.gnu.org; Thu, 18 Sep 2025 14:09:56 -0400 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]:60740) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uzJ4d-0005E1-6U for 79463@debbugs.gnu.org; Thu, 18 Sep 2025 14:09:49 -0400 Received: by mail-qk1-x733.google.com with SMTP id af79cd13be357-8117aef2476so129126285a.1 for <79463@debbugs.gnu.org>; Thu, 18 Sep 2025 11:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758218973; x=1758823773; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=p7Su3nf3Tybrx68mZ+du/BDUJdmuYrHgSTKODMl/QC4=; b=cc9fgekwwpRNR0kYWeOHrzcF1r+OFjWQY3VG2nN7mHaJStrTggxHUFCX8iiR1prTND Q9cwTRdynm5YYjD+oKH5y/xOVrUurqxW8dXVIfV9F/Er9HhgGEW3G5QOWAxEP670MEmv Veq4pcyy+yEQKzfxVvw7I0ZBKFPBYu9Rvy1zvCs0cC3vhE1lEDwWSTKXUt9a0D1AdGpl 2C2M1qebUWT2OUucCH6QY4oJBvLszzdnm+iLP+sxFI23SHfWSqwvGGvI/vFJMKL+fN9S kXZtxqruGNrnjxgwacar4wQDFRJXkmYAVH8CBJ5G7OcUdyO/3cnbgUKRxi/PFqWrtvuc hTUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758218973; x=1758823773; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p7Su3nf3Tybrx68mZ+du/BDUJdmuYrHgSTKODMl/QC4=; b=CQzaqXBhkqsbEy4V9a9q5VoKn2FwtdZpAZAA+WiLkWZESHKqqXtExJ2eZ53LZeUDh4 0d0FWAC17Linf5doNMjbmnnrjQ9NjlZDudEu18+7P3TeOq5hjKG/xC7gvlXpkAn/qEYg owVpaV+IRcLmuLxCkuREVx3P0pOcLoWuTnPXi2fTNHXVzwLCIfDVIP8NTVJNpmh4GYmJ HiO+e6C4cqulI8QeMBMllRkKfxzwMcJg2cEMrdqYyinyaJ4de69r6IyTMEPeRO7npy6U bxEyBmxbRJa9dTyRKrCdnhR2CvoG7c7MWVX6WjoYdzMhmF0s7vjkbN1ZQJiMJydBoA0w ovDg== X-Gm-Message-State: AOJu0Yw16Az40nUij729gCMRA2LPB9x1ENNbfd3f4xVqRoxTWMtfVDk0 1sO/9F6PtuQ0iWxI5jMvSIV9LByY2oJNIoNfbBU8a7POj377MDRL3IjCLJ872tD0nJyANEiWFO/ DMrpOsxIjHqfYvYxRdAAacn7lrf2Mvgw= X-Gm-Gg: ASbGncu2obQA2sqhxenfksW37pP/XEaQyh1M//CLo8ixHBMiX8knS3ZklhzrYMkLt2V HQkEsY/5+scAYR3UAC3kX0foGxbkjei7lmzMO++wg9HkIpa7BJRbQXqptWX4sHkJ8/Iib2hokgU qFta/NhccFRf6zqxe0UJSKlbn8vuZJgVzBXxGrMLUvBBIwNiuqr4pvX6dpo6WywvuXpkkddBccA FagmYlRv4Lz7GQ+SO6EyVo0VoyMsaj9qGkcu264M3MT+cQzIE//r3EWMQ== X-Google-Smtp-Source: AGHT+IHOrS/veD+8cUDwCMNhBWpDP3XnPJPi24+i6sXhJIPQpCG4OEgG2l6NXhGb/68/gr2n2o19UI70Eu9GN43OdoI= X-Received: by 2002:a05:620a:3901:b0:808:bbc:df09 with SMTP id af79cd13be357-83bacd4aac2mr48763385a.56.1758218972838; Thu, 18 Sep 2025 11:09:32 -0700 (PDT) MIME-Version: 1.0 References: <86ikhgl3vr.fsf@gnu.org> In-Reply-To: <86ikhgl3vr.fsf@gnu.org> From: ERIC Frederickson Date: Thu, 18 Sep 2025 13:09:21 -0500 X-Gm-Features: AS18NWBlUPEdOXOUr_DsWmmYJdl6uD2N_B6_otPCybkzwHOARr5iqNhxHOCSpbk Message-ID: Subject: Re: bug#79463: [PATCH] term: Add 'term-other-window' command To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 79463 Cc: dann@ics.uci.edu, per@bothner.com, 79463@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) >> 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". Yes; the "C-x 4 4 M-x term RET" solution is something I found while exploring the 'term-other-window' idea, and it led me to question whether a new command like 'term-other-window' was necessary. I came to the conclusion that the existence of a stand-alone 'term-other-window' command would still be beneficial, because it would enable users to bind the "Term mode buffer in another window" behavior to a key without needing to write a custom command to bind the key to. I think it'd be nice if they could make a binding for this behavior via "M-x global-set-key RET" for example, especially since this is a behavior that I've seen to be widely used among programmers. I'd be worried about a situation where a user thinks: "I like what 'C-x 4 4 M-x term RET' does, and would like to bind that to a more convenient key", and then can't find a way to do so. Of course, this argument could apply to any command that someone might want to run after "C-x 4 4", and clearly we should not add a '*-other-window' variant for any command '*' for which it may be wanted. However, I feel it's a justified addition to the 'term' package specifically because the "terminal emulator in another window" behavior is a common pattern of interaction for terminal emulator users, and making it more discoverable and more easily bindable via adding a command like 'term-other-window' seems to make 'term' more friendly. > 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. Awesome, thank you very much for providing this feedback. >> +*** New command 'term-other-window'. >> +This command is like 'term', but opens the resulting Term mode buffer i= n >> +another window. With the addition of this command, Emacs now gives user= s >> +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. Adopted. > Also, the second sentence seems to be unnecessary, because NEWS > doesn't have to advertise new features, as long as the functionality > is clear. Understood. >> +;;;###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. >> + >> +\\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? Agreed; will do. I'll take some time to think about the best way to proceed here, and I hope to send an improved patch within a few days. I'll assume that it would be best to send this updated patch to this same thread, unless I hear otherwise. Thanks everyone, And thanks again Eli for your comments, -- Eric Frederickson On Thu, Sep 18, 2025 at 12:35=E2=80=AFAM Eli Zaretskii wrote= : > > > Cc: per@bothner.com, dann@ics.uci.edu > > From: ERIC Frederickson > > Date: Wed, 17 Sep 2025 20:41:50 -0500 > > > > The patch attached to this message adds a command to lisp/term.el calle= d > > '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 i= s > > 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 use= rs > > +an out-of-the-box way to use the common "pop-up terminal" workflow tha= t > > +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. > > + > > +\\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?