Function: apheleia-log--formatter-result
apheleia-log--formatter-result is a natively compiled function defined
in apheleia-log.el.
Signature
(apheleia-log--formatter-result CTX LOG-BUFFER EXIT-OK DIRECTORY STDERR-STRING)
Documentation
Log the result of a formatter process.
CTX The formatter process context (see apheleia-formatter--context(var)/apheleia-formatter--context(fun)).
LOG-BUFFER is the name of the log-buffer.
EXIT-OK is true when the formatter exited successfully.
DIRECTORY is the directory in which the formatter ran.
STDERR-STRING is the stderr output of the formatter.
Source Code
;; Defined in /nix/store/lwcwryzabcmvjcwwzzs65jrwf7p7d7cs-emacs-packages-deps/share/emacs/site-lisp/elpa/apheleia-20260915.1628/apheleia-log.el
(defun apheleia-log--formatter-result
(ctx log-buffer exit-ok directory stderr-string)
"Log the result of a formatter process.
CTX The formatter process context (see `apheleia-formatter--context').
LOG-BUFFER is the name of the log-buffer.
EXIT-OK is true when the formatter exited successfully.
DIRECTORY is the directory in which the formatter ran.
STDERR-STRING is the stderr output of the formatter."
(with-current-buffer (get-buffer-create log-buffer)
(special-mode)
(save-restriction
(widen)
(let ((inhibit-read-only t)
(orig-point (point))
(keep-at-end (eobp)))
(goto-char (point-max))
(skip-chars-backward "\n")
(delete-region (point) (point-max))
(unless (bobp)
(insert "\n\n\C-l\n"))
(unless exit-ok
(unless apheleia--last-error-marker
(setq apheleia--last-error-marker (make-marker)))
(move-marker apheleia--last-error-marker (point)))
(insert
(current-time-string)
" :: "
directory
"\n$ "
(mapconcat #'shell-quote-argument
`(,(apheleia-formatter--arg1 ctx)
,@(apheleia-formatter--argv ctx))
" ")
"\n\n"
(if (string-empty-p stderr-string)
"(no output on stderr)"
stderr-string)
"\n\n"
"Command "
(if exit-ok "succeeded" "failed")
" with exit code "
(number-to-string (apheleia-formatter--exit-status ctx))
".\n")
;; Known issue: this does not actually work; point is left at the end
;; of the previous command output, instead of being moved to the end of
;; the buffer for some reason.
(goto-char
(if keep-at-end
(point-max)
(min (point-max) orig-point)))
(goto-char (point-max))))))