From 04a90b906c5e5a04cb60647e9263db675ec1d44e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 7 Jan 2022 17:30:27 -0600 Subject: Add apheleia --- init.el | 10 ++++++++++ lisp/+apheleia.el | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 lisp/+apheleia.el diff --git a/init.el b/init.el index b046ffa..19513ea 100644 --- a/init.el +++ b/init.el @@ -567,6 +567,16 @@ [remap isearch-query-replace] #'anzu-isearch-query-replace [remap isearch-query-replace-regexp] #'anzu-isearch-query-replace-regexp)) +(setup (:straight-when (apheleia + :host github :repo "raxod502/apheleia") + (executable-find "diff")) + (:require apheleia + +apheleia) + (setf (alist-get 'indent-region apheleia-formatters) #'+apheleia-indent-region + (alist-get 'emacs-lisp-mode apheleia-mode-alist) 'indent-region + (alist-get 'lisp-interaction-mode apheleia-mode-alist) 'indent-region) + (apheleia-global-mode +1)) + (setup (:straight avy) (:require avy +avy) (:+key "M-j" #'avy-goto-char-timer) diff --git a/lisp/+apheleia.el b/lisp/+apheleia.el new file mode 100644 index 0000000..f3b16e4 --- /dev/null +++ b/lisp/+apheleia.el @@ -0,0 +1,16 @@ +;;; +apheleia.el -*- lexical-binding: t; -*- + +;;; Code: + +;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623 +(defun +apheleia-indent-region (orig scratch callback _error) + (with-current-buffer scratch + (setq-local indent-line-function + (buffer-local-value 'indent-line-function orig)) + (indent-region (point-min) +(point-max)) + (funcall callback))) + +(provide '+apheleia) +;;; +apheleia.el ends here + \ No newline at end of file -- cgit 1.4.1-21-gabe81