[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/recomplete 9bf8222e31 09/14: Fix undo-collapse macro, use
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/recomplete 9bf8222e31 09/14: Fix undo-collapse macro, use back-ported emacs 29.1 macro |
Date: |
Thu, 7 Jul 2022 12:02:21 -0400 (EDT) |
branch: elpa/recomplete
commit 9bf8222e31358184ee707130e17b09425720dd92
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Fix undo-collapse macro, use back-ported emacs 29.1 macro
No longer cancel when some of the operations fail.
---
recomplete.el | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/recomplete.el b/recomplete.el
index 932544c4a7..67b8ed8256 100644
--- a/recomplete.el
+++ b/recomplete.el
@@ -94,35 +94,32 @@ WHERE using FN-ADVICE temporarily added to FN-ORIG."
,@body)
(advice-remove ,fn-orig fn-advice-var))))
+;; Back-ported from emacs-29.1 (remove once older versions have beeen dropped).
+(defmacro recomplete--with-undo-amalgamate (&rest body)
+ "Like `progn' but perform BODY with amalgamated undo barriers.
-;; See: https://emacs.stackexchange.com/a/54412/2418
-(defmacro recomplete--with-undo-collapse (&rest body)
- "Like `progn' but perform BODY with undo collapsed."
+This allows multiple operations to be undone in a single step.
+When undo is disabled this behaves like `progn'."
(declare (indent 0) (debug t))
- (let
- (
- (handle (make-symbol "--change-group-handle--"))
- (success (make-symbol "--change-group-success--")))
+ (let ((handle (make-symbol "--change-group-handle--")))
`
(let
(
(,handle (prepare-change-group))
- ;; Don't truncate any undo data in the middle of this.
+ ;; Don't truncate any undo data in the middle of this,
+ ;; otherwise Emacs might truncate part of the resulting
+ ;; undo step: we want to mimic the behavior we'd get if the
+ ;; undo-boundaries were never added in the first place.
(undo-outer-limit nil)
(undo-limit most-positive-fixnum)
- (undo-strong-limit most-positive-fixnum)
- (,success nil))
+ (undo-strong-limit most-positive-fixnum))
(unwind-protect
(progn
(activate-change-group ,handle)
- (prog1 ,(macroexp-progn body)
- (setq ,success t)))
- (cond
- (,success
- (accept-change-group ,handle)
- (undo-amalgamate-change-group ,handle))
- (t
- (cancel-change-group ,handle)))))))
+ ,@body)
+ (progn
+ (accept-change-group ,handle)
+ (undo-amalgamate-change-group ,handle))))))
(defmacro recomplete--with-messages-as-list (message-list &rest body)
"Run BODY adding any message call to the MESSAGE-LIST list."
@@ -451,7 +448,7 @@ Argument CYCLE-OFFSET The offset for cycling words,
;; Without storing these in a list we get an unsightly flicker.
(recomplete--with-messages-as-list message-list
;; Needed in case the operation does multiple undo pushes.
- (recomplete--with-undo-collapse
+ (recomplete--with-undo-amalgamate
(apply (symbol-function fn-symbol) (list cycle-index
fn-cache))))))
(cond
- [nongnu] branch elpa/recomplete created (now 021ca9b047), ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 80361184ad 06/14: Cleanup: docstring width, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 8b794d1947 08/14: Cleanup: use defgroup, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 8de8362858 03/14: readme: minor update, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 9bf8222e31 09/14: Fix undo-collapse macro, use back-ported emacs 29.1 macro,
ELPA Syncer <=
- [nongnu] elpa/recomplete d0e61f19a2 01/14: Initial working version., ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete f831f61797 02/14: readme: add melpa link, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 802c85b02d 04/14: Replace cl-letf with advice macro, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete ef800da3ff 05/14: Cleanup: formatting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 9d64b65855 10/14: Cleanup: use window-body-width, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 28a7dbd533 11/14: readme: uncomment installation section, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 2b38ca25e3 12/14: Add optional argument to step onto the second item when completing, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 48432904b2 07/14: Cleanup: replace 'if' with 'cond', ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete d0d3809294 13/14: Cleanup: use brief SPDX license, ELPA Syncer, 2022/07/07
- [nongnu] elpa/recomplete 021ca9b047 14/14: Change URL to codeberg, ELPA Syncer, 2022/07/07