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
This commit is contained in:
Noam Postavsky 2015-12-11 22:54:21 -05:00
parent 17fe7904ae
commit 140c415505

View 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.