]> code.delx.au - gnu-emacs-elpa/commitdiff
fix a bug in condition system.
authorZhang Chiyuan <pluskid@gmail.com>
Thu, 1 May 2008 03:21:32 +0000 (03:21 +0000)
committerZhang Chiyuan <pluskid@gmail.com>
Thu, 1 May 2008 03:21:32 +0000 (03:21 +0000)
snippets/text-mode/ruby-mode/if
yasnippet.el

index 51bf24c5a3cd02680a60ce2de35787773129dcd1..1f0f900fd37ccf72e2b4107c0fd2a1be0ceba425 100644 (file)
@@ -1,4 +1,5 @@
 #name : if ... end
+#condition : (looking-back "^[[:blank:]]*if")
 # --
 if ${1:condition}
   $0
index d5bf41af8502cd8269f9519d513365e65f27f237..8c5f54def6e913a610f60c9e3e01ff3a769cc644 100644 (file)
@@ -367,18 +367,20 @@ have, compare through the start point of the overlay."
  * If the template has no condition, it is kept.
  * If the template's condition eval to non-nil, it is kept.
  * Otherwise (eval error or eval to nil) it is filtered."
-  (remove-if '(lambda (pair)
-               (let ((condition (yas/template-condition (cdr pair))))
-                 (if (null condition)
-                     (if yas/require-template-condition
-                         t
-                       nil)
-                   (let ((result 
-                          (yas/template-condition-predicate condition)))
-                     (if (eq yas/require-template-condition t)
-                         result
-                       (not (eq result yas/require-template-condition)))))))
-            templates))
+  (remove-if-not '(lambda (pair)
+                   (let ((condition (yas/template-condition (cdr pair))))
+                     (if (null condition)
+                         (if yas/require-template-condition
+                             nil
+                           t)
+                       (let ((result 
+                              (yas/template-condition-predicate condition)))
+                         (if yas/require-template-condition
+                             (if (eq yas/require-template-condition t)
+                                 result
+                               (eq result yas/require-template-condition))
+                           result)))))
+                templates))
 
 (defun yas/snippet-table-fetch (table key)
   "Fetch a snippet binding to KEY from TABLE. If not found,