From 9d410f8de64e91d16999a9bb5dd884d6d06d22bd Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 7 Jan 2023 03:28:38 +0200 Subject: [PATCH] (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. --- lisp/treesit.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 374c17c0894..11a78bddcd8 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -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 -- 2.39.5