From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 25 20:30:46 2021 Received: (at submit) by debbugs.gnu.org; 26 Dec 2021 01:30:46 +0000 Received: from localhost ([127.0.0.1]:40069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n1IN2-0005BV-8i for submit@debbugs.gnu.org; Sat, 25 Dec 2021 20:30:46 -0500 Received: from lists.gnu.org ([209.51.188.17]:45778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n1Htn-0004KQ-DB for submit@debbugs.gnu.org; Sat, 25 Dec 2021 20:00:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n1Htk-0001Xk-PE for bug-gnu-emacs@gnu.org; Sat, 25 Dec 2021 20:00:29 -0500 Received: from [2607:f8b0:4864:20::934] (port=44597 helo=mail-ua1-x934.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n1Htf-0002fc-IU for bug-gnu-emacs@gnu.org; Sat, 25 Dec 2021 20:00:26 -0500 Received: by mail-ua1-x934.google.com with SMTP id p2so20718022uad.11 for ; Sat, 25 Dec 2021 17:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=d+zON15S98ZuBXQ5qLsrfYGePnH3pySN9jDOrmbIGik=; b=l0O+zmrlnr3hiMutrzGBhqhDzUFjLXTkqJXMxReQrr9+tqVQQa5giqRBcmTIGiWDqv O62IlQn+FLe/h+3R1O4Cn4tP38yUmSujhVpN++Txb3dM0SNF+EPAbAQ7ihqE8xu7KRfA I3NBJj+6xEvh/CkZYJ6b3LD89VEtoBqiFuzpy/Z5ePkZOrMCkusloC77Qot+zio/GY5V N5PYJf0PzaQK0D3CSqORU4Dh4V5S2e/OW78qIH9O1AM7YSDvpHxR626C039iiZvCvmcS 6rbG5KPisINM8UHTRT47HFVPt5DacLNrtk3zxvH0bC0I9/MRCNgnHDtnvPxmFalDsrsb QwdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=d+zON15S98ZuBXQ5qLsrfYGePnH3pySN9jDOrmbIGik=; b=ezhNjJDccuMYuv8iQ9JHD4++wUYDK2TtGv16j4VDLXrPgmX+KXsgCXSqurM8MzUYuU M8aBDeOYwXLVyA4VFz6EtfdncXSri5/fG/hemR3RZ6AmgCdnXvjZ4NUKdC+9V84JX77D K513y0O9NVIfWHmAIxRE+p+/T4qrEXzO2fzALzeh1Bf0RYCOfNYtv63j9m3LFRybAiFT UbgGwGP9/TTbPxlxe9dFHAtm0cbuS/H50yOAft6IMANm/WCW01BqfiS1RpxpUj8/N7lu p4EBpOazuJY7RO7m6Z9znDAvuXRRNi7L8QRvA5SqrFm5gJCX19xHzHa4oaW4dm5KOHYu K5Vw== X-Gm-Message-State: AOAM531kkY6Qxkxr3sbE1yODcLjJMl9zUQoUSOYuOOgKcL0L0joEkXLo tysqGyB75ooVnNnnnLOor3+RuuvBQ3lcq7Dq3OCy+QujzeMTfDyW X-Google-Smtp-Source: ABdhPJxHtHnKQ/vv4yTdWZvYh+zK3U04bXYJ5aozik1GHIfZlynvl5hL9mu89R1q9CsgdvhJpM8WFKGtYvIrmIZJ+E8= X-Received: by 2002:ab0:3117:: with SMTP id e23mr3472631ual.38.1640480415390; Sat, 25 Dec 2021 17:00:15 -0800 (PST) MIME-Version: 1.0 From: Vladimir Panteleev Date: Sun, 26 Dec 2021 00:59:59 +0000 Message-ID: Subject: 27.2; `undo' causes `buffer-undo-list' to grow exponentially To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::934 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::934; envelope-from=thecybershadow@gmail.com; helo=mail-ua1-x934.google.com X-Spam_score_int: 17 X-Spam_score: 1.7 X-Spam_bar: + X-Spam_report: (1.7 / 5.0 requ) AC_FROM_MANY_DOTS=2.999, 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, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 25 Dec 2021 20:30:42 -0500 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 (--) Consider this Emacs Lisp script: --- (eval-when-compile (require 'cl-lib)) (with-current-buffer (get-buffer-create "undo-test") ;; First, insert 50 characters. ;; Place an undo boundary after every insertion. (cl-loop repeat 50 do (insert "x") (undo-boundary)) ;; Then, undo 50 times. ;; It doesn't matter if we use undo or undo-only. ;; We will only get into about 12 undos, ;; before the new exponentially-growing entries erase the old history. (cl-loop repeat 50 do (undo-only) (message "Length is now: %S" (length buffer-undo-list)))) --- When executed with `emacs --script test.el', I see the following output: --- Undo Length is now: 102 Undo Length is now: 104 Undo Length is now: 108 Undo Length is now: 116 Undo Length is now: 132 Undo Length is now: 164 Undo Length is now: 228 Undo Length is now: 356 Undo Length is now: 612 Undo Length is now: 1124 Undo Length is now: 2148 Undo Length is now: 4196 Undo Length is now: 8292 No further undo information --- As far as I can see, the undo (and undo-only) command causes buffer-undo-list to grow exponentially. This causes information about previous entries to eventually be displaced. N.B.: I noticed that upping gc-cons-threshold lets it do more undos, but it does not prevent the exponential growth issue. I think this is a bug by itself, but it's worth mentioning that this script is a reduced version of a different problem I'm seeing with the "No further undo information" message; the bug described here may or may not be the root cause of that bug. In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) of 2021-03-26 built on juergen Windowing system distributor 'The X.Org Foundation', version 11.0.12101002 System Description: Arch Linux Configured using: 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int --with-modules --with-cairo --with-harfbuzz 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP Important settings: value of $LC_TIME: en_DK.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 29 11:29:39 2021 Received: (at 52798) by debbugs.gnu.org; 29 Dec 2021 16:29:39 +0000 Received: from localhost ([127.0.0.1]:50081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2bpb-0008TC-2n for submit@debbugs.gnu.org; Wed, 29 Dec 2021 11:29:39 -0500 Received: from quimby.gnus.org ([95.216.78.240]:43518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2bpY-0008Sv-V6 for 52798@debbugs.gnu.org; Wed, 29 Dec 2021 11:29:37 -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=7/JPvC4SIg7LeEyOSSPLXkfU2eKlbSSEvIsuDIypxus=; b=k0t0ESPygOgCSrhQ9+uwAsWw3e A5v4RhfGkBE5yPh7R4yRnJgKp2fw+0r15P7dh4B47Phy6RbLN0XAFOGM1mbiqiAoFyDJ8UmYZe59C iGwSFKbNbscNRCq5b6a6Cji2PXf86cmOBlY0F7euiI/40NX851Z449IDYogdY0B1Cva4=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n2bpP-0007al-9j; Wed, 29 Dec 2021 17:29:29 +0100 From: Lars Ingebrigtsen To: Vladimir Panteleev Subject: Re: bug#52798: 27.2; `undo' causes `buffer-undo-list' to grow exponentially References: X-Now-Playing: Hot Chip's _Coming on Strong_: "Take Care" Date: Wed, 29 Dec 2021 17:29:26 +0100 In-Reply-To: (Vladimir Panteleev's message of "Sun, 26 Dec 2021 00:59:59 +0000") Message-ID: <87k0fn4bo9.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: Vladimir Panteleev writes: > As far as I can see, the undo (and undo-only) command causes > buffer-undo-list to grow exponentially. This causes information about > previous entries to eventually be displaced. 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: 52798 Cc: 52798@debbugs.gnu.org, Stefan Monnier 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 (---) Vladimir Panteleev writes: > As far as I can see, the undo (and undo-only) command causes > buffer-undo-list to grow exponentially. This causes information about > previous entries to eventually be displaced. I can reproduce this in Emacs 29, too. Perhaps Stefan has some comments; added to the CCs. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 29 11:29:46 2021 Received: (at control) by debbugs.gnu.org; 29 Dec 2021 16:29:46 +0000 Received: from localhost ([127.0.0.1]:50084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2bpi-0008Tc-8y for submit@debbugs.gnu.org; Wed, 29 Dec 2021 11:29:46 -0500 Received: from quimby.gnus.org ([95.216.78.240]:43532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2bpg-0008TD-9q for control@debbugs.gnu.org; Wed, 29 Dec 2021 11:29:44 -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=K6CxQuNpXPKu1hpbnkWg8O8m9ua3uvhJrRRIYuiWmNM=; b=tVPQ7FFcQ97AceNyKCDg+QMyIb FVgK3hmfuuufiQI3oOcKYL/Lu/SnjjOdzSGwAd0a/okMxewV4wZg61iIfN5dbO38w59RaP/KV3VBL Ngpqu5Cfro/2JNO0rfTuxXNJgzKsRaa6yHY5BrJ/gy3QqZN1X+fHCbc6lXmyi26QQLDQ=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n2bpY-0007at-FX for control@debbugs.gnu.org; Wed, 29 Dec 2021 17:29:38 +0100 Date: Wed, 29 Dec 2021 17:29:34 +0100 Message-Id: <87ilv74bo1.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #52798 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 52798 + 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: -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 (---) tags 52798 + confirmed quit From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 21 18:07:47 2022 Received: (at 52798) by debbugs.gnu.org; 21 Feb 2022 23:07:47 +0000 Received: from localhost ([127.0.0.1]:39393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMHmV-0005Cd-Bd for submit@debbugs.gnu.org; Mon, 21 Feb 2022 18:07:47 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:49934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nMHmS-0005CO-QP for 52798@debbugs.gnu.org; Mon, 21 Feb 2022 18:07:45 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9FD07805B1; Mon, 21 Feb 2022 18:07:38 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2E55D8030B; Mon, 21 Feb 2022 18:07:37 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1645484857; bh=U5T+i79JsDTR3BuKE0hdBgJPNEauwu+PoZ75yn30sm8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=ZwGsRAPCFZPKcvDo+Diy6IXGcThMd7eqevCkurq/+1/OlhxsKJpV01pwutowQNd1Q K9IbWY9yD2/s/hPu1Rr/yVZ8UFZwvEEp9/zE/tGW4TMuhOdyjLOfLeyi7uS14Qsk89 jyRZjPFq4jYEyFUYgalckWZ6ZT2tlavyb38MSkXrPExkg+N7wQpGusYSqzN6AOMixI htKCIGhmTpqki0N6xwsUHgIv4YmZ7vBCYBdz1lixLvnuWegq8Ibkhg81pYT60YwJKV sWSKehJm3jXFuc7CEiZ9Fix+gHIDImWdSP52x1Sc28fx4TN5y4ryjRVx68/EQErN4K qulNgU6k6hBoQ== Received: from pastel (unknown [45.72.197.68]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B4DCA120F02; Mon, 21 Feb 2022 18:07:36 -0500 (EST) From: Stefan Monnier To: Lars Ingebrigtsen Subject: Re: bug#52798: 27.2; `undo' causes `buffer-undo-list' to grow exponentially Message-ID: References: <87k0fn4bo9.fsf@gnus.org> Date: Mon, 21 Feb 2022 18:07:35 -0500 In-Reply-To: <87k0fn4bo9.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 29 Dec 2021 17:29:26 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) 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.059 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 T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 52798 Cc: Vladimir Panteleev , 52798@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 (---) Lars Ingebrigtsen [2021-12-29 17:29:26] wrote: > Vladimir Panteleev writes: >> As far as I can see, the undo (and undo-only) command causes >> buffer-undo-list to grow exponentially. This causes information about >> previous entries to eventually be displaced. > I can reproduce this in Emacs 29, too. Yes, it's a known problem (tho it should be much less of a problem with `undo-only`, IIRC). > Perhaps Stefan has some comments; added to the CCs. I'm sure we can do better. The info about which parts can be skipped should be available in `undo-equiv-table` but someone needs to sit down and think about how and when we can use it. Stefan