[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 462f566 44/63: Don't leave unreadable objects in the undo
From: |
Noam Postavsky |
Subject: |
[elpa] master 462f566 44/63: Don't leave unreadable objects in the undo list |
Date: |
Mon, 17 Jul 2017 22:54:17 -0400 (EDT) |
branch: master
commit 462f5667fc9b68f03a6d93d8d4e877dbc38b49ca
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Don't leave unreadable objects in the undo list
* yasnippet.el (yas--commit-snippet): Remove overlay object after
deleting it.
(yas--markers-to-points): Drop marker object.
(yas--points-to-markers): Create a new marker object.
---
yasnippet.el | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index b618f73..a3a1eaa 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3293,7 +3293,8 @@ This renders the snippet as ordinary text."
(overlay-buffer control-overlay))
(setq yas-snippet-beg (overlay-start control-overlay))
(setq yas-snippet-end (overlay-end control-overlay))
- (delete-overlay control-overlay))
+ (delete-overlay control-overlay)
+ (setf (yas--snippet-control-overlay snippet) nil))
(let ((yas--inhibit-overlay-hooks t))
(when yas--active-field-overlay
@@ -3448,8 +3449,9 @@ If so cleans up the whole snippet up."
;;
;; This was found useful for performance reasons, so that an excessive
;; number of live markers aren't kept around in the
-;; `buffer-undo-list'. We reuse the original marker object, although
-;; that's probably not necessary.
+;; `buffer-undo-list'. We don't reuse the original marker object
+;; because that leaves an unreadable object in the history list and
+;; undo-tree persistence has trouble with that.
;;
;; This shouldn't bring horrible problems with undo/redo, but you
;; never know.
@@ -3457,16 +3459,13 @@ If so cleans up the whole snippet up."
(defun yas--markers-to-points (snippet)
"Save all markers of SNIPPET as positions."
(yas--snippet-map-markers (lambda (m)
- (prog1 (cons (marker-position m) m)
+ (prog1 (marker-position m)
(set-marker m nil)))
snippet))
(defun yas--points-to-markers (snippet)
"Restore SNIPPET's marker positions, saved by `yas--markers-to-points'."
- (yas--snippet-map-markers (lambda (p-m)
- (set-marker (cdr p-m) (car p-m))
- (cdr p-m))
- snippet))
+ (yas--snippet-map-markers #'copy-marker snippet))
(defun yas--maybe-move-to-active-field (snippet)
"Try to move to SNIPPET's active (or first) field and return it if found."
- [elpa] master f3d0e03 25/63: * yasnippet-tests.el (snippet-exit-hooks): New test., (continued)
- [elpa] master f3d0e03 25/63: * yasnippet-tests.el (snippet-exit-hooks): New test., Noam Postavsky, 2017/07/17
- [elpa] master 4ee3835 08/63: Use expand-env for all snippet evaluations, Noam Postavsky, 2017/07/17
- [elpa] master 203df22 22/63: Use debug-on-error to simplify error handling, Noam Postavsky, 2017/07/17
- [elpa] master 9c9547a 21/63: Don't catch and rethrow yas-{-}exception, Noam Postavsky, 2017/07/17
- [elpa] master e878afb 12/63: Update handling of markers during indentation, Noam Postavsky, 2017/07/17
- [elpa] master 6c4fbb2 24/63: Fix snippet local exit hook, Noam Postavsky, 2017/07/17
- [elpa] master d0c6fec 16/63: Refactor snippet marker manipulating functions, Noam Postavsky, 2017/07/17
- [elpa] master e74f00e 18/63: Fix whitespace lossage between mirrors, Noam Postavsky, 2017/07/17
- [elpa] master 4f37afd 27/63: Let snippets expand in strings/comments by default, Noam Postavsky, 2017/07/17
- [elpa] master cddb826 29/63: Merge: let snippets expand in strings/comments by default, Noam Postavsky, 2017/07/17
- [elpa] master 462f566 44/63: Don't leave unreadable objects in the undo list,
Noam Postavsky <=
- [elpa] master 3949421 41/63: Fix problems with auto-fill-mode interaction, Noam Postavsky, 2017/07/17
- [elpa] master 0d9afb2 31/63: Fix mirror transformation error with expand-env, Noam Postavsky, 2017/07/17
- [elpa] master b4d2f9c 37/63: Update snippets submodule, Noam Postavsky, 2017/07/17
- [elpa] master c5fddf8 34/63: Restore syntax-propertize-function before indenting snippet, Noam Postavsky, 2017/07/17
- [elpa] master 5043a96 38/63: Correctly wrap auto-fill-function when it's toggled on later, Noam Postavsky, 2017/07/17
- [elpa] master 30913fd 35/63: Only update live snippets, Noam Postavsky, 2017/07/17
- [elpa] master 0f6d82f 46/63: * .travis.yml: Use Emacs 25.2, Noam Postavsky, 2017/07/17
- [elpa] master 6102ff5 50/63: Handle undo of snippet 1st line indent properly, Noam Postavsky, 2017/07/17
- [elpa] master ac26024 20/63: Rework error handling, Noam Postavsky, 2017/07/17
- [elpa] master c3a9447 43/63: Fix condition timestamps in key filter functions, Noam Postavsky, 2017/07/17