Closes #508: Ensure original point when evaluating conditions

* yasnippet.el (yas--templates-for-key-at-point): Call
`yas--fetch', and hence condition system, with point in the
original position.
This commit is contained in:
João Távora 2014-08-21 08:38:46 +01:00
parent 5b59b802ac
commit be2f815c43

View File

@ -1257,11 +1257,13 @@ Returns (TEMPLATES START END). This function respects
(setq methods (cdr methods)))) (setq methods (cdr methods))))
(t (t
(yas--warning "Warning invalid element %s in `yas-key-syntaxes'" method))) (yas--warning "Warning invalid element %s in `yas-key-syntaxes'" method)))
(let ((possible-key (buffer-substring-no-properties (point) original)))
(save-excursion
(goto-char original)
(setq templates (setq templates
(mapcan #'(lambda (table) (mapcan #'(lambda (table)
(yas--fetch table (buffer-substring-no-properties (point) (yas--fetch table possible-key))
original))) (yas--get-snippet-tables))))))
(yas--get-snippet-tables))))
(when templates (when templates
(list templates (point) original))))) (list templates (point) original)))))