mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-16 06:23:04 +00:00
fix a bug in condition system.
This commit is contained in:
parent
db6a74078f
commit
0e1456f4b8
@ -1,4 +1,5 @@
|
|||||||
#name : if ... end
|
#name : if ... end
|
||||||
|
#condition : (looking-back "^[[:blank:]]*if")
|
||||||
# --
|
# --
|
||||||
if ${1:condition}
|
if ${1:condition}
|
||||||
$0
|
$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 has no condition, it is kept.
|
||||||
* If the template's condition eval to non-nil, 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."
|
* Otherwise (eval error or eval to nil) it is filtered."
|
||||||
(remove-if '(lambda (pair)
|
(remove-if-not '(lambda (pair)
|
||||||
(let ((condition (yas/template-condition (cdr pair))))
|
(let ((condition (yas/template-condition (cdr pair))))
|
||||||
(if (null condition)
|
(if (null condition)
|
||||||
(if yas/require-template-condition
|
(if yas/require-template-condition
|
||||||
t
|
nil
|
||||||
nil)
|
t)
|
||||||
(let ((result
|
(let ((result
|
||||||
(yas/template-condition-predicate condition)))
|
(yas/template-condition-predicate condition)))
|
||||||
(if (eq yas/require-template-condition t)
|
(if yas/require-template-condition
|
||||||
result
|
(if (eq yas/require-template-condition t)
|
||||||
(not (eq result yas/require-template-condition)))))))
|
result
|
||||||
templates))
|
(eq result yas/require-template-condition))
|
||||||
|
result)))))
|
||||||
|
templates))
|
||||||
|
|
||||||
(defun yas/snippet-table-fetch (table key)
|
(defun yas/snippet-table-fetch (table key)
|
||||||
"Fetch a snippet binding to KEY from TABLE. If not found,
|
"Fetch a snippet binding to KEY from TABLE. If not found,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user