emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 885237a 174/177: Add useful development assertion


From: João Távora
Subject: [elpa] master 885237a 174/177: Add useful development assertion
Date: Sat, 28 Mar 2015 15:41:44 +0000

branch: master
commit 885237a4856ff22f0df82ab25e7ea3391a8376bd
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Add useful development assertion
    
    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 |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index 2a2254b..95c96e4 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -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)
 
   ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]