From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 03 09:43:33 2018 Received: (at submit) by debbugs.gnu.org; 3 Apr 2018 13:43:33 +0000 Received: from localhost ([127.0.0.1]:36026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3MDl-0002Tv-MW for submit@debbugs.gnu.org; Tue, 03 Apr 2018 09:43:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3MDj-0002Ti-Gj for submit@debbugs.gnu.org; Tue, 03 Apr 2018 09:43:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3MDd-0000Jg-C6 for submit@debbugs.gnu.org; Tue, 03 Apr 2018 09:43:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:40822) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f3MDd-0000Ja-8V for submit@debbugs.gnu.org; Tue, 03 Apr 2018 09:43:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3MDa-0008K2-7Y for bug-gnu-emacs@gnu.org; Tue, 03 Apr 2018 09:43:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3MDW-0000HR-UR for bug-gnu-emacs@gnu.org; Tue, 03 Apr 2018 09:43:22 -0400 Received: from colin.muc.de ([193.149.48.1]:46727 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1f3MDW-0000Gr-Ig for bug-gnu-emacs@gnu.org; Tue, 03 Apr 2018 09:43:18 -0400 Received: (qmail 30814 invoked by uid 3782); 3 Apr 2018 13:43:16 -0000 Received: from acm.muc.de (p5B147293.dip0.t-ipconnect.de [91.20.114.147]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 03 Apr 2018 15:43:16 +0200 Received: (qmail 7691 invoked by uid 1000); 3 Apr 2018 13:42:46 -0000 Date: Tue, 3 Apr 2018 13:42:46 +0000 To: bug-gnu-emacs@gnu.org Subject: Emacs 27. Inserting a character doesn't always "deactivate" the mark. Message-ID: <20180403134246.GA5363@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.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: -4.4 (----) Hello, Emacs. In master, evaluate the following definition: (defun no-deactivate-mark-bug (arg) (interactive "P") (transient-mark-mode 1) (set-mark (point)) (forward-char) (let ((inhibit-modification-hooks arg)) (insert "a")) (message "deactivate-mark is %s" deactivate-mark)) . In a non-empty buffer, with point not at end of buffer, do M-x no-deactivate-mark-bug . The character "a" will have been inserted, the region will not be "active", and the message in the message area will confirm that deactivate-mark had been set to t. This is as it should be. Now do C-u M-x no-deactivate-mark-bug . This time, after the insertion of "a", the region WILL spuriously be "active", and the message will indicate that deactivate-mark was still nil. This is a bug. I found this bug whilst integrating the new combine-change-calls macro into Emacs. What triggers this bug is inhibit-modification-hooks being non-nil. The place where the bug is is in prepare_to_modify_buffer_1 in .../src/insdel.c. The test there of inhibit_modification_hooks rudely exits before setting deactivate-mark to t. A patch which fixes this (still not tidied up; it's left as simple as possible to read) is: diff --git a/src/insdel.c b/src/insdel.c index 173c243834..1f45ccd28a 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1951,9 +1951,10 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, else base_buffer = current_buffer; - if (inhibit_modification_hooks) - return; - + /* if (inhibit_modification_hooks) */ + /* return; */ + if (!inhibit_modification_hooks) + { if (!NILP (BVAR (base_buffer, file_truename)) /* Make binding buffer-file-name to nil effective. */ && !NILP (BVAR (base_buffer, filename)) @@ -1973,6 +1974,7 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end, = call1 (Fsymbol_value (Qregion_extract_function), Qnil); signal_before_change (start, end, preserve_ptr); + } Fset (Qdeactivate_mark, Qt); } On a related note, it appears that in the same function, the file locking is done for the first change in a buffer. This locking would appear not to be done if that first change to the buffer happens when inhibit-modification-hooks is non-nil. I haven't tested this, but it would appear to be part of the same bug. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 03 10:08:02 2018 Received: (at 31042) by debbugs.gnu.org; 3 Apr 2018 14:08:02 +0000 Received: from localhost ([127.0.0.1]:37138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3MbS-0003L2-3C for submit@debbugs.gnu.org; Tue, 03 Apr 2018 10:08:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3MbQ-0003KZ-V2 for 31042@debbugs.gnu.org; Tue, 03 Apr 2018 10:08:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3MbI-0007no-N1 for 31042@debbugs.gnu.org; Tue, 03 Apr 2018 10:07:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3MbI-0007ni-JJ; Tue, 03 Apr 2018 10:07:52 -0400 Received: from [176.228.60.248] (port=2758 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f3MbI-0002eQ-2j; Tue, 03 Apr 2018 10:07:52 -0400 Date: Tue, 03 Apr 2018 17:08:00 +0300 Message-Id: <831sfw5qnz.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-reply-to: <20180403134246.GA5363@ACM> (message from Alan Mackenzie on Tue, 3 Apr 2018 13:42:46 +0000) Subject: Re: bug#31042: Emacs 27. Inserting a character doesn't always "deactivate" the mark. References: <20180403134246.GA5363@ACM> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31042 Cc: 31042@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: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Date: Tue, 3 Apr 2018 13:42:46 +0000 > From: Alan Mackenzie > > On a related note, it appears that in the same function, the file > locking is done for the first change in a buffer. This locking would > appear not to be done if that first change to the buffer happens when > inhibit-modification-hooks is non-nil. I haven't tested this, but it > would appear to be part of the same bug. This is a feature, see the doc string of inhibit-modification-hooks. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 03 10:39:49 2018 Received: (at 31042) by debbugs.gnu.org; 3 Apr 2018 14:39:49 +0000 Received: from localhost ([127.0.0.1]:37193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3N6C-00064C-So for submit@debbugs.gnu.org; Tue, 03 Apr 2018 10:39:49 -0400 Received: from colin.muc.de ([193.149.48.1]:37406 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1f3N68-000641-UP for 31042@debbugs.gnu.org; Tue, 03 Apr 2018 10:39:45 -0400 Received: (qmail 63805 invoked by uid 3782); 3 Apr 2018 14:39:43 -0000 Received: from acm.muc.de (p5B147293.dip0.t-ipconnect.de [91.20.114.147]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 03 Apr 2018 16:39:42 +0200 Received: (qmail 8263 invoked by uid 1000); 3 Apr 2018 14:39:12 -0000 Date: Tue, 3 Apr 2018 14:39:12 +0000 To: Eli Zaretskii Subject: Re: bug#31042: Emacs 27. Inserting a character doesn't always "deactivate" the mark. Message-ID: <20180403143911.GB5363@ACM> References: <20180403134246.GA5363@ACM> <831sfw5qnz.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <831sfw5qnz.fsf@gnu.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 31042 Cc: 31042@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.0 (/) Hello, Eli. On Tue, Apr 03, 2018 at 17:08:00 +0300, Eli Zaretskii wrote: > > Date: Tue, 3 Apr 2018 13:42:46 +0000 > > From: Alan Mackenzie > > On a related note, it appears that in the same function, the file > > locking is done for the first change in a buffer. This locking would > > appear not to be done if that first change to the buffer happens when > > inhibit-modification-hooks is non-nil. I haven't tested this, but it > > would appear to be part of the same bug. > This is a feature, see the doc string of inhibit-modification-hooks. Yes, the whole thing is a feature. :-( I now see that inhibit-modification-hooks is a special purpose facility, only suited for applying text properties to the buffer. Perhaps it has other uses, too. It is most definitely not suitable for when "real" buffer modifications are done. For that, presumably, one needs to bind before/after-change-functions to nil, as used to be done before i-m-h was invented. I will need to modify the new combine-change-calls, which is no great hardship. How about me modifying the documentation and the doc string to point out the disadvantages of inhibit-modification-hooks when used for actual textual buffer changes? I will close this bug. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 03 11:12:04 2018 Received: (at 31042) by debbugs.gnu.org; 3 Apr 2018 15:12:04 +0000 Received: from localhost ([127.0.0.1]:37239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3NbQ-0006q3-7t for submit@debbugs.gnu.org; Tue, 03 Apr 2018 11:12:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3NbO-0006pZ-Sz for 31042@debbugs.gnu.org; Tue, 03 Apr 2018 11:12:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3NbF-0007wX-NK for 31042@debbugs.gnu.org; Tue, 03 Apr 2018 11:11:57 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3NbF-0007wR-Ie; Tue, 03 Apr 2018 11:11:53 -0400 Received: from [176.228.60.248] (port=2813 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1f3NbF-0003ky-08; Tue, 03 Apr 2018 11:11:53 -0400 Date: Tue, 03 Apr 2018 18:12:01 +0300 Message-Id: <83y3i4494u.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-reply-to: <20180403143911.GB5363@ACM> (message from Alan Mackenzie on Tue, 3 Apr 2018 14:39:12 +0000) Subject: Re: bug#31042: Emacs 27. Inserting a character doesn't always "deactivate" the mark. References: <20180403134246.GA5363@ACM> <831sfw5qnz.fsf@gnu.org> <20180403143911.GB5363@ACM> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 31042 Cc: 31042@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: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Date: Tue, 3 Apr 2018 14:39:12 +0000 > Cc: 31042@debbugs.gnu.org > From: Alan Mackenzie > > How about me modifying the documentation and the doc string to point out > the disadvantages of inhibit-modification-hooks when used for actual > textual buffer changes? This is stuff for the manual, not for the doc string, I think. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 03 11:37:08 2018 Received: (at control) by debbugs.gnu.org; 3 Apr 2018 15:37:08 +0000 Received: from localhost ([127.0.0.1]:37269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f3Nzd-0007RM-Eg for submit@debbugs.gnu.org; Tue, 03 Apr 2018 11:37:08 -0400 Received: from colin.muc.de ([193.149.48.1]:16922 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1f3Nzb-0007RE-Py for control@debbugs.gnu.org; Tue, 03 Apr 2018 11:37:04 -0400 Received: (qmail 594 invoked by uid 3782); 3 Apr 2018 15:37:02 -0000 Received: from acm.muc.de (p5B147293.dip0.t-ipconnect.de [91.20.114.147]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 03 Apr 2018 17:37:01 +0200 Received: (qmail 8837 invoked by uid 1000); 3 Apr 2018 15:36:31 -0000 Date: Tue, 3 Apr 2018 15:36:31 +0000 To: control@debbugs.gnu.org Subject: bug #31042: Emacs 27. Inserting a character doesn't always "deactivate" the mark. Message-ID: <20180403153631.GC5363@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de 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: -0.0 (/) tags 31042 + notabug close 31042 quit From unknown Sun Jun 22 07:49:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 02 May 2018 11:24:04 +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