]> code.delx.au - gnu-emacs-elpa/commitdiff
Closes #537: Be lenient to extensions operating on snippet fields
authorJoão Távora <joaotavora@gmail.com>
Tue, 4 Nov 2014 08:27:34 +0000 (08:27 +0000)
committerJoão Távora <joaotavora@gmail.com>
Tue, 4 Nov 2014 08:27:34 +0000 (08:27 +0000)
* yasnippet.el (yas--on-protection-overlay-modification): Commit the
snippets being destroyed instead of signalling a protection violation.

yasnippet.el

index cb1d04123d603232a2c736c9d402bf09d9dfd1fa..c93d886c19e2fed28fafbf2091b5dc3e7687248f 100644 (file)
@@ -3496,8 +3496,14 @@ The error should be ignored in `debug-ignored-errors'"
   (unless yas--inhibit-overlay-hooks
     (cond ((not (or after?
                     (yas--undo-in-progress)))
-           (setq yas--protection-violation (point))
-           (error "Exit the snippet first!")))))
+           (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!")))))))
 
 (add-to-list 'debug-ignored-errors "^Exit the snippet first!$")