Function: treesit--simple-indent-eval

treesit--simple-indent-eval is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit--simple-indent-eval EXP)

Documentation

Evaluate EXP.

If EXP is an application and the function is a key in treesit-simple-indent-presets, use the corresponding value as the function.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit--simple-indent-eval (exp)
  "Evaluate EXP.

If EXP is an application and the function is a key in
`treesit-simple-indent-presets', use the corresponding value as
the function."
  ;; We don't want to match uncompiled lambdas, so make sure this cons
  ;; is not a function.  We could move the condition functionp
  ;; forward, but better be explicit.
  (cond ((and (consp exp) (not (functionp exp)))
         (apply (treesit--simple-indent-eval (car exp))
                (mapcar #'treesit--simple-indent-eval
                        (cdr exp))))
        ;; Presets override functions, so this condition comes before
        ;; `functionp'.
        ((alist-get exp treesit-simple-indent-presets))
        ((functionp exp) exp)
        ;; There are higher-order presets that take arguments, like
        ;; (nth-sibling 1 t), so it's possible for exp to be something
        ;; other than numbers and functions.  Don't signal an error if
        ;; exp isn't a function nor a number.  In fact, allow exp to be
        ;; any symbol or keyword, so users can define higher-order
        ;; presets that takes keyword or symbol as arguments.
        (t exp)))