]> code.delx.au - gnu-emacs-elpa/commitdiff
Respect y-b-l-cond from binding triggered snippets
authorNoam Postavsky <npostavs@users.sourceforge.net>
Sat, 12 Dec 2015 03:54:21 +0000 (22:54 -0500)
committerNoam Postavsky <npostavs@users.sourceforge.net>
Sun, 27 Dec 2015 23:24:37 +0000 (18:24 -0500)
The default value for `yas-buffer-local-condition' was only effective
for `yas-expand-from-trigger-key' command, so it didn't have any effect
when triggering snippets from a key binding (or if using the
`yas-expand' alias).

* yasnippet.el (yas-buffer-local-condition): Check if `this-command' is
  `yas-expand' or `yas-expand-from-keymap' too.

Fixes #305, close #638

yasnippet.el

index 592742ffc0d00d6bd0da3049ff7154bb269eb8f2..5d803c8ead44b37c13c92b6c2bdece9ce2e3cef6 100644 (file)
@@ -462,10 +462,10 @@ Attention: These hooks are not run when exiting nested/stacked snippet expansion
   "Hooks to run just before expanding a snippet.")
 
 (defvar yas-buffer-local-condition
-  '(if (and (or (fourth (syntax-ppss))
-                (fifth (syntax-ppss)))
-           this-command
-            (eq this-command 'yas-expand-from-trigger-key))
+  '(if (and (let ((ppss (syntax-ppss)))
+              (or (nth 3 ppss) (nth 4 ppss)))
+            (memq this-command '(yas-expand yas-expand-from-trigger-key
+                                            yas-expand-from-keymap)))
        '(require-snippet-condition . force-in-comment)
      t)
   "Snippet expanding condition.