From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: scame Newsgroups: gmane.emacs.devel Subject: Undo complex command Date: Tue, 23 Mar 2021 07:05:50 +0000 Message-ID: Reply-To: scame Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10684"; mail-complaints-to="usenet@ciao.gmane.io" To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 23 08:07:12 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 1lOb8B-0002Ym-P7 for ged-emacs-devel@m.gmane-mx.org; Tue, 23 Mar 2021 08:07:11 +0100 Original-Received: from localhost ([::1]:57064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOb8A-00048U-Q9 for ged-emacs-devel@m.gmane-mx.org; Tue, 23 Mar 2021 03:07:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOb7B-0003hv-13 for emacs-devel@gnu.org; Tue, 23 Mar 2021 03:06:09 -0400 Original-Received: from mail-40141.protonmail.ch ([185.70.40.141]:20365) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOb77-0001jJ-OR for emacs-devel@gnu.org; Tue, 23 Mar 2021 03:06:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1616483162; bh=0aesAaPDvUmWY/Fy8zu896dv+Nv5eAleB6fKlHoiPx4=; h=Date:To:From:Reply-To:Subject:From; b=tK/8XX64jKA2vd5UgCUZ1S3fsriE8pdAK4VdV9WcZuhIRQUSgLrjOAOjNHb6WrP7c 5a9HNwNyrRd8Gskqn+uhTBaK6SPB3d++mbrdtAl86Q3OQVoACSA9VUhYw9lhfg0iJD lDAw+/hPDKxxd6oJD05CodUm2QOR4nPY2P9B2Wo8= Received-SPF: pass client-ip=185.70.40.141; envelope-from=laszlomail@protonmail.com; helo=mail-40141.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:266857 Archived-At: I use repeat complex command often (BTW, why doesn't the built in version have completion? It's much better that way.) and sometimes I want to undo them. Imagine I replaced foo with bar in the whole buffer. I do various other changes and then it occurs to me the foo/bar replacement was a mistake and I want to undo it. These words occur many times in the buffer, so it's not just a matter of selecting a region and undo that. What if after complex operations which change the buffer significantly (e.g. touching many lines or something) emacs stored the diff of the changes in memory? (With some limits, of course, e.g. number of past diffs stored, size limit, etc.) Then if I want to revert a particular change, I could say M-x undo-complex-change, select a command from the undo list and then I'd get its diff in a buffer and then I could revert any hunk or the whole diff altogether. (Like with regular diffs the diff can be applied as long as the text did not change significantly since then.) What do you think? Could it be a useful feature?