Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid annoying users of auto-save-visited-mode (fix #7516) #7843

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

meedstrom
Copy link

Fixes #7516.

@meedstrom meedstrom requested a review from a team as a code owner April 23, 2024 19:54
@meedstrom
Copy link
Author

Should I reword this commit as a "tweak"?

@meedstrom
Copy link
Author

meedstrom commented May 6, 2024

Worth noting: setting it to t is a problem for Org-mode, as the org-element cache complains about "unregistered buffer modifications".

I would suggest disabling ws-butler-mode entirely in Org-mode, if someone also has auto-save-visited-mode. That's what I did for years.

Recently I've quit using auto-save-visited-mode, as I found it better to configure the classic auto saver to grant similar luxuries. If anyone's interested:

;; I used `auto-save-visited-mode' for years.  But many Emacs packages are noisy
;; on save, and I got tired of the noise.  We can configure the classic
;; `auto-save-mode' to grant us largely the same convenience:
(setq auto-save-timeout 5)
(setq auto-save-no-message t)
(setq save-all-timer (run-with-idle-timer 40 t #'my-save-all))
(add-function :after after-focus-change-function #'my-save-all)
(add-hook 'magit-pre-refresh-hook #'my-save-all)
(defun my-save-all ()
  (save-some-buffers t))

(advice-add 'after-find-file :before #'my-auto-recover-this-file)
(let (mutually-recursed-once)
  (defun my-auto-recover-this-file (&optional _ _ _ after-revert _)
    (unless (or mutually-recursed-once after-revert)
      (when (file-newer-than-file-p (or buffer-auto-save-file-name
                                        (make-auto-save-file-name))
                                    buffer-file-name)
        ;; 1. Gotta patch this function so it can skip the prompt
        ;; 2. Also, it calls `after-find-file' itself, thus we need the
        ;;    `mutually-recursed-once' check.
        (setq mutually-recursed-once t)
        (unwind-protect
            (recover-file buffer-file-name)
          (setq mutually-recursed-once nil))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tie ws-butler-keep-whitespace-before-point to auto-save-visited-mode
1 participant