From aab5bfd074e57d06a79e39d7c7c4760e1f385a06 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 17 Oct 2022 21:41:28 -0500 Subject: Bankruptcy 9 --- lisp/+apheleia.el | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 lisp/+apheleia.el (limited to 'lisp/+apheleia.el') diff --git a/lisp/+apheleia.el b/lisp/+apheleia.el deleted file mode 100644 index 51cf145..0000000 --- a/lisp/+apheleia.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; +apheleia.el -*- lexical-binding: t; -*- - -;;; Code: - -(require 'cl-lib) -(require 'el-patch) -(require 'user-save) - -;; https://github.com/raxod502/apheleia/pull/63#issue-1077529623 -(cl-defun +apheleia-indent-region (&key buffer scratch formatter callback &allow-other-keys) - (with-current-buffer scratch - (setq-local indent-line-function - (buffer-local-value 'indent-line-function buffer)) - (indent-region (point-min) - (point-max)) - (funcall callback))) - -;;; Why does the original function have to check for `apheleia-mode' ? -(el-patch-defun apheleia--format-after-save () - "Run code formatter for current buffer if any configured, then save." - (unless apheleia--format-after-save-in-progress - (when (el-patch-swap apheleia-mode - (or apheleia-mode - +apheleia/user-save-mode)) - (when-let ((formatters (apheleia--get-formatters))) - (apheleia-format-buffer - formatters - (lambda () - (with-demoted-errors "Apheleia: %s" - (when buffer-file-name - (let ((apheleia--format-after-save-in-progress t)) - (apheleia--save-buffer-silently))) - (run-hooks 'apheleia-post-format-hook)))))))) - - -(define-minor-mode +apheleia/user-save-mode - "Minor mode for reformatting code on `user-save'. -Customize with `apheleia-mode-alist' and `apheleia-formatters'." - :lighter " Apheleia/US" - (if +apheleia/user-save-mode - (add-hook 'user-save-after-save-hook #'apheleia--format-after-save nil 'local) - (remove-hook 'user-save-after-save-hook #'apheleia--format-after-save 'local))) - -(define-globalized-minor-mode +apheleia/user-save-global-mode - +apheleia/user-save-mode +apheleia/user-save-mode) - -(put '+apheleia/user-save-mode 'safe-local-variable #'booleanp) - -(provide '+apheleia) -;;; +apheleia.el ends here -- cgit 1.4.1-21-gabe81