[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/goto-chg 85fca9f 21/27: Terrible hack to deal with `combin
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/goto-chg 85fca9f 21/27: Terrible hack to deal with `combine-change-calls` |
Date: |
Sun, 1 Aug 2021 18:33:01 -0400 (EDT) |
branch: elpa/goto-chg
commit 85fca9f7d8b04be3fbb37cc5d42416f3c4d32830
Author: Vasilij Schneidermann <mail@vasilij.de>
Commit: Vasilij Schneidermann <mail@vasilij.de>
Terrible hack to deal with `combine-change-calls`
Closes #8
---
goto-chg.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/goto-chg.el b/goto-chg.el
index 36f47c0..c912c71 100644
--- a/goto-chg.el
+++ b/goto-chg.el
@@ -107,6 +107,19 @@
;;todo: Find begin and end of line, then use it somewhere
+(defun glc-fixup-edit (e)
+ "Convert an Emacs 27.1-style combined change to a regular edit."
+ (when (and (consp e)
+ (eq (car e) 'apply)
+ (not (functionp (cadr e)))
+ (eq (nth 4 e) 'undo--wrap-and-run-primitive-undo))
+ (let ((args (last e)))
+ (when (and (consp args) (= (length args) 1)
+ (consp (car args)) (= (length (car args)) 1)
+ (consp (caar args)) (numberp (car (caar args))) (numberp (cdr
(caar args))))
+ (setq e (caar args)))))
+ e)
+
(defun glc-center-ellipsis (str maxlen &optional ellipsis)
"Truncate STRING in the middle to length MAXLEN.
If STRING is max MAXLEN just return the string.
@@ -141,6 +154,7 @@ Exception: return nil if POS is closer than
`glc-current-span' to the edit E.
\nInsertion edits before POS returns a larger value.
Deletion edits before POS returns a smaller value.
\nThe edit E is an entry from the `buffer-undo-list'. See for details."
+ (setq e (glc-fixup-edit e))
(cond ((atom e) ; nil==cmd boundary, or, num==changed
pos
pos)
((numberp (car e)) ; (beg . end)==insertion
@@ -176,6 +190,7 @@ or nil if the point was closer than `glc-current-span' to
some edit in R.
"If E represents an edit, return a position value in E, the position
where the edit took place. Return nil if E represents no real change.
\nE is an entry in the buffer-undo-list."
+ (setq e (glc-fixup-edit e))
(cond ((numberp e) e) ; num==changed position
((atom e) nil) ; nil==command boundary
((numberp (car e)) (cdr e)) ; (beg . end)==insertion
@@ -188,6 +203,7 @@ where the edit took place. Return nil if E represents no
real change.
"If E represents an edit, return a short string describing E.
Return nil if E represents no real change.
\nE is an entry in the buffer-undo-list."
+ (setq e (glc-fixup-edit e))
(let ((nn (or (format "T-%d: " n) "")))
(cond ((numberp e) "New position") ; num==changed position
((atom e) nil) ; nil==command boundary
- [nongnu] elpa/goto-chg dc946f5 01/27: Check in latest wiki version, (continued)
- [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
- [nongnu] elpa/goto-chg 81fca94 05/27: Add maintainer line, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg aa88ef0 06/27: Fix byte-compiler warnings, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg c664d87 13/27: Ensure undo-tree-node is actually a -node, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 1829a13 19/27: Replace undo-tree hacks by making it a dependency, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 85fca9f 21/27: Terrible hack to deal with `combine-change-calls`,
Philip Kaludercic <=
- [nongnu] elpa/goto-chg 304e46a 26/27: Pacify package-lint, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 3ce1389 27/27: Declare minimum dependency on Emacs 24.1, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 19c9270 08/27: Fix byte-compiler warnings again, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 6cb2449 07/27: Bump version, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg e5b38e4 09/27: Bump version, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg e6e4298 15/27: Merge pull request #4 from Zenoe/master, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 6898df7 18/27: Fix contact address, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 5a20000 20/27: Fix maintainer email, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 4eee444 23/27: goto-last-change: don't check buffer-undo-tree when not using undo-tree, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/goto-chg 9c16962 24/27: Don't byte-compile undo-tree-node-p invocation, Philip Kaludercic, 2021/08/01