[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 175e0a3 159/177: Clean up previous change
From: |
João Távora |
Subject: |
[elpa] master 175e0a3 159/177: Clean up previous change |
Date: |
Sat, 28 Mar 2015 15:41:38 +0000 |
branch: master
commit 175e0a3a102c22c0c99d8d00ecf8bc8539a4e593
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Clean up previous change
* yasnippet.el: Update comment.
(yas--protection-violation): Removed.
(yas--on-protection-overlay-modification): Simplified.
(yas--post-command-handler): No longer reference
`yas--protection-violation'
---
yasnippet.el | 46 ++++++++++++----------------------------------
1 files changed, 12 insertions(+), 34 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index c93d886..15b9def 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3438,17 +3438,10 @@ progress."
;; snippet outside the active field. Actual protection happens in
;; `yas--on-protection-overlay-modification'.
;;
-;; Currently this signals an error which inhibits the command. For
-;; commands that move point (like `kill-line'), point is restored in
-;; the `yas--post-command-handler' using a global
-;; `yas--protection-violation' variable.
-;;
-;; Alternatively, I've experimented with an implementation that
-;; commits the snippet before actually calling `this-command'
-;; interactively, and then signals an error, which is ignored. but
-;; blocks all other million modification hooks. This presented some
-;; problems with stacked expansion.
-;;
+;; As of github #537 this no longer inhibits the command by issuing an
+;; error: all the snippets at point, including nested snippets, are
+;; automatically commited and the current command can proceed.
+;;
(defun yas--make-move-field-protection-overlays (snippet field)
"Place protection overlays surrounding SNIPPET's FIELD.
@@ -3481,29 +3474,17 @@ 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)))))))
-(defvar yas--protection-violation nil
- "When non-nil, signals attempts to erroneously exit or modify the snippet.
-
-Functions in the `post-command-hook', for example
-`yas--post-command-handler' can check it and reset its value to
-nil. The variables value is the point where the violation
-originated")
-
(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'"
- (unless yas--inhibit-overlay-hooks
- (cond ((not (or after?
- (yas--undo-in-progress)))
- (cond (t
- (let ((snippets (yas--snippets-at-point)))
- (yas--message 3 "Comitting snippets. Action would destroy
a protection overlay.")
- (cl-loop for snippet in snippets
- do (yas--commit-snippet snippet))))
- (nil
- (setq yas--protection-violation (point))
- (error "Exit the snippet first!")))))))
+ (unless (or yas--inhibit-overlay-hooks
+ after?
+ (yas--undo-in-progress))
+ (let ((snippets (yas--snippets-at-point)))
+ (yas--message 3 "Comitting snippets. Action would destroy a protection
overlay.")
+ (cl-loop for snippet in snippets
+ do (yas--commit-snippet snippet)))))
(add-to-list 'debug-ignored-errors "^Exit the snippet first!$")
@@ -4302,10 +4283,7 @@ When multiple expressions are found, only the last one
counts."
;;
(defun yas--post-command-handler ()
"Handles various yasnippet conditions after each command."
- (cond (yas--protection-violation
- (goto-char yas--protection-violation)
- (setq yas--protection-violation nil))
- ((eq 'undo this-command)
+ (cond ((eq 'undo this-command)
;;
;; After undo revival the correct field is sometimes not
;; restored correctly, this condition handles that
- [elpa] master e731451 150/177: Signal an error on recursive yas--fallback calls, (continued)
- [elpa] master e731451 150/177: Signal an error on recursive yas--fallback calls, João Távora, 2015/03/28
- [elpa] master 6877bc6 151/177: Merge pull request #524 from npostavs/fallback-loop, João Távora, 2015/03/28
- [elpa] master 37df653 142/177: yasnippet-debug.el: quiet byte-compiler, João Távora, 2015/03/28
- [elpa] master 70151f4 152/177: Closes #525, closes #526: Prevent some keybinding fallback loops, João Távora, 2015/03/28
- [elpa] master 6053db0 153/177: Closes #527: Unbreak case where yas-fallback-behaviour is a list, João Távora, 2015/03/28
- [elpa] master b22961a 155/177: Update README.mdown, João Távora, 2015/03/28
- [elpa] master 596e6b2 158/177: Closes #537: Be lenient to extensions operating on snippet fields, João Távora, 2015/03/28
- [elpa] master 1c97671 157/177: Closes #536: Fix navigation to zero-length fields at snippet end, João Távora, 2015/03/28
- [elpa] master e2b876b 154/177: Tweak README.mdown to simplify bug reporting paragraph, João Távora, 2015/03/28
- [elpa] master 51d4ed1 156/177: Update snippets submodule, João Távora, 2015/03/28
- [elpa] master 175e0a3 159/177: Clean up previous change,
João Távora <=
- [elpa] master 50ca8d3 160/177: Update README.mdown, João Távora, 2015/03/28
- [elpa] master bb6bbad 161/177: Add file doc/.nosearch, João Távora, 2015/03/28
- [elpa] master 9709dbd 164/177: Add autoload cookies, João Távora, 2015/03/28
- [elpa] master b62bdf3 163/177: Closes #546: backport `yas-initialize' and provide `yas/initialize', João Távora, 2015/03/28
- [elpa] master e161fc0 162/177: Merge pull request #542 from tarsius/nosearch, João Távora, 2015/03/28
- [elpa] master 07734a1 165/177: Clarify what happens with yas-new-snippet., João Távora, 2015/03/28
- [elpa] master 3c13348 167/177: yas-expand-snippet: Clarify EXPAND-ENV, João Távora, 2015/03/28
- [elpa] master 21ffe4b 168/177: Merge pull request #559 from mineo/patch-1, João Távora, 2015/03/28
- [elpa] master 197ef7f 166/177: Merge pull request #552 from treese/master, João Távora, 2015/03/28
- [elpa] master 3e7b56e 169/177: Implements #566: Remove dead major modes code, João Távora, 2015/03/28