about summary refs log tree commit diff stats
path: root/lisp/acdw-apheleia.el
blob: 1b646ef39595c0db9da14b6386af1666d5d53d7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;;; 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