* lisp/treesit.el (treesit-simple-indent-presets):
Short-circuit the 'and' and 'or' matchers. To avoid calling all
fns after one returned nil or truthy value, respectively.
;; TODO: Document.
(cons 'and (lambda (&rest fns)
(lambda (node parent bol &rest _)
- (cl-reduce (lambda (a b) (and a b))
- (mapcar (lambda (fn)
- (funcall fn node parent bol))
- fns)))))
+ (not
+ (seq-find
+ (lambda (fn) (not (funcall fn node parent bol)))
+ fns)))))
(cons 'or (lambda (&rest fns)
(lambda (node parent bol &rest _)
- (cl-reduce (lambda (a b) (or a b))
- (mapcar (lambda (fn)
- (funcall fn node parent bol))
- fns)))))
+ (seq-find
+ (lambda (fn) (funcall fn node parent bol))
+ fns))))
(cons 'not (lambda (fn)
(lambda (node parent bol &rest _)
(not (funcall fn node parent bol)))))