]> code.delx.au - gnu-emacs-elpa/commitdiff
Add useful development assertion
authorJoão Távora <joaotavora@gmail.com>
Mon, 23 Mar 2015 10:10:56 +0000 (10:10 +0000)
committerJoão Távora <joaotavora@gmail.com>
Mon, 23 Mar 2015 10:11:19 +0000 (10:11 +0000)
When debugging snippets after M-x toggle-debug-on-error, errors in the
`post-command-hook' might cause `yas--post-command-handler' to be
removed. That's OK, always check that it's there before attempting any
`yas-expand-snippet' calls, since it is essential to check snippet
movement.

* yasnippet.el (yas-expand-snippet): Assert `yas-minor-mode' and
`yas--post-command-handler' active.

yasnippet.el

index 2a2254bb3b9c2b936a58a90aed24d2e911a1cec4..95c96e46a07e87bf27e3eb3427c7f4139b5ac89e 100644 (file)
@@ -3490,6 +3490,10 @@ The error should be ignored in `debug-ignored-errors'"
 Text between START and END will be deleted before inserting
 template.  EXPAND-ENV is a list of (SYM VALUE) let-style dynamic bindings
 considered when expanding the snippet."
+  (cl-assert (and yas-minor-mode
+                  (memq 'yas--post-command-handler post-command-hook))
+             nil
+             "[yas] `yas-expand-snippet' needs properly setup `yas-minor-mode'")
   (run-hooks 'yas-before-expand-snippet-hook)
 
   ;;