(treesit-simple-indent-presets): Ensure 'and' works for anchors too
* lisp/treesit.el (treesit-simple-indent-presets): Rewrite to return the last successful evaluation, not just t.
This commit is contained in:
parent
ff66a5d324
commit
9d410f8de6
1 changed files with 6 additions and 4 deletions
|
@ -1179,10 +1179,12 @@ See `treesit-simple-indent-presets'.")
|
||||||
;; TODO: Document.
|
;; TODO: Document.
|
||||||
(cons 'and (lambda (&rest fns)
|
(cons 'and (lambda (&rest fns)
|
||||||
(lambda (node parent bol &rest _)
|
(lambda (node parent bol &rest _)
|
||||||
(not
|
(let (res)
|
||||||
(seq-find
|
(catch 'break
|
||||||
(lambda (fn) (not (funcall fn node parent bol)))
|
(dolist (fn fns)
|
||||||
fns)))))
|
(setq res (funcall fn node parent bol))
|
||||||
|
(unless res (throw 'break t))))
|
||||||
|
res))))
|
||||||
(cons 'or (lambda (&rest fns)
|
(cons 'or (lambda (&rest fns)
|
||||||
(lambda (node parent bol &rest _)
|
(lambda (node parent bol &rest _)
|
||||||
(seq-find
|
(seq-find
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue