(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:
Dmitry Gutov 2023-01-07 03:28:38 +02:00
parent ff66a5d324
commit 9d410f8de6

View file

@ -1179,10 +1179,12 @@ See `treesit-simple-indent-presets'.")
;; TODO: Document.
(cons 'and (lambda (&rest fns)
(lambda (node parent bol &rest _)
(not
(seq-find
(lambda (fn) (not (funcall fn node parent bol)))
fns)))))
(let (res)
(catch 'break
(dolist (fn fns)
(setq res (funcall fn node parent bol))
(unless res (throw 'break t))))
res))))
(cons 'or (lambda (&rest fns)
(lambda (node parent bol &rest _)
(seq-find