mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-16 15:56:52 -05:00
refactor(format): swap to string-blank-p & memq
This commit is contained in:
@@ -38,7 +38,7 @@ select buffers.")
|
|||||||
"Enable formatting on save in certain major modes.
|
"Enable formatting on save in certain major modes.
|
||||||
This is controlled by `+format-on-save-disabled-modes'."
|
This is controlled by `+format-on-save-disabled-modes'."
|
||||||
(or (eq major-mode 'fundamental-mode)
|
(or (eq major-mode 'fundamental-mode)
|
||||||
(string-empty-p (string-trim (buffer-name)))
|
(string-blank-p (buffer-name))
|
||||||
(not (null (memq major-mode +format-on-save-disabled-modes)))))
|
(not (null (memq major-mode +format-on-save-disabled-modes)))))
|
||||||
|
|
||||||
|
|
||||||
@@ -46,13 +46,14 @@ This is controlled by `+format-on-save-disabled-modes'."
|
|||||||
(after! apheleia-core
|
(after! apheleia-core
|
||||||
(add-to-list 'apheleia-inhibit-functions #'+format-inhibit-maybe-h)))
|
(add-to-list 'apheleia-inhibit-functions #'+format-inhibit-maybe-h)))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Hacks
|
;;; Hacks
|
||||||
|
|
||||||
(defadvice! +format--inhibit-reformat-on-prefix-arg-a (orig-fn &optional arg)
|
(defadvice! +format--inhibit-reformat-on-prefix-arg-a (orig-fn &optional arg)
|
||||||
"Make it so \\[save-buffer] with prefix arg inhibits reformatting."
|
"Make it so \\[save-buffer] with prefix arg inhibits reformatting."
|
||||||
:around #'save-buffer
|
:around #'save-buffer
|
||||||
(let ((apheleia-mode (and apheleia-mode (member arg '(nil 1)))))
|
(let ((apheleia-mode (and apheleia-mode (memq arg '(nil 1)))))
|
||||||
(funcall orig-fn)))
|
(funcall orig-fn)))
|
||||||
|
|
||||||
(add-hook!
|
(add-hook!
|
||||||
|
Reference in New Issue
Block a user