From: Dmitry Gutov Date: Sat, 7 Jan 2023 01:28:38 +0000 (+0200) Subject: (treesit-simple-indent-presets): Ensure 'and' works for anchors too X-Git-Tag: emacs-29.0.90~817 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9d410f8de64e91d16999a9bb5dd884d6d06d22bd;p=emacs.git (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. --- 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