From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70122: 29.3.50; transpose-regions can crash Emacs Date: Sat, 20 Apr 2024 10:50:35 +0300 Message-ID: <86a5loa2wk.fsf@gnu.org> References: <2318820.ElGaqSPkdT@gabor> <8400498.NyiUUSuA9g@gabor> <86il0lpn4a.fsf@gnu.org> <3286832.oiGErgHkdL@gabor> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25302"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70122@debbugs.gnu.org To: Braun =?UTF-8?Q?G=C3=A1bor?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 20 09:51:06 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ry5V4-0006QD-IX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Apr 2024 09:51:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ry5Um-0007Kc-Ag; Sat, 20 Apr 2024 03:50:48 -0400 Original-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 1ry5Ul-0007KS-Fm for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 03:50:47 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ry5Ul-000165-7N for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 03:50:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ry5Uz-0006dn-Nu for bug-gnu-emacs@gnu.org; Sat, 20 Apr 2024 03:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Apr 2024 07:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70122 X-GNU-PR-Package: emacs Original-Received: via spool by 70122-submit@debbugs.gnu.org id=B70122.171359946025519 (code B ref 70122); Sat, 20 Apr 2024 07:51:01 +0000 Original-Received: (at 70122) by debbugs.gnu.org; 20 Apr 2024 07:51:00 +0000 Original-Received: from localhost ([127.0.0.1]:34898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ry5Ux-0006dV-U2 for submit@debbugs.gnu.org; Sat, 20 Apr 2024 03:51:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ry5Uv-0006ca-KE for 70122@debbugs.gnu.org; Sat, 20 Apr 2024 03:50:58 -0400 Original-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 1ry5Ub-000151-O1; Sat, 20 Apr 2024 03:50:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=rlhDeX3SUmBJye402E4DAFdnBl7Iz1i/p7dIl8J1mo0=; b=j6NL6OCZejn6M75zkxbs 3H3Ma097SbYmlabUG8vJAvVS6HQZtpXyFUs3YunUoei+PA1ftBijfDVm8C3sbCnpu+rtv6L0FKgvt STDip8ZMQvmHE3A7ZsrqRinydaH10fsi8r9trQVT2h2Y1+faIBN7eh7qs9cV8BcBGZM0hCXbgexWu xGz6GlfV0XSuKS9CMPNRLIQGwMD8rYunAqGyHei8T8t/wO0FtdF0IhzjB3aWzladG3r0gcV14cxgF r+hNRA+kU46/xZHqZkbVVGiHx0GwoTsNlLZDANJAMDbOflaZtGSN9Pbn4eu5TRhlvkouRjQ6AqsZZ VEIbhdwhPVlqeQ==; In-Reply-To: <3286832.oiGErgHkdL@gabor> (message from Braun =?UTF-8?Q?G=C3=A1bor?= on Tue, 16 Apr 2024 16:26:46 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283718 Archived-At: > From: Braun Gábor > Cc: 70122@debbugs.gnu.org > Date: Tue, 16 Apr 2024 16:26:46 +0200 > > Hi Eli, > > > > The issue I was unable to solve is that the functions > > > set_text_properties_1 and graft_intervals_into_buffer > > > record text property changes in undo history, but this is > unwanted > > > here as transpose-regions handles undo history itself. > ... > > > > But this is not a new problem, right? The code called > > set_text_properties_1 and graft_intervals_into_buffer before the > > changes as well, and had the same effect on undo history. > Right? > > > > If this is something caused by these changes, could you please > explain > > the issue in more detail, with references to the relevant parts > of the > > code? > > I don't think it is a new problem, and the other branches have the > same problem. > > In detail, in all branches transpose-regions adds the undo entries > early for its changes (calls to record_change), > then during making the changes already recorded in undo history > calls functions adding additional undo entries > (set_text_properties_1, graft_intervals_into_buffer), > i.e. at a time when the buffer state and undo history does not > match. Luckily these entries are text property changes to a text > deleted immediately by the following entries, so their effects are > not visible, but this is due to the initial undo entries > recording change to a larger span of text than just the two > swapped regions. > > When not just the byte length but the character length of the > swapped regions are the same, the original code didn't change text > properties between the two regions, i.e., the text property > changes were restricted to the swapped regions, and hence > restricting the initial undo entries to these region worked. > > The new changes do make text property changes to the text between > the swapped regions additionally (as interval positions need > adjustment), which makes it harder for the undo entries, > and that's why I did what the other branches do. > > > All in all, the issue is not about correctness of code, but rather > cleanness of code: separate responsibilities: which part of the > code is responsible for (which) undo entries. Did you receive the copyright assignment form, and if so, did you fill and email it according to instructions? I'm waiting for the assignment paperwork to come to completion before installing these changes.