From 140c415505b7f2673fe58fdbf033213b089c22b3 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Fri, 11 Dec 2015 22:54:21 -0500 Subject: [PATCH] Respect y-b-l-cond from binding triggered snippets 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yasnippet.el b/yasnippet.el index 592742f..5d803c8 100644 --- a/yasnippet.el +++ b/yasnippet.el @@ -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.