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

add global-real-auto-save-mode #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions real-auto-save.el
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,26 @@ If RESTART is non-nil, restart timer."
(setq real-auto-save-buffers-list
(delq (current-buffer) real-auto-save-buffers-list)))

;;;###autoload
(defun real-auto-save-turn-on ()
"Turn on Real-Auto-Save Mode for current if it's visiting a file.

This function is designed to be added to hooks, for example:
(add-hook \\='c-mode-hook #\\='real-auto-save-turn-turn-on)"
(when buffer-file-name
(real-auto-save-mode +1))

;;;###autoload
(defun real-auto-save-turn-off ()
"Turn off Real-Auto-Save Mode.

This function is designed to be added to hooks, for example:
(add-hook \\='message-mode-hook #\\='real-auto-save-turn-off)

Useful in combination when `global-real-auto-save-mode' is used to
opt-out of auto-saving on a per-buffer or per-mode basis."
(real-auto-save-mode -1))

;;;###autoload
(define-minor-mode real-auto-save-mode
"Save your buffers automatically."
Expand All @@ -110,5 +130,9 @@ If RESTART is non-nil, restart timer."
(real-auto-save--setup)
(real-auto-save--teardown)))

;;;###autoload
(define-globalized-minor-mode global-real-auto-save-mode
real-auto-save-mode real-auto-save-turn-on)

(provide 'real-auto-save)
;;; real-auto-save.el ends here