[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4f2aa15 05/36: Only kill snippets for text length change
From: |
Noam Postavsky |
Subject: |
[elpa] master 4f2aa15 05/36: Only kill snippets for text length change |
Date: |
Sat, 11 Jun 2016 19:21:09 +0000 (UTC) |
branch: master
commit 4f2aa1526a3a630a984bc00c45204ee35a7ba556
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>
Only kill snippets for text length change
of protection overlay. Changes that keep the same length of text are
probably harmless (e.g. just change of text properties). It's possible
that some harmful changes don't change text length, but the protection
overlays are already unable to catch all important changes since they
only cover 1 character each at the edges.
cc-mode modifies text properties in the buffer to cache parsing results,
therefore it's important that yasnippet not kill yasnippets when parsing
is triggered by a function that only wants to parse the
buffer (e.g. which-function-mode).
* yasnippet.el (yas--on-protection-overlay-modification): Check length
of text change to decide if change is harmful. Fix docstring.
---
yasnippet.el | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 9bdb5f9..f91e130 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3467,12 +3467,11 @@ Move the overlays, or create them if they do not exit."
;; (overlay-put ov 'evaporate t)
(overlay-put ov 'modification-hooks
'(yas--on-protection-overlay-modification)))))))
-(defun yas--on-protection-overlay-modification (_overlay after? _beg _end
&optional _length)
- "Signals a snippet violation, then issues error.
-
-The error should be ignored in `debug-ignored-errors'"
+(defun yas--on-protection-overlay-modification (_overlay after? beg end
&optional length)
+ "Commit the snippet if the protection overlay is being killed."
(unless (or yas--inhibit-overlay-hooks
- after?
+ (not after?)
+ (= length (- end beg)) ; deletion or insertion
(yas--undo-in-progress))
(let ((snippets (yas--snippets-at-point)))
(yas--message 3 "Comitting snippets. Action would destroy a protection
overlay.")
- [elpa] master updated (ee4cf1e -> 438f5db), Noam Postavsky, 2016/06/11
- [elpa] master 3e67b1b 02/36: yasnippet.el (snippet-mode): Add autoload cookie., Noam Postavsky, 2016/06/11
- [elpa] master c0032e6 08/36: chmod -x doc/yas-doc-helper.el, Noam Postavsky, 2016/06/11
- [elpa] master 14f830a 13/36: Test expansion in an empty buffer, Noam Postavsky, 2016/06/11
- [elpa] master a87ec54 12/36: yasnippet.el (yas-next-field-will-exit-p): New function., Noam Postavsky, 2016/06/11
- [elpa] master 7799aa9 09/36: Document .yas-setup.el, Noam Postavsky, 2016/06/11
- [elpa] master 4f2aa15 05/36: Only kill snippets for text length change,
Noam Postavsky <=
- [elpa] master 8771082 03/36: Don't add useless kill ring entries, Noam Postavsky, 2016/06/11
- [elpa] master cc14db3 11/36: Refactor yas-next-field a bit, Noam Postavsky, 2016/06/11
- [elpa] master db4cd31 20/36: Delete active region for trigger key expansion, Noam Postavsky, 2016/06/11
- [elpa] master e37ce9e 18/36: Disable region wrapping for trigger key expansion, Noam Postavsky, 2016/06/11
- [elpa] master 6180cc4 28/36: Fix field transform application in yas-next-field, Noam Postavsky, 2016/06/11
- [elpa] master 146b161 25/36: Don't indent empty lines in snippet expansion, Noam Postavsky, 2016/06/11
- [elpa] master e9406f5 26/36: Document $> and fix escaping, Noam Postavsky, 2016/06/11
- [elpa] master 6f97316 27/36: Fix outdated and misformatted docs, Noam Postavsky, 2016/06/11
- [elpa] master bd30a30 04/36: yas-dont-activate is a hook, Noam Postavsky, 2016/06/11
- [elpa] master c1b2cb7 17/36: Improve documentation for new register option, Noam Postavsky, 2016/06/11