[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/goto-chg 4c32adf 03/27: Handle undo-tree-mode
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/goto-chg 4c32adf 03/27: Handle undo-tree-mode |
Date: |
Sun, 1 Aug 2021 18:32:57 -0400 (EDT) |
branch: elpa/goto-chg
commit 4c32adf65aaef21b215eb6e5585b31700b51e2d9
Author: Vasilij Schneidermann <mail@vasilij.de>
Commit: Vasilij Schneidermann <mail@vasilij.de>
Handle undo-tree-mode
Code adapted from https://github.com/martinp26/goto-chg
---
goto-chg.el | 51 ++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 11 deletions(-)
diff --git a/goto-chg.el b/goto-chg.el
index 71e5501..7defb0c 100644
--- a/goto-chg.el
+++ b/goto-chg.el
@@ -251,7 +251,9 @@ discarded. See variable `undo-limit'."
(n 0) ; Steps in undo list (length of 'rev')
(l buffer-undo-list)
(passed-save-entry (not (buffer-modified-p)))
- (new-probe-depth glc-probe-depth))
+ (new-probe-depth glc-probe-depth)
+ (undo-tree-p (bound-and-true-p undo-tree-mode))
+ glc-seen-canary)
;; Walk back and forth in the buffer-undo-list, each time one step deeper,
;; until we can walk back the whole list with a 'pos' that is not coming
;; too close to another edit.
@@ -268,16 +270,43 @@ discarded. See variable `undo-limit'."
(message "working..."))
;; Walk forward in buffer-undo-list, glc-probe-depth steps.
;; Build reverse list along the way
- (while (< n new-probe-depth)
- (cond ((null l)
- ;(setq this-command t) ; Disrupt repeat sequence
- (error "No further change info"))
- ((glc-is-positionable (car l))
- (setq n (1+ n)
- rev (cons (car l) rev)))
- ((or passed-save-entry (glc-is-filetime (car l)))
- (setq passed-save-entry t)))
- (setq l (cdr l)))
+ (if (not undo-tree-p)
+ (while (< n new-probe-depth)
+ (cond ((null l)
+ ;(setq this-command t) ; Disrupt repeat sequence
+ (error "No further change info"))
+ ((glc-is-positionable (car l))
+ (setq n (1+ n)
+ rev (cons (car l) rev)))
+ ((or passed-save-entry (glc-is-filetime (car l)))
+ (setq passed-save-entry t)))
+ (setq l (cdr l)))
+ (when (not glc-seen-canary)
+ (while (and (not (null l)) (not glc-seen-canary) (< n
new-probe-depth))
+ (cond ((eq 'undo-tree-canary (car l)) ; used by buffer-undo-tree
+ (message "Canary found...")
+ (setq l (undo-tree-current buffer-undo-tree)
+ glc-seen-canary t))
+ ((glc-is-positionable (car l))
+ (setq n (1+ n)
+ rev (cons (car l) rev)))
+ ((or passed-save-entry (glc-is-filetime (car l)))
+ (setq passed-save-entry t)))
+ (when (not glc-seen-canary)
+ (setq l (cdr l)))))
+ (when glc-seen-canary
+ (while (< n new-probe-depth)
+ (cond ((null l)
+ ;(setq this-command t) ; Disrupt repeat sequence
+ (error "No further change info"))
+ ((glc-is-positionable (car (undo-tree-node-undo l)))
+ (setq n (1+ n)
+ rev (cons (car (undo-tree-node-undo l)) rev)))
+ ((or passed-save-entry (glc-is-filetime (car
(undo-tree-node-undo l))))
+ (setq passed-save-entry t)))
+ (setq l (undo-tree-node-previous l))))
+ (when (null l)
+ (error "No further change info")))
;; Walk back in reverse list, from older to newer edits.
;; Adjusting pos along the way.
(setq pos (glc-adjust-list rev)))
- [nongnu] branch elpa/goto-chg created (now 3ce1389), Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 4c32adf 03/27: Handle undo-tree-mode,
Philip Kaludercic <=
- [nongnu] elpa/goto-chg ab85086 12/27: Transfer undo-list to -tree before using undo-tree, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 171b133 04/27: Bump version, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg ea9adb4 11/27: Check correctly for no changes, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 345be45 17/27: Merge pull request #2 from WillQu/patch-1, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg dc946f5 01/27: Check in latest wiki version, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg bfc4200 10/27: Correct FSF address, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 37aafae 14/27: add a space, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 16a63aa 16/27: Bump version, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 5c057c8 22/27: Turn undo-tree into a soft dependency, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 494cfa1 02/27: Clean up whitespace, Philip Kaludercic, 2021/08/01