super-save
super-save copied to clipboard
bypass save hooks
trafficstars
would it be possible for super-save to not trigger save hooks — reserving those for when a file is manually saved?
for my specific use-case, i'm using org-roam which binds:
(add-hook 'after-save-hook #'org-roam-db-autosync--try-update-on-save-h nil t)
the db autosync is cpu intensive so there's a periodic bit of a lag when i have super-save-auto-save-when-idle turned on (which I would like to keep).
is there a way i can adjust the org-roam hook and/or configure super-save to make the two mutually exclusive?
I work around it by conditionally disabling save on idle if certain modes are enabled. Specifically those involved with formatting-on-save.
(use-package super-save :defer t
:init
(doom-load-packages-incrementally '(super-save))
:config
(defvar +super-save-disabled-major-modes '()
"Major modes in which super-save on idle is disabled.")
(defvar +super-save-disabled-minor-modes '(apheleia-mode format-all-mode)
"Modes when enabled cause super-save to be disabled.")
(defvar +super-save-auto-disable-idle 't
"Automatically disable idle based on major and minor modes.")
(defun +super-save-auto-disable-idle ()
"Automatically disable based on major and minor modes."
(not (or (member major-mode +super-save-disabled-major-modes)
;; bound-and-true-p takes a variable, not a symbol
(-some (lambda (elm) (and (boundp elm) elm))
+super-save-disabled-minor-modes))))
(when +super-save-auto-disable-idle
(add-to-list 'super-save-predicates #'+super-save-auto-disable-idle))
(setq auto-save-default nil
super-save-auto-save-when-idle t
super-save-idle-duration 30
super-save-remote-files nil
super-save-exclude '(".gpg"))
(super-save-mode +1))