From unknown Sat Aug 09 09:31:59 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#45029 <45029@debbugs.gnu.org> To: bug#45029 <45029@debbugs.gnu.org> Subject: Status: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode Reply-To: bug#45029 <45029@debbugs.gnu.org> Date: Sat, 09 Aug 2025 16:31:59 +0000 retitle 45029 27.1.50; Regression: Yanking into externally modified file wi= th delete-selection-mode reassign 45029 emacs submitter 45029 Lars Ljung severity 45029 normal tag 45029 fixed confirmed thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 03 15:10:17 2020 Received: (at submit) by debbugs.gnu.org; 3 Dec 2020 20:10:17 +0000 Received: from localhost ([127.0.0.1]:41859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkuvh-0005HK-DD for submit@debbugs.gnu.org; Thu, 03 Dec 2020 15:10:17 -0500 Received: from lists.gnu.org ([209.51.188.17]:56366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkuvf-0005HC-BU for submit@debbugs.gnu.org; Thu, 03 Dec 2020 15:10:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkuvf-0002vk-6X for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 15:10:15 -0500 Received: from smtp-out3.simply.com ([94.231.106.210]:43499) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkuvc-0000O7-DL for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 15:10:14 -0500 Received: from localhost (localhost [127.0.0.1]) by smtp.simply.com (Simply.com) with ESMTP id 4Cn6Q61gPPz66FT for ; Thu, 3 Dec 2020 21:10:06 +0100 (CET) Received: from [192.168.1.203] (c-378ae253.01-381-73746f46.bbcust.telenor.se [83.226.138.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by smtp.simply.com (Simply.com) with ESMTPSA id 4Cn6Q60BJxz66F2 for ; Thu, 3 Dec 2020 21:10:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=matholka.se; s=unoeuro; t=1607026206; bh=l8Zdv3dhZfQe0Cg0LPdCwlIauStz4j5s6bTYGWHZD9Y=; h=To:From:Subject:Date; b=SwdRWwrwaZDn+8LOtInIpwrayB2Boi4CRnC1fu/akX08XZ25Wb9F3UM3js/NcMxLp +pWo4kY2PV927ZmA2/Fy5K93nw0w56Zrxw2sW66vrdwCYxPbPMebMoauWVc95KzVNn oyu6ngZx8KqZxQknlQG0SLBJXlyxFsgQaCoTwQok= To: bug-gnu-emacs@gnu.org From: Lars Ljung Subject: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode Message-ID: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> Date: Thu, 3 Dec 2020 21:10:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=94.231.106.210; envelope-from=lars@matholka.se; helo=smtp-out3.simply.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit 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.4 (--) Hi, I get an error when I do this, and the content of the buffer is completely replaced by a single "y". 1. Start with "emacs -Q" 2. M-x delete-selection-mode 3. Open some text file (fundamental mode) 4. Modify the file externally 5. While a selection is active, yank some text 6. Answer yes to the question " changed on disk..." The content of the buffer is now completely replaced by a single "y". The message "No catch for tag: exit, nil" is shown in the minibuffer. I can't reproduce this on Emacs 26.3. Kind regards, Lars Ljung From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 04 05:18:42 2020 Received: (at 45029) by debbugs.gnu.org; 4 Dec 2020 10:18:42 +0000 Received: from localhost ([127.0.0.1]:42894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl8Ak-00070N-Aa for submit@debbugs.gnu.org; Fri, 04 Dec 2020 05:18:42 -0500 Received: from quimby.gnus.org ([95.216.78.240]:56804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl8Aj-000705-4j for 45029@debbugs.gnu.org; Fri, 04 Dec 2020 05:18:41 -0500 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:In-Reply-To:Date: References: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=uH6l8oQY/eJD15PFnY/HOxZ26seJ79UjM9tNKallygY=; b=GqtKxpqMGNWaG1xz56V6XX5XrZ ymWumEoU76XaDN7BBPsi0lozJfqI7eN0Ks5xg4870kxcnIMC4EEpWy0rcHlI9i1oUVjD6r55YqtjU koN7ZLJFwgRUlSAML/imszr/Aiq8LAk2PrYfXUvPRss1JUXRY2wZtNd2I4ffjQ6i8e8Q=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kl8AY-0007Dd-EZ; Fri, 04 Dec 2020 11:18:35 +0100 From: Lars Ingebrigtsen To: Lars Ljung Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> X-Now-Playing: Fennesz's _Agora_: "Rainfall" Date: Fri, 04 Dec 2020 11:18:29 +0100 In-Reply-To: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> (Lars Ljung's message of "Thu, 3 Dec 2020 21:10:05 +0100") Message-ID: <87360lnabu.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.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: Lars Ljung writes: > I get an error when I do this, and the content of the buffer is > completely replaced by a single "y". > > 1. Start with "emacs -Q" > 2. M-x delete-selection-mode > 3. Open some text file (fundament [...] 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: 0.0 (/) X-Debbugs-Envelope-To: 45029 Cc: 45029@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: -1.0 (-) Lars Ljung writes: > I get an error when I do this, and the content of the buffer is > completely replaced by a single "y". > > 1. Start with "emacs -Q" > 2. M-x delete-selection-mode > 3. Open some text file (fundamental mode) > 4. Modify the file externally > 5. While a selection is active, yank some text > 6. Answer yes to the question " changed on disk..." > > The content of the buffer is now completely replaced by a single "y". > The message "No catch for tag: exit, nil" is shown in the minibuffer. I can confirm that this bug is still present in Emacs 28. The backtrace is included below, if that helps anybody. Debugger entered--Lisp error: (no-catch exit nil) throw(exit nil) exit-minibuffer() read-char-from-minibuffer-insert-char() funcall-interactively(read-char-from-minibuffer-insert-char) call-interactively(read-char-from-minibuffer-insert-char nil nil) command-execute(read-char-from-minibuffer-insert-char) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 04 05:18:47 2020 Received: (at control) by debbugs.gnu.org; 4 Dec 2020 10:18:47 +0000 Received: from localhost ([127.0.0.1]:42897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl8Ap-00070e-Jg for submit@debbugs.gnu.org; Fri, 04 Dec 2020 05:18:47 -0500 Received: from quimby.gnus.org ([95.216.78.240]:56828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kl8Ao-00070G-8f for control@debbugs.gnu.org; Fri, 04 Dec 2020 05:18:47 -0500 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=CeRYyXc6kehTtZKmMeHii0P5ualjRvGg00H769WZz0E=; b=J00uPPz5DieJIR9pHX5ol9zEbb VIapLwcEAK8VUIqoEELokFf+mfQzI9p3BE6RZkhXayqZkq+6RNC1/iuAkAMvpAFVKyfdMPTd0F39j fzhIMB09k5Q5v32afRa6KtBM7qQHXsRnvtPnFXe0C/uMUsMOEm281qZgjggMkRuHVHdU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kl8Ag-0007Dp-IB for control@debbugs.gnu.org; Fri, 04 Dec 2020 11:18:40 +0100 Date: Fri, 04 Dec 2020 11:18:37 +0100 Message-Id: <871rg5nabm.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #45029 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: tags 45029 + confirmed 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: 0.0 (/) 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: -1.0 (-) tags 45029 + confirmed quit From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 05 06:32:16 2020 Received: (at 45029) by debbugs.gnu.org; 5 Dec 2020 11:32:16 +0000 Received: from localhost ([127.0.0.1]:46649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klVnU-0002fE-7n for submit@debbugs.gnu.org; Sat, 05 Dec 2020 06:32:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33380) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1klVnS-0002ez-E7 for 45029@debbugs.gnu.org; Sat, 05 Dec 2020 06:32:15 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44237) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klVnG-0006MM-Be; Sat, 05 Dec 2020 06:32:03 -0500 Received: from [176.228.60.248] (port=2472 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1klVnF-0003gl-0B; Sat, 05 Dec 2020 06:32:01 -0500 Date: Sat, 05 Dec 2020 13:31:45 +0200 Message-Id: <83a6uscwv2.fsf@gnu.org> From: Eli Zaretskii To: Lars Ingebrigtsen , Juri Linkov In-Reply-To: <87360lnabu.fsf@gnus.org> (message from Lars Ingebrigtsen on Fri, 04 Dec 2020 11:18:29 +0100) Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45029 Cc: lars@matholka.se, 45029@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 (---) > From: Lars Ingebrigtsen > Date: Fri, 04 Dec 2020 11:18:29 +0100 > Cc: 45029@debbugs.gnu.org > > Lars Ljung writes: > > > I get an error when I do this, and the content of the buffer is > > completely replaced by a single "y". > > > > 1. Start with "emacs -Q" > > 2. M-x delete-selection-mode > > 3. Open some text file (fundamental mode) > > 4. Modify the file externally > > 5. While a selection is active, yank some text > > 6. Answer yes to the question " changed on disk..." > > > > The content of the buffer is now completely replaced by a single "y". > > The message "No catch for tag: exit, nil" is shown in the minibuffer. > > I can confirm that this bug is still present in Emacs 28. > > The backtrace is included below, if that helps anybody. > > Debugger entered--Lisp error: (no-catch exit nil) > throw(exit nil) > exit-minibuffer() > read-char-from-minibuffer-insert-char() > funcall-interactively(read-char-from-minibuffer-insert-char) > call-interactively(read-char-from-minibuffer-insert-char nil nil) > command-execute(read-char-from-minibuffer-insert-char) I'm guessing this is some unintended consequence of replacing read-char-choice in userlock.el with read-char-from-minibuffer. Juri, could you please look into this regression in Emacs 27? I'd like to try to fix this for 27.2. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 05 14:53:24 2020 Received: (at 45029) by debbugs.gnu.org; 5 Dec 2020 19:53:24 +0000 Received: from localhost ([127.0.0.1]:48278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kldcS-0002ps-1o for submit@debbugs.gnu.org; Sat, 05 Dec 2020 14:53:24 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:50311) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kldcQ-0002pe-Mm for 45029@debbugs.gnu.org; Sat, 05 Dec 2020 14:53:23 -0500 X-Originating-IP: 91.129.99.98 Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 7BD9C40005; Sat, 5 Dec 2020 19:53:13 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode Organization: LINKOV.NET References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> Date: Sat, 05 Dec 2020 21:42:10 +0200 In-Reply-To: <83a6uscwv2.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 Dec 2020 13:31:45 +0200") Message-ID: <87eek4gl3p.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45029 Cc: Lars Ingebrigtsen , lars@matholka.se, 45029@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: -1.0 (-) --=-=-= Content-Type: text/plain > I'm guessing this is some unintended consequence of replacing > read-char-choice in userlock.el with read-char-from-minibuffer. > > Juri, could you please look into this regression in Emacs 27? I'd > like to try to fix this for 27.2. Here is a brief trace that explains the cause of the problem: 1. C-y (yank) calls delete-selection-pre-hook from pre-command-hook 2. delete-selection-helper calls delete-active-region 3. this activates ask-user-about-supersession-threat on a modified file 4. it calls read-char-from-minibuffer ('this-command' is still 'yank') 5. read-char-from-minibuffer waits when user types 'y' (bound to the command 'read-char-from-minibuffer-insert-char') 6. after typing 'y', read-char-from-minibuffer returns 'y', but now 'this-command' is 'read-char-from-minibuffer-insert-char' 7. when delete-selection-pre-hook finishes, due to 'this-command' 'read-char-from-minibuffer-insert-char' is called again, and this time operates on the buffer as if it's the minibuffer It seems there is a fundamental problem when read-from-minibuffer is used from pre-command-hook it modifies the value of this-command. But I wonder why this problem doesn't occur in other places. Maybe other places doesn't try to operate on the buffer as on the minibuffer? Anyway, here is a patch with two fixes: 1. Guards read-char-from-minibuffer-insert-char against inadvertent operating on the non-minibuffer buffer; 2. Prevents read-char-from-minibuffer from changing the value of 'this-command' by read-from-minibuffer: --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=protect-this-command.patch Content-Transfer-Encoding: 8bit diff --git a/lisp/subr.el b/lisp/subr.el index 4b75268c04..7f1450d4a2 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2745,20 +2746,22 @@ read-char-from-minibuffer-insert-char "Insert the character you type in the minibuffer and exit. Discard all previous input before inserting and exiting the minibuffer." (interactive) - (delete-minibuffer-contents) - (insert last-command-event) - (exit-minibuffer)) + (when (minibufferp) + (delete-minibuffer-contents) + (insert last-command-event) + (exit-minibuffer))) (defun read-char-from-minibuffer-insert-other () "Handle inserting of a character other than allowed. Display an error on trying to insert a disallowed character. Also discard all previous input in the minibuffer." (interactive) - (delete-minibuffer-contents) - (ding) - (discard-input) - (minibuffer-message "Wrong answer") - (sit-for 2)) + (when (minibufferp) + (delete-minibuffer-contents) + (ding) + (discard-input) + (minibuffer-message "Wrong answer") + (sit-for 2))) (defvar empty-history) @@ -2802,6 +2805,8 @@ read-char-from-minibuffer map read-char-from-minibuffer-map-hash) map)) read-char-from-minibuffer-map)) + ;; Protect this-command when called from pre-command-hook (bug#45029) + (this-command this-command) (result (read-from-minibuffer prompt nil map nil (or history 'empty-history))) @@ -2856,28 +2861,31 @@ y-or-n-p-insert-y "Insert the answer \"y\" and exit the minibuffer of `y-or-n-p'. Discard all previous input before inserting and exiting the minibuffer." (interactive) - (delete-minibuffer-contents) - (insert "y") - (exit-minibuffer)) + (when (minibufferp) + (delete-minibuffer-contents) + (insert "y") + (exit-minibuffer))) (defun y-or-n-p-insert-n () "Insert the answer \"n\" and exit the minibuffer of `y-or-n-p'. Discard all previous input before inserting and exiting the minibuffer." (interactive) - (delete-minibuffer-contents) - (insert "n") - (exit-minibuffer)) + (when (minibufferp) + (delete-minibuffer-contents) + (insert "n") + (exit-minibuffer))) (defun y-or-n-p-insert-other () "Handle inserting of other answers in the minibuffer of `y-or-n-p'. Display an error on trying to insert a disallowed character. Also discard all previous input in the minibuffer." (interactive) - (delete-minibuffer-contents) - (ding) - (discard-input) - (minibuffer-message "Please answer y or n") - (sit-for 2)) + (when (minibufferp) + (delete-minibuffer-contents) + (ding) + (discard-input) + (minibuffer-message "Please answer y or n") + (sit-for 2))) (defvar empty-history) @@ -2955,6 +2963,8 @@ y-or-n-p (let ((help-form msg)) ; lexically bound msg (help-form-show))))) map)) + ;; Protect this-command when called from pre-command-hook (bug#45029) + (this-command this-command) (str (read-from-minibuffer prompt nil keymap nil (or y-or-n-p-history-variable 'empty-history)))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 05 15:04:48 2020 Received: (at 45029) by debbugs.gnu.org; 5 Dec 2020 20:04:48 +0000 Received: from localhost ([127.0.0.1]:48306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kldnT-00038g-Vv for submit@debbugs.gnu.org; Sat, 05 Dec 2020 15:04:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kldnS-00038U-7l for 45029@debbugs.gnu.org; Sat, 05 Dec 2020 15:04:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50013) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kldnK-0001OP-W2; Sat, 05 Dec 2020 15:04:39 -0500 Received: from [176.228.60.248] (port=2772 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kldnK-00075T-Bb; Sat, 05 Dec 2020 15:04:38 -0500 Date: Sat, 05 Dec 2020 22:04:23 +0200 Message-Id: <83pn3oauk8.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <87eek4gl3p.fsf@mail.linkov.net> (message from Juri Linkov on Sat, 05 Dec 2020 21:42:10 +0200) Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45029 Cc: larsi@gnus.org, lars@matholka.se, 45029@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 (---) > From: Juri Linkov > Cc: Lars Ingebrigtsen , lars@matholka.se, > 45029@debbugs.gnu.org > Date: Sat, 05 Dec 2020 21:42:10 +0200 > > Anyway, here is a patch with two fixes: > 1. Guards read-char-from-minibuffer-insert-char against inadvertent > operating on the non-minibuffer buffer; > 2. Prevents read-char-from-minibuffer from changing the value of > 'this-command' by read-from-minibuffer: Thanks! From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 06 16:16:21 2020 Received: (at 45029) by debbugs.gnu.org; 6 Dec 2020 21:16:21 +0000 Received: from localhost ([127.0.0.1]:51503 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km1OH-00036B-7E for submit@debbugs.gnu.org; Sun, 06 Dec 2020 16:16:21 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:33721) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km1OF-00035c-LQ; Sun, 06 Dec 2020 16:16:19 -0500 Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id E8960240002; Sun, 6 Dec 2020 21:16:10 +0000 (UTC) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode Organization: LINKOV.NET References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> Date: Sun, 06 Dec 2020 23:12:36 +0200 In-Reply-To: <87eek4gl3p.fsf@mail.linkov.net> (Juri Linkov's message of "Sat, 05 Dec 2020 21:42:10 +0200") Message-ID: <875z5e8wqj.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 45029 Cc: Lars Ingebrigtsen , lars@matholka.se, 45029@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: -1.7 (-) tags 45029 fixed close 45029 27.2 quit >> I'd like to try to fix this for 27.2. So I pushed the patch to master, and backported it to the emacs-27 branch (separate commits were needed to avoid merge conflicts). From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 06 22:27:49 2020 Received: (at 45029) by debbugs.gnu.org; 7 Dec 2020 03:27:50 +0000 Received: from localhost ([127.0.0.1]:51880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km7Bl-0003qb-KM for submit@debbugs.gnu.org; Sun, 06 Dec 2020 22:27:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54248) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1km7Bj-0003qP-Og for 45029@debbugs.gnu.org; Sun, 06 Dec 2020 22:27:48 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48268) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1km7Bc-0007TB-Fy; Sun, 06 Dec 2020 22:27:41 -0500 Received: from [176.228.60.248] (port=4276 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1km7Ba-0002SD-S1; Sun, 06 Dec 2020 22:27:40 -0500 Date: Mon, 07 Dec 2020 05:27:28 +0200 Message-Id: <83blf69ty7.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-Reply-To: <875z5e8wqj.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 06 Dec 2020 23:12:36 +0200) Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> <875z5e8wqj.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45029 Cc: larsi@gnus.org, lars@matholka.se, 45029@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 (---) > From: Juri Linkov > Cc: Lars Ingebrigtsen , lars@matholka.se, > 45029@debbugs.gnu.org > Date: Sun, 06 Dec 2020 23:12:36 +0200 > > >> I'd like to try to fix this for 27.2. > > So I pushed the patch to master, and backported it to the emacs-27 branch > (separate commits were needed to avoid merge conflicts). Thanks. From unknown Sat Aug 09 09:31:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 04 Jan 2021 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 13:58:36 2023 Received: (at control) by debbugs.gnu.org; 13 Sep 2023 17:58:36 +0000 Received: from localhost ([127.0.0.1]:35967 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgU8J-0000tH-US for submit@debbugs.gnu.org; Wed, 13 Sep 2023 13:58:36 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:37037) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgU8H-0000t4-OZ for control@debbugs.gnu.org; Wed, 13 Sep 2023 13:58:34 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AADD0805B2; Wed, 13 Sep 2023 13:58:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1694627901; bh=TJoAU7dysEnnQVehswLQa0fZVr+JduVgsaf4lH360bw=; h=From:To:Subject:In-Reply-To:References:Date:From; b=RkZ6OmRrUUxlCZ7KG3lLbxWhS3Y8WmFpMpC6AindP+fGL/So8KTzNRthAqbYs38IZ sXVjrlUkJLmjh7vdmhH+D8iQE39kmdkIbDuFuLn0o+UeVJJm7Lf35OljL9YUNXcbHU hLZdGn/8ncmsAykY7bD1hWC68vMz605ASHB9rXHN/ITd7o8y8L1bAZMW2eejvjYaz4 huJzvnJDQ20OS0ifwL8LNksCI/QQlZRQF7LdZH4uG7VKyBvZcofkO0WSqt1T/VkPZ7 vyLCnH/79kgwwGEp1aD11Na4i1iYtebro85MpyVWeMkQLqUgqu/K2HMpUFxmVYa+tU etD+2X/7yb9gw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 711248028B; Wed, 13 Sep 2023 13:58:21 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 553DB120193; Wed, 13 Sep 2023 13:58:21 -0400 (EDT) From: Stefan Monnier To: control@debbugs.gnu.org Subject: Re: Archived problem report bug#45029 (bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode) In-Reply-To: (GNU bug Tracking System's message of "Wed, 13 Sep 2023 17:39:01 +0000") Message-ID: References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> Date: Wed, 13 Sep 2023 13:57:11 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.099 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: 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 (---) unarchive 45029 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 14:01:19 2023 Received: (at 45029) by debbugs.gnu.org; 13 Sep 2023 18:01:19 +0000 Received: from localhost ([127.0.0.1]:35981 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgUAx-0003dz-3h for submit@debbugs.gnu.org; Wed, 13 Sep 2023 14:01:19 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgUAv-0003dm-7F for 45029@debbugs.gnu.org; Wed, 13 Sep 2023 14:01:17 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 82669441EB8; Wed, 13 Sep 2023 14:01:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1694628065; bh=DnE5mxWlchj/5dPicxcuitVpCuG4SJMwxyawd0cEYFI=; h=From:To:Subject:In-Reply-To:References:Date:From; b=RoFBUV+OizxNi0rYT5883AyJZvi45fQM3ZZMObVxQwOiZDBAfJhmiyHSltutGlmC4 NFkVRt+JCZ9xo/dhDIoxvMeMBXB7zoc9XXcf6lUAk+CX7z55G2E9WSq2l1vWkLMUYl CO0cs/R+kVb2AO4MmwyILaL0HmrBJGwtgN5SSA2pklguMMMpN1YohhBmMwDmb6v7RR 2MqzzjdpOhWHjzaQjPiKTR+oy1o25w1lIJFIKsiBIFZET78MV7UGoQ1eXqfnQvAEu5 67btJG9TEO3SmdOXQSeLFiODVcoQsbiD8DZuOCF2frlqKU0SSE0IsEx4zluzuHk+vO 37UxSgg6kxwLg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 23CDF441EA7; Wed, 13 Sep 2023 14:01:05 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 184321202E6; Wed, 13 Sep 2023 14:01:05 -0400 (EDT) From: Stefan Monnier To: 45029@debbugs.gnu.org Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode In-Reply-To: (Stefan Monnier's message of "Wed, 13 Sep 2023 13:36:54 -0400") Message-ID: References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> Date: Wed, 13 Sep 2023 13:59:55 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.116 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45029 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 (---) Stefan Monnier [2023-09-13 13:36:54] wrote: > Here is a brief trace that explains the cause of the problem: > > 1. C-y (yank) calls delete-selection-pre-hook from pre-command-hook > 2. delete-selection-helper calls delete-active-region > 3. this activates ask-user-about-supersession-threat on a modified file > 4. it calls read-char-from-minibuffer ('this-command' is still 'yank') > 5. read-char-from-minibuffer waits when user types 'y' > (bound to the command 'read-char-from-minibuffer-insert-char') > 6. after typing 'y', read-char-from-minibuffer returns 'y', but > now 'this-command' is 'read-char-from-minibuffer-insert-char' > 7. when delete-selection-pre-hook finishes, due to 'this-command' > 'read-char-from-minibuffer-insert-char' is called again, > and this time operates on the buffer as if it's the minibuffer Yuck! And thanks for the investigation. > Anyway, here is a patch with two fixes: > 1. Guards read-char-from-minibuffer-insert-char against inadvertent > operating on the non-minibuffer buffer; I suspect this will/would just hide a problem (such as the current one) under the rug. > 2. Prevents read-char-from-minibuffer from changing the value of > 'this-command' by read-from-minibuffer: Right, but I think that this needs to apply to all recursive edits rather than only `read-char-from-minibuffer`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 03:00:44 2023 Received: (at 45029) by debbugs.gnu.org; 14 Sep 2023 07:00:44 +0000 Received: from localhost ([127.0.0.1]:36653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qggLD-0006PE-NG for submit@debbugs.gnu.org; Thu, 14 Sep 2023 03:00:44 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:48499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qggL8-0006Op-NX for 45029@debbugs.gnu.org; Thu, 14 Sep 2023 03:00:41 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 1328CC000D; Thu, 14 Sep 2023 07:00:24 +0000 (UTC) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode In-Reply-To: (Stefan Monnier via's message of "Wed, 13 Sep 2023 13:59:55 -0400") Organization: LINKOV.NET References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> Date: Thu, 14 Sep 2023 09:39:48 +0300 Message-ID: <86zg1puupr.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 45029 Cc: 45029@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: -1.7 (-) >> Here is a brief trace that explains the cause of the problem: >> >> 1. C-y (yank) calls delete-selection-pre-hook from pre-command-hook >> 2. delete-selection-helper calls delete-active-region >> 3. this activates ask-user-about-supersession-threat on a modified file >> 4. it calls read-char-from-minibuffer ('this-command' is still 'yank') >> 5. read-char-from-minibuffer waits when user types 'y' >> (bound to the command 'read-char-from-minibuffer-insert-char') >> 6. after typing 'y', read-char-from-minibuffer returns 'y', but >> now 'this-command' is 'read-char-from-minibuffer-insert-char' >> 7. when delete-selection-pre-hook finishes, due to 'this-command' >> 'read-char-from-minibuffer-insert-char' is called again, >> and this time operates on the buffer as if it's the minibuffer > > Yuck! > And thanks for the investigation. > >> Anyway, here is a patch with two fixes: >> 1. Guards read-char-from-minibuffer-insert-char against inadvertent >> operating on the non-minibuffer buffer; > > I suspect this will/would just hide a problem (such as the current one) > under the rug. I admit this is a workaround, but I have no idea what would be a proper fix. >> 2. Prevents read-char-from-minibuffer from changing the value of >> 'this-command' by read-from-minibuffer: > > Right, but I think that this needs to apply to all recursive edits > rather than only `read-char-from-minibuffer`. I tried to test recursive commands at the read-char-from-minibuffer's prompt, but can't reproduce the same problem. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 09:44:22 2023 Received: (at 45029) by debbugs.gnu.org; 14 Sep 2023 13:44:22 +0000 Received: from localhost ([127.0.0.1]:37998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgmdq-000658-AZ for submit@debbugs.gnu.org; Thu, 14 Sep 2023 09:44:22 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:22665) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgmdi-00064q-Jf for 45029@debbugs.gnu.org; Thu, 14 Sep 2023 09:44:21 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CDE6444095C; Thu, 14 Sep 2023 09:44:02 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1694699041; bh=/Njo0ztOBRMH4p+10u9fR/sfEEtaVPKXw4ctgJCXW5I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=awR8k/I3IIX5xK4LUHOiMa2JXwP1DD9csO1DugCw9QfNYGsF5ygefHEtWYaFB33yb 4HxrfMxHwZivbXcF/ESr+heykIx+WijLE4TlKFcoWKpjrEP3eOIfG8iPw7nF5o9ySY onG8OqZI8hG6Sks9ZKLrKKn70FEhNM++3QErA4pNVaB6wfdwhEcowt1lcUDsZzPzbB 3Hgd/bvhEySWUfn3feQYtZCybDF0odxQFeZ22nAMqqUTpyQhDdIKmeUzhK3ziexiWT YwfESbEggNxu/ocNpVlMwAZtQsTso41KwNUsSZEQCDiB+/wUsRWV4QJ5VfV9oOtyBF FB/EGKFh77Orw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 602374408C4; Thu, 14 Sep 2023 09:44:01 -0400 (EDT) Received: from pastel (unknown [104.247.229.91]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3F1551202AD; Thu, 14 Sep 2023 09:44:01 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode In-Reply-To: <86zg1puupr.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 14 Sep 2023 09:39:48 +0300") Message-ID: References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> <86zg1puupr.fsf@mail.linkov.net> Date: Thu, 14 Sep 2023 09:44:00 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45029 Cc: 45029@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 (---) >>> Anyway, here is a patch with two fixes: >>> 1. Guards read-char-from-minibuffer-insert-char against inadvertent >>> operating on the non-minibuffer buffer; >> I suspect this will/would just hide a problem (such as the current one) >> under the rug. > I admit this is a workaround, but I have no idea what would be a proper fix. The let-binding of `this-command` fixes the problem, doesn't it? >>> 2. Prevents read-char-from-minibuffer from changing the value of >>> 'this-command' by read-from-minibuffer: >> Right, but I think that this needs to apply to all recursive edits >> rather than only `read-char-from-minibuffer`. > I tried to test recursive commands at the read-char-from-minibuffer's > prompt, but can't reproduce the same problem. No, I mean other uses of a recursive edit from `pre-command-hook` would cause the same problem, so the let-binding should be placed deeper than in `read-char-from-minibuffer`, e.g. inside `recursive_edit_1`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 02:46:58 2023 Received: (at 45029) by debbugs.gnu.org; 15 Sep 2023 06:46:58 +0000 Received: from localhost ([127.0.0.1]:41877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh2bS-0005g0-0t for submit@debbugs.gnu.org; Fri, 15 Sep 2023 02:46:58 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:40211) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh2bO-0005fY-1W for 45029@debbugs.gnu.org; Fri, 15 Sep 2023 02:46:55 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 55FD3240009; Fri, 15 Sep 2023 06:46:39 +0000 (UTC) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode In-Reply-To: (Stefan Monnier's message of "Thu, 14 Sep 2023 09:44:00 -0400") Organization: LINKOV.NET References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> <86zg1puupr.fsf@mail.linkov.net> Date: Fri, 15 Sep 2023 09:36:12 +0300 Message-ID: <868r986k8n.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 45029 Cc: 45029@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: -1.7 (-) >>>> Anyway, here is a patch with two fixes: >>>> 1. Guards read-char-from-minibuffer-insert-char against inadvertent >>>> operating on the non-minibuffer buffer; >>> I suspect this will/would just hide a problem (such as the current one) >>> under the rug. >> I admit this is a workaround, but I have no idea what would be a proper fix. > > The let-binding of `this-command` fixes the problem, doesn't it? But might other uses of a recursive edit break it again? I guess `when (minibufferp)` can't be removed from `read-char-from-minibuffer-insert-other` until all cases below are fixed. >>>> 2. Prevents read-char-from-minibuffer from changing the value of >>>> 'this-command' by read-from-minibuffer: >>> Right, but I think that this needs to apply to all recursive edits >>> rather than only `read-char-from-minibuffer`. >> I tried to test recursive commands at the read-char-from-minibuffer's >> prompt, but can't reproduce the same problem. > > No, I mean other uses of a recursive edit from `pre-command-hook` would > cause the same problem, so the let-binding should be placed deeper than > in `read-char-from-minibuffer`, e.g. inside `recursive_edit_1`. I see, so this problem is more general and not specific to `read-char-from-minibuffer`? It would be nice to find a test case for other commands to confirm that a change in `recursive_edit_1` fixes them. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 09:17:32 2023 Received: (at 45029) by debbugs.gnu.org; 15 Sep 2023 13:17:32 +0000 Received: from localhost ([127.0.0.1]:42428 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh8hQ-00084C-BT for submit@debbugs.gnu.org; Fri, 15 Sep 2023 09:17:32 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh8hO-00083z-J1 for 45029@debbugs.gnu.org; Fri, 15 Sep 2023 09:17:31 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3E5144422BA; Fri, 15 Sep 2023 09:17:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1694783836; bh=XVqmSzLCCJLbiBxHuyUm5YF6GupU77GpL6ksAhb2boU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JtKdsXBwy2lcaI99HrdKKuD0fzf0VRWXK+wVtw+U8OlhKM7N+w+6+dEMjwWjWVDYE BFe4oLsy9XKlpnS7NlzzKG3AUIjC/Ez0hixw39p0vuR64kDV0NyuYeVp+jo1WTYKAQ dOexOIrj4gsxAyyh6b7KtfOMsOA7oL8LWTuiFhZ2ZzW8yNZq5hjR2uhRPYC7CXNnRV 0DotBY4jdSGO2fNm5vcDWmrt0/hrIhcAM9CCXVnVGf5+0byumyYxdrNeLovve5yjTW eaEjqfOucDdg5EZ14k2xJDws+qb6yxEjJnW5nrAHfmEU0NcxnANdLuzMtIa1/OPGZG r2PieDPRz2FKA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 913AA44010C; Fri, 15 Sep 2023 09:17:16 -0400 (EDT) Received: from pastel (unknown [104.247.237.102]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 710BA12027A; Fri, 15 Sep 2023 09:17:16 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode In-Reply-To: <868r986k8n.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 15 Sep 2023 09:36:12 +0300") Message-ID: References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> <86zg1puupr.fsf@mail.linkov.net> <868r986k8n.fsf@mail.linkov.net> Date: Fri, 15 Sep 2023 09:17:14 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45029 Cc: 45029@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 (---) >> The let-binding of `this-command` fixes the problem, doesn't it? > But might other uses of a recursive edit break it again? What do you mean by `it`? There's only one recursive edit associated with `read-char-from-minibuffer-insert-char`, so no definitely not that (unless the user binds (or somehow uses) that command in keymaps used in other recursive edits, of course). And AFAICT, the bug see is that `delete-selection-mode` ends up running a command (originally run inside a recursive edit) a second time. IOW it's not "recursive edit broke `read-char-from-minibuffer-insert-char`" but "recursive edit broke `delete-selection-mode`". This can/will cause problems with loads of commands, not just `read-char-from-minibuffer-insert-char`. So yes, other uses of recursive edits can break `delete-selection-mode` as well, but no amount of changing `read-char-from-minibuffer-insert-char` will hide the problem because those other uses will use other commands. OTOH, the let-binding of `this-command` should fix the problem once and for all uses of recursive edit *if* it's placed deep enough that it affects all recursive edits. > I guess `when (minibufferp)` can't be removed from > `read-char-from-minibuffer-insert-other` until all cases below > are fixed. I don't see the "cases below" you're referring to. > I see, so this problem is more general and not specific to > `read-char-from-minibuffer`? Exactly. Any recursive edit happening from the `pre-command-hook`. > It would be nice to find a test case for other commands to confirm > that a change in `recursive_edit_1` fixes them. Even without trying to reproduce the specific problem that caused this bug report, think of this scenario: - User causes COMMAND to be run. - `this-command` is thus set to COMMAND. - We run the `pre-command-hook`. - One of the functions on `pre-command-hook` use a recursive edit. - `this-command` is now set to whichever command was run last in the recursive edit, which is just plain wrong. I remember seeing places in the code where we try and circumvent this problem, but this bug report makes it clear what is the real source of the problem. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 12:07:08 2023 Received: (at 45029) by debbugs.gnu.org; 15 Sep 2023 16:07:08 +0000 Received: from localhost ([127.0.0.1]:44530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhBLY-0001ZV-Gk for submit@debbugs.gnu.org; Fri, 15 Sep 2023 12:07:08 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:50867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhBLW-0001Yw-FL for 45029@debbugs.gnu.org; Fri, 15 Sep 2023 12:07:07 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 86CFE20004; Fri, 15 Sep 2023 16:06:52 +0000 (UTC) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#45029: 27.1.50; Regression: Yanking into externally modified file with delete-selection-mode In-Reply-To: (Stefan Monnier's message of "Fri, 15 Sep 2023 09:17:14 -0400") Organization: LINKOV.NET References: <581f7e67-db12-ba3a-2354-de8061789861@matholka.se> <87360lnabu.fsf@gnus.org> <83a6uscwv2.fsf@gnu.org> <87eek4gl3p.fsf@mail.linkov.net> <86zg1puupr.fsf@mail.linkov.net> <868r986k8n.fsf@mail.linkov.net> Date: Fri, 15 Sep 2023 19:06:20 +0300 Message-ID: <86cyyjqwek.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 45029 Cc: 45029@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: -1.7 (-) >>> The let-binding of `this-command` fixes the problem, doesn't it? >> But might other uses of a recursive edit break it again? > > What do you mean by `it`? Thanks for explanations. I thought it is specific to `delete-selection-mode` and `read-char-from-minibuffer`. But since a combination of `pre-command-hook` and a recursive command is a general problem, and OTOH `read-char-from-minibuffer` is already safeguarded by the let-binding of `this-command`, so probably `when (minibufferp)` could be removed from `read-char-from-minibuffer-insert-other`. > OTOH, the let-binding of `this-command` should fix the problem once and > for all uses of recursive edit *if* it's placed deep enough that it > affects all recursive edits. Frankly speaking, I'm afraid of making such change at great depths ;-) From unknown Sat Aug 09 09:31:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 14 Oct 2023 11:24:08 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator