From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Undo complex command Date: Tue, 30 Mar 2021 01:09:25 +0200 Message-ID: <87sg4dblqy.fsf@web.de> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40135"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: scame , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 30 01:10:38 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lR11p-000AK4-7k for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Mar 2021 01:10:37 +0200 Original-Received: from localhost ([::1]:51826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lR11o-00012t-7K for ged-emacs-devel@m.gmane-mx.org; Mon, 29 Mar 2021 19:10:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lR10q-0000Az-0b for emacs-devel@gnu.org; Mon, 29 Mar 2021 19:09:36 -0400 Original-Received: from mout.web.de ([212.227.17.12]:37371) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lR10n-0000ZU-Bk for emacs-devel@gnu.org; Mon, 29 Mar 2021 19:09:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1617059367; bh=0ITW3dWNqGJBzFhQGTm9t11EOvv+zkrd2FTAC/KKUjI=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=XxgS0EhOUvhTLFhMh57pj+vB0x0I62Q1bTAU4BaLvbN+cTLr2Q0unDnQZIIFak5hG GOOsqg3b2HkbKv3m9U4KD/F7fGjMhogtmt2lcuHpsHBr96o5oSZGdCv7rPTHBmPKkm xIIghuI3hjYauyobUl7IFvfxs3LMxTQcCRSB0KGU= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([88.67.107.229]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MnpGi-1lxbjg3UQE-00pUzS; Tue, 30 Mar 2021 01:09:26 +0200 In-Reply-To: (Stefan Monnier's message of "Tue, 23 Mar 2021 09:55:42 -0400") X-Provags-ID: V03:K1:3+j7NJgGe+cAr9xqkmanQbTtIzgPIvL9qYeV8uSo1fN8rWSQdzl 7uz8npsrqeO08AARxK8HMz5Y2WrICF9MYRwa1NT2+lmNKQHq+BTMFRVpEWRwfBDePbiQZi7 uHqkBk0uYvdeKU72UiLCSC2hm665rNc3R++mDMfvBn1RiKnDUjy+sa3/WgkLA3zAX570pUr x9BSozzrrqo+QiinMVv4g== X-UI-Out-Filterresults: notjunk:1;V03:K0:qHOu827i2WU=:lic6U78qijLUUWlJ2RgKFw IvPZlKAE8Z6ZiYgB0rKrjXbCHdDqYe00WtO/dPUgrFbJn9jSwliYv3Q21useprsgJkgIOHhfU 8B8pvhsI2LHDM/d7IupCCqSF9tvDEZn0iWFdcEhD6z8RCNR4oADtRolyn5qxVXrBcgf/ztfNP 2HImYtvXc8VOKncM2bmJsZki29Uqx5YWU+NRz602+2x/4veLDTL2GwA4GVssofdlhMPQfeER9 Sesjru3gB5WfJ4G4c/DFK/LrMEqikz8+3jPj02ChK7ToXn+v6hCBGDEjpJgW8UAElZDLEF3Nb IM6HsV0G4RL/3ug9AuHliXa4g7dbJlF/3VCJH+UYJ+qDJN20kmvxcAzME/zGEyjFw+4Tj1mX5 uxMQSY8RQujsOPXY1U7Ulb2Zu9RBd9dadFbfVPnRX1MJva7X6A/Gx0HLJHSCzVnMmPm/JHU2o bh8jaostGONSG2rCtnRiAN7pIcQg7v3rhBoB+hlZ17aIMd5DVOs9ouYp3uPp8iKfpXiX4hLj/ i5n11gngArGmw8OrbGcdgasbgnl5gNDOfLTtragWSO+V7XulPl9RuX8lB07bn5o5mN0MufM4U GTCjRGOHZ4utcvzcZzQavNHrWOcFwN4sFo+teuFneFjDrCrYJme6/9wxPpu9hi2p/8knFRnGl TAF8l8CFUfhKFI5+IMJpKXcMeGUin89JitLhwgnYw0YUbC3vnrNYYc8yZGameSXzlQ65FrrcJ CerpGlFF+LBLsYij63uE9UCU5t7APseBZXE4kLLsPjQT9+bw9kJ3HjfdpOo4aShj7acEzGXy Received-SPF: pass client-ip=212.227.17.12; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267156 Archived-At: Stefan Monnier writes: > 1- copy the current `buffer-string` along with the `buffer-undo-list` to > a new buffer. > 2- save that buffer's content to a temp file. > 3- call undo in that temp buffer > 4- run a diff between the temp file and the current content of the temp buffer > 5- display it to the user > 6- if the user hits M-p (or something like that) you go back to 2. > 7- else you try to apply that diff to the main buffer's contents > (e.g. using diff-apply-hunk). "undo-tree.el" has implemented more or less that. It uses it to provide a way to display diffs for each change in the visualizer. I don't recall if has a separate command to diff with the current buffer state. Michael.