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#60467: 30.0.50; primitive-undo: Changes to be undone by function different from announced Date: Tue, 03 Jan 2023 21:49:01 -0500 Message-ID: References: <87o7ri74qv.fsf@localhost> <9bc9c69ac20a37ded741@heytings.org> <9bc9c69ac282c0148962@heytings.org> <87h6x9mgdv.fsf@localhost> <838rij23by.fsf@gnu.org> <83zgazznau.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16327"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 60467@debbugs.gnu.org, Alan Mackenzie , Eli Zaretskii , yantar92@posteo.net To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 04 03:50:19 2023 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 1pCtr8-0003yM-LY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Jan 2023 03:50:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCtqt-0002A9-Se; Tue, 03 Jan 2023 21:50:03 -0500 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 1pCtqs-00029m-Oj for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2023 21:50:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pCtqs-0001ev-Ca for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2023 21:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pCtqr-0004yk-Ut for bug-gnu-emacs@gnu.org; Tue, 03 Jan 2023 21:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Jan 2023 02:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60467 X-GNU-PR-Package: emacs Original-Received: via spool by 60467-submit@debbugs.gnu.org id=B60467.167280055519080 (code B ref 60467); Wed, 04 Jan 2023 02:50:01 +0000 Original-Received: (at 60467) by debbugs.gnu.org; 4 Jan 2023 02:49:15 +0000 Original-Received: from localhost ([127.0.0.1]:47219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCtq7-0004xf-0s for submit@debbugs.gnu.org; Tue, 03 Jan 2023 21:49:15 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:1940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCtq2-0004xN-Pb for 60467@debbugs.gnu.org; Tue, 03 Jan 2023 21:49:14 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 464DF806D4; Tue, 3 Jan 2023 21:49:05 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8B3798035A; Tue, 3 Jan 2023 21:49:03 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1672800543; bh=y1ZFaxkzeIo0XHnG15QlehJ8PK85lLPfGW2NcpSs0yM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=KrgxugRIFHT677qGBQ3y+XRH1PsN7gmKLjHUKYASsbjtnZpxPcZ5Mn4w0PUqWHuTq RpaPkTclpOAS8QO9RJruV3IcFI7VI2b/Mgq8K1xsUiQJvDMWz4G9Q1lM+PnTZhqhBp aONQuuZ1WgnfRH5+sOSf4XmRiutKYlIlzlVF8glc6TC/5SVVORLfanvmjG+AYjdse7 ZiD0ixdj4BronTYlzZckk2jM6e3IBGkHDGtTk5Uhx9GSk5bB29m5/dOjwuykq1PBqd UD4TAy5Znm6bslltudTX9gDNLcW2vHpR2dYLf5nvyrCuXJQO23ufraDsWsPla6d6fB bNKtY5SfYFm6A== Original-Received: from pastel (unknown [45.72.200.228]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 335121208FD; Tue, 3 Jan 2023 21:49:03 -0500 (EST) In-Reply-To: (Gregory Heytings's message of "Wed, 04 Jan 2023 00:16:39 +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:252445 Archived-At: >>>> I don't even understand what this is supposed to do. >>> Yet you happily threw it away :-( >> >> Because there are no such precautions elsewhere in the code, and the >> comment above ("In case garbage collection has removed OLD-BUL") does not >> explain what its purpose is. A few lines below, old-bul is used without >> such a precaution. Of course, if it has a purpose, it's okay to keep it. >> > > I didn't remember the main reason why I removed that (cdr ptr). The reason > is not only that the comment above it is wrong, but also that this (cdr ptr) > condition itself is wrong: it makes that loop stop when the last element of > the buffer-undo-list is reached. When buffer-undo-list is initially nil, > (funcall body) adds a number of entries in buffer-undo-list, and there is no > reason to exit that loop without processing its last element. I think for your loop you'd need to check `ptr` instead of (cdr ptr), indeed. For the loop currently in `subr.el` I think the (cdr ptr) is OK because we use the `setcdr` to truncate the list, so that last cons (whose `cdr` may be nil) will be in the list included in the (apply ....) entry. Stefan