]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge pull request #409 from npostavs/font-lock
authorJoão Távora <joaotavora@gmail.com>
Mon, 14 Oct 2013 15:46:18 +0000 (08:46 -0700)
committerJoão Távora <joaotavora@gmail.com>
Mon, 14 Oct 2013 15:46:18 +0000 (08:46 -0700)
Fix yas--font-lock-keywords

yasnippet-tests.el
yasnippet.el

index 7349d6f1477abda732edaffb6986b6e2eebe3b8b..c5d87387aadc4820c7ed5ee363fb9fac71f97047 100644 (file)
       (ert-simulate-command `(yas-mock-insert "bbb"))
       (should (string= (yas--buffer-contents) "if condition\naaa\nelse\nbbb\nend")))))
 
+(ert-deftest example-for-issue-404 ()
+  (with-temp-buffer
+    (c++-mode)
+    (yas-minor-mode 1)
+    (insert "#include <foo>\n")
+    (let ((snippet "main"))
+      (yas-expand-snippet snippet)
+      (should (string= (yas--buffer-contents) "#include <foo>\nmain")))))
+
 (ert-deftest another-example-for-issue-271 ()
   ;; expect this to fail in batch mode since `region-active-p' doesn't
   ;; used by `yas-expand-snippet' doesn't make sense in that context.
index e7531fe9032a27493384992641e18937704dbe0f..afa0a4209a62e4b27e5cbd75f85e9c213a762efb 100644 (file)
@@ -2201,7 +2201,7 @@ If expansion fails, execute the previous binding for this key"
   (interactive)
   (setq yas--condition-cache-timestamp (current-time))
   (let* ((vec (subseq (this-command-keys-vector) (if current-prefix-arg
-                                                     universal-argument-num-events
+                                                     (length (this-command-keys))
                                                    0)))
          (templates (mapcan #'(lambda (table)
                                 (yas--fetch table vec))
@@ -3521,9 +3521,11 @@ considered when expanding the snippet."
                  (setq snippet
                        (if expand-env
                            (eval `(let* ,expand-env
-                                    (insert content)
+                                    (let ((inhibit-modification-hooks t))
+                                      (insert content))
                                     (yas--snippet-create (point-min))))
-                         (insert content)
+                         (let ((inhibit-modification-hooks t))
+                           (insert content))
                          (yas--snippet-create (point-min)))))))
 
            ;; stacked-expansion: This checks for stacked expansion, save the