From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70077: An easier way to track buffer changes Date: Wed, 03 Apr 2024 08:45:59 -0400 Message-ID: References: <86frw8ewk9.fsf@gnu.org> <86cyrcdy80.fsf@gnu.org> <877chh8fjk.fsf@localhost> <87wmpfsv2y.fsf@localhost> <87ttkjspkq.fsf@localhost> <8734s2pqu0.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6568"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: casouri@gmail.com, 70077@debbugs.gnu.org, qhong@alum.mit.edu, frederic.bour@lakaban.net, joaotavora@gmail.com, mail@nicolasgoaziou.fr, acm@muc.de, Eli Zaretskii , stephen_leake@stephe-leake.org, alan.zimm@gmail.com, phillip.lord@russet.org.uk To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 03 14:47:17 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 1rs01M-0001Rm-Au for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Apr 2024 14:47:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rs018-00025J-Dv; Wed, 03 Apr 2024 08:47:02 -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 1rs016-00024m-Ee for bug-gnu-emacs@gnu.org; Wed, 03 Apr 2024 08:47:00 -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 1rs016-0001cI-5Z for bug-gnu-emacs@gnu.org; Wed, 03 Apr 2024 08:47:00 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rs019-0006cM-K0 for bug-gnu-emacs@gnu.org; Wed, 03 Apr 2024 08:47:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Apr 2024 12:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70077 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70077-submit@debbugs.gnu.org id=B70077.171214837725180 (code B ref 70077); Wed, 03 Apr 2024 12:47:03 +0000 Original-Received: (at 70077) by debbugs.gnu.org; 3 Apr 2024 12:46:17 +0000 Original-Received: from localhost ([127.0.0.1]:57321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rs00O-0006Y4-Gu for submit@debbugs.gnu.org; Wed, 03 Apr 2024 08:46:16 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:61231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rs00L-0006XE-K4 for 70077@debbugs.gnu.org; Wed, 03 Apr 2024 08:46:15 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id A1AAF44156E; Wed, 3 Apr 2024 08:46:02 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1712148361; bh=0NNAoRHup2M5HkdEB+wJIPY9juDlBcIMtAkJ8yVEbGM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=LbxrB7hPef1MTmf9S/9lTubFaUudpPAQInwqRwtUU3GKgXQGWREctXnq1Q6hbSImr VIyHVVFVxJnMqC32EurH5ZAF6iC3ErCNT4fVH1ZYg8y/xpHkzs0YEDg77KYDkeBgIE 45zhn0jOmckIXst2r/nF3nAGVh4e44FLxEOqTFlvAk3L3mcu49pggZFVCb8PuxBRWf L9hWh/RC9daVNzrT9Ftc1goOAHvHLKuPrraoA+nlsYRbXouyo3pIwhzf9MzS3RL021 cax0ZBvoBKbI9dSBJ2PmxyliQyeXFgXFWBUvkPLXt/lmS8Mrza6JJqDmcNy06S6qBS ZEMHj23u+12IA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5BE88441503; Wed, 3 Apr 2024 08:46:01 -0400 (EDT) Original-Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F35E9120828; Wed, 3 Apr 2024 08:46:00 -0400 (EDT) In-Reply-To: <8734s2pqu0.fsf@localhost> (Ihor Radchenko's message of "Wed, 03 Apr 2024 12:34:47 +0000") 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:282570 Archived-At: > I am not 100% where the O(N^2) is coming from. If you add N times 1 char to an (initially empty) string, the total cost of constructing the resulting N-char string is O(N=B2). > In any case, while I do see where the idea of over-expanding the region > comes from, it is not ideal for my use-case in Org mode - it is often > critical to know precise region where the change happened. The reported changes are precise (modulo the fact that they are combined): the over-expanded `track-changes--before-string` is trimmed to the actual changes when it gets moved to a "state" (that's done in `track-changes--clean-state`). Also, note that in 99% of the cases, a command performs only a single change (insertion or deletion), in which case there's no combining nor over-expansion before the signal gets called. Of course, approximation may still happen if you decide not to act immediately when the signal is sent. Stefan