mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-16 14:33:05 +00:00
fix a bug in condition system.
This commit is contained in:
parent
db6a74078f
commit
0e1456f4b8
@ -1,4 +1,5 @@
|
||||
#name : if ... end
|
||||
#condition : (looking-back "^[[:blank:]]*if")
|
||||
# --
|
||||
if ${1:condition}
|
||||
$0
|
||||
|
26
yasnippet.el
26
yasnippet.el
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user