From unknown Sat Jul 26 23:57:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#56646: User option to disable deleting current input when using mouse-2 in comint Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Jul 2022 16:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56646 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 56646@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165824846914061 (code B ref -1); Tue, 19 Jul 2022 16:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Jul 2022 16:34:29 +0000 Received: from localhost ([127.0.0.1]:55047 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDqB3-0003ei-9I for submit@debbugs.gnu.org; Tue, 19 Jul 2022 12:34:29 -0400 Received: from lists.gnu.org ([209.51.188.17]:60070) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDqAz-0003eZ-8y for submit@debbugs.gnu.org; Tue, 19 Jul 2022 12:34:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36062) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDqAz-00004v-4N for bug-gnu-emacs@gnu.org; Tue, 19 Jul 2022 12:34:25 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:46898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDqAx-0006do-91 for bug-gnu-emacs@gnu.org; Tue, 19 Jul 2022 12:34:24 -0400 Received: by mail-pf1-x441.google.com with SMTP id c3so13138221pfb.13 for ; Tue, 19 Jul 2022 09:34:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:user-agent:mime-version; bh=FmqukoXECQ/d6O5/3lQD6EV+STj9iw14CijRxcCMeL8=; b=VldVeLIugqlMbtif9PaIpmHxCk671iu3SeehW3V4bNEacVvEL/aJ6M+EVRYkpMkqif Svbycs/ZRqE0Rkj0e7FzPQEJI+8ASLeZuddPpkGUE8k3Rqgm8n2Ym+N4G4RDmL5UrCpi 9ex/N0aCKQCNRB82cZUbegzoJVeGL8p2oXjDSU5D5ddboT9NYV+lZ9y096h4QbtK0LAj B+SoYCUXx+5NLGBV31JbWQl+LD7uk4RYGuXk0+5znatmJXwx3gklk73GzYtwAIfXiUaq pMWmRY8N9riRwTKwBuOsG9Jx3c6MKEJ+CEoucVbDNDiUTSWZCjhblyvN53sYHhfBqBAC OLkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=FmqukoXECQ/d6O5/3lQD6EV+STj9iw14CijRxcCMeL8=; b=PdYbk6J6bif9ZfC4lf4pjYetert595RZ00bl1hfNI1h2deB7CJcbJ1KUEDLVywz+lF hmHJHCZd0ktjssmUPEyHDiuzU0zl5h0usDCA+B/gFUPLCMkNJMj8frooHvnwq3A1Jgml 2swKN+4NQq49r0fVi8FKFIkojzRLp0IfIA3e8iwJh//DRHqugGM4zph/+op24aJV+uqn 7spHO/exsB0J/OudagndZtV+Q0j/7Whp1279QDiBrAE5WeKElF6PPW2tTtBmSseYeilK KvDond9b5o3N2EGtmF3VSj5f1vGDkmzT4ZhqKf0HrWBxjscd+SZWIWkjbDQcufftbtoT 1/iA== X-Gm-Message-State: AJIora/QFL13oV7/sn+F9Lo3UvujO4Bgch8RZ07gC+Ivvl291CML3OpY hiToa/xmC2qVNIlnTNSdW0HmlyLUuug= X-Google-Smtp-Source: AGRyM1v8xslRPzjbNuDDL7JJAA/kYG+24AaHtXw14sJgSyvAacdRej6FYxIwMBIqk3nB4junvjPneQ== X-Received: by 2002:a05:6a00:b92:b0:52a:e60d:dfbb with SMTP id g18-20020a056a000b9200b0052ae60ddfbbmr34314022pfj.72.1658248460825; Tue, 19 Jul 2022 09:34:20 -0700 (PDT) Received: from localhost ([49.204.112.231]) by smtp.gmail.com with ESMTPSA id g8-20020aa796a8000000b0051be16492basm11756557pfk.195.2022.07.19.09.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 09:34:19 -0700 (PDT) From: Visuwesh Date: Tue, 19 Jul 2022 22:04:09 +0530 Message-ID: <877d49cb9a.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::441; envelope-from=visuweshm@gmail.com; helo=mail-pf1-x441.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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: -2.3 (--) --=-=-= Content-Type: text/plain Tags: patch mouse-2 in comint can be used to reinsert old inputs however, it unconditionally deletes the current (unsent) input. This makes it impossible to use the mouse-2 command to further act on the previous input. For example, consider you're doing something like this in a Python REPL: >>> foo() ... some output... you verify that it is okay >>> bar(| With the point being |, you say mouse-2 when the pointer is over foo(). Currently comint-mode makes the last prompt become >>> foo() which is not so helpful. Attached patch adds a new user option to turn off this deletion so you may get... >>> bar(foo()| instead, which, IMHO, is more useful. In GNU Emacs 29.0.50 (build 22, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2022-07-17 built on astatine Repository revision: 5db4ec20fe4b428e15aa53208c9a9bfb037c0f30 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101003 System Description: Debian GNU/Linux bookworm/sid Configured using: 'configure --with-sound=alsa --with-x-toolkit=lucid --with-json --without-xaw3d --without-gconf --without-libsystemd --without-cairo' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-New-user-option-to-disable-deleting-current-input-in.patch >From 6d2631be4582b38b1bf4eb78d3b8bbd6c687b0d6 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Tue, 19 Jul 2022 21:56:02 +0530 Subject: [PATCH] New user option to disable deleting current input in comint mouse-2 * lisp/comint.el (comint-delete-old-input): New user option to disable deleting current input when insert an old input using mouse-2. (comint-insert-input): Use it. * etc/NEWS: Announce the user option. --- etc/NEWS | 5 +++++ lisp/comint.el | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 604e30ce25..213b358cc2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -990,6 +990,11 @@ The user option 'comint-terminfo-terminal' and the variable 'system-uses-terminfo' can now be set as connection-local variables to change the terminal used on a remote host. +--- +*** New user option 'comint-delete-old-input' +When set to nil, this prevents comint from deleting the current input +when inserting previous input using ''. + ** Mwheel --- diff --git a/lisp/comint.el b/lisp/comint.el index d52623c00a..3ed04f098c 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -905,6 +905,12 @@ comint-nonblank-p "Return non-nil if STR contains non-whitespace syntax." (not (string-match "\\`\\s *\\'" str))) +(defcustom comint-delete-old-input t + "When non-nil, delete old input on inserting previous input with \\\\[comint-insert-input]." + :type 'boolean + :group 'comint + :version "29.1") + (defun comint-insert-input (event) "In a Comint buffer, set the current input to the previous input at point. If there is no previous input at point, run the command specified @@ -936,10 +942,11 @@ comint-insert-input ;; Otherwise, insert the previous input. (goto-char (point-max)) ;; First delete any old unsent input at the end - (delete-region - (or (marker-position comint-accum-marker) - (process-mark (get-buffer-process (current-buffer)))) - (point)) + (when comint-delete-old-input + (delete-region + (or (marker-position comint-accum-marker) + (process-mark (get-buffer-process (current-buffer)))) + (point))) ;; Insert the input at point (insert input))))) -- 2.35.1 --=-=-=-- From unknown Sat Jul 26 23:57:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#56646: User option to disable deleting current input when using mouse-2 in comint Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Jul 2022 07:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56646 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Visuwesh Cc: 56646@debbugs.gnu.org Received: via spool by 56646-submit@debbugs.gnu.org id=B56646.165856055718934 (code B ref 56646); Sat, 23 Jul 2022 07:16:01 +0000 Received: (at 56646) by debbugs.gnu.org; 23 Jul 2022 07:15:57 +0000 Received: from localhost ([127.0.0.1]:43129 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oF9Mi-0004vK-UU for submit@debbugs.gnu.org; Sat, 23 Jul 2022 03:15:57 -0400 Received: from quimby.gnus.org ([95.216.78.240]:47696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oF9Mh-0004v5-7H for 56646@debbugs.gnu.org; Sat, 23 Jul 2022 03:15:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=RlCUya1erFiyyHbDNMNrXJ0vMabxOmuvJKUXTO52OTc=; b=Job9TpE0WSWFJL3OPDjxlQJKeF SMoE96tNGXjur6pPf05NFnm9YjMNNTGERwXZrV+SJEiI6uQhA+OYij8VkaaCmbGtEYX3N0U5A7XHy SNH16K4trH+jcC4562Brt4LcOORlT0qZK4t80N9degicg4YxpQDrRqKPYwfInLSmQB/0=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oF9MY-00088z-Ry; Sat, 23 Jul 2022 09:15:49 +0200 From: Lars Ingebrigtsen In-Reply-To: <877d49cb9a.fsf@gmail.com> (Visuwesh's message of "Tue, 19 Jul 2022 22:04:09 +0530") References: <877d49cb9a.fsf@gmail.com> X-Now-Playing: Boris's _COSMOS Re-Master + Live_: "Cosmos Part 2" Date: Sat, 23 Jul 2022 09:15:46 +0200 Message-ID: <87fsis47vh.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.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 @@CONTACT_ADDRESS@@ for details. Content preview: Visuwesh writes: > which is not so helpful. Attached patch adds a new user option to turn > off this deletion so you may get... > > >>> bar(foo()| > > instead, which, IMHO, is more useful. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) 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 (---) Visuwesh writes: > which is not so helpful. Attached patch adds a new user option to turn > off this deletion so you may get... > > >>> bar(foo()| > > instead, which, IMHO, is more useful. Makes sense to me. Pushed to Emacs 29. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 23 03:16:02 2022 Received: (at control) by debbugs.gnu.org; 23 Jul 2022 07:16:02 +0000 Received: from localhost ([127.0.0.1]:43133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oF9Mo-0004vu-6H for submit@debbugs.gnu.org; Sat, 23 Jul 2022 03:16:02 -0400 Received: from quimby.gnus.org ([95.216.78.240]:47710) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oF9Ml-0004v9-2m for control@debbugs.gnu.org; Sat, 23 Jul 2022 03:15:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7bMwdHg0HSlpQzN2KfN5eAzp1qSkyQQVzfzee4uXb78=; b=tTgllHMcqWLB/hZFdAY5bng9AT b8GnzWKvSnqEfZ146+vGKLQBFJx3k1wGLC/gBeyqMzrNtWLgjvQCeWw5YGmgIV7h9Q6UY1f0Ukxqm ddiIAWLhUElGz/d9sbarDLMGoGWW0kCDL9fy+T7nGkzPRpwlrWU3t355TMmbCniiOZ+U=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oF9Md-000899-DT for control@debbugs.gnu.org; Sat, 23 Jul 2022 09:15:53 +0200 Date: Sat, 23 Jul 2022 09:15:51 +0200 Message-Id: <87edyc47vc.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #56646 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.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 @@CONTACT_ADDRESS@@ for details. Content preview: close 56646 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control 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 (---) close 56646 29.1 quit