]> git.eshelyaron.com Git - emacs.git/commitdiff
(treesit-simple-indent-presets): Ensure 'and' works for anchors too
authorDmitry Gutov <dgutov@yandex.ru>
Sat, 7 Jan 2023 01:28:38 +0000 (03:28 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sat, 7 Jan 2023 01:28:38 +0000 (03:28 +0200)
* lisp/treesit.el (treesit-simple-indent-presets):
Rewrite to return the last successful evaluation, not just t.

lisp/treesit.el

index 374c17c08941f7cb3d2d60115386598da9f5524b..11a78bddcd83f140f427205f558b1bf877b10cac 100644 (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