]> code.delx.au - gnu-emacs-elpa/commitdiff
Closes #508: Ensure original point when evaluating conditions
authorJoão Távora <joaotavora@gmail.com>
Thu, 21 Aug 2014 07:38:46 +0000 (08:38 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 21 Aug 2014 07:38:46 +0000 (08:38 +0100)
* yasnippet.el (yas--templates-for-key-at-point): Call
`yas--fetch', and hence condition system, with point in the
original position.

yasnippet.el

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