Function: apheleia-indent-lisp-buffer

apheleia-indent-lisp-buffer is a natively compiled function defined in apheleia-formatters.el.

Signature

(apheleia-indent-lisp-buffer &key BUFFER SCRATCH CALLBACK &allow-other-keys)

Documentation

Format a Lisp BUFFER.

Use SCRATCH as a temporary buffer and CALLBACK to apply the transformation.

For more implementation detail, see apheleia--run-formatter-function.

Source Code

;; Defined in /nix/store/lwcwryzabcmvjcwwzzs65jrwf7p7d7cs-emacs-packages-deps/share/emacs/site-lisp/elpa/apheleia-20260915.1628/apheleia-formatters.el
(cl-defun apheleia-indent-lisp-buffer
    (&key buffer scratch callback &allow-other-keys)
  "Format a Lisp BUFFER.
Use SCRATCH as a temporary buffer and CALLBACK to apply the
transformation.

For more implementation detail, see
`apheleia--run-formatter-function'."
  (with-current-buffer scratch
    (funcall (with-current-buffer buffer major-mode))
    (setq-local indent-line-function
                (buffer-local-value 'indent-line-function buffer))
    (setq-local lisp-indent-function
                (buffer-local-value 'lisp-indent-function buffer))
    (setq-local indent-tabs-mode
                (buffer-local-value 'indent-tabs-mode buffer))
    (setq-local lisp-indent-offset
                (buffer-local-value 'lisp-indent-offset buffer))
    (setq-local lisp-body-indent
                (buffer-local-value 'lisp-body-indent buffer))
    (goto-char (point-min))
    (let ((inhibit-message t)
          (message-log-max nil))
      (indent-region (point-min) (point-max)))
    (funcall callback)))