emacs/lisp/acdw-apheleia.el

26 lines
756 B
EmacsLisp

;;; acdw-apheleia.el --- bespoke apheleia junk -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
(require 'apheleia)
(defcustom apheleia-stupid-modes '(makefile-mode
org-mode)
"List of stupid modes to not use `apheleia-global-mode' on."
:type '(repeat function)
:group 'apheleia)
(defun apheleia-dumb-auto-format ()
"Format a buffer dumbly."
;; If there's no apheleia formatter for the mode, just indent the
;; buffer.
(unless (or (apply #'derived-mode-p apheleia-stupid-modes)
(and (fboundp 'apheleia--get-formatter-command)
(apheleia--get-formatter-command)))
(indent-region (point-min) (point-max))))
(provide 'acdw-apheleia)
;;; acdw-apheleia ends here