about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el2
-rw-r--r--lisp/user-save.el13
2 files changed, 11 insertions, 4 deletions
diff --git a/init.el b/init.el index 635bfe5..90c6b9b 100644 --- a/init.el +++ b/init.el
@@ -114,7 +114,7 @@
114 114
115(setup (:require user-save) 115(setup (:require user-save)
116 (add-hook 'user-save-hook #'+clean-empty-lines) 116 (add-hook 'user-save-hook #'+clean-empty-lines)
117 (user-save-mode +1)) 117 (user-save-global-mode +1))
118 118
119(setup +key 119(setup +key
120 (+ensure-after-init #'+key-global-mode)) 120 (+ensure-after-init #'+key-global-mode))
diff --git a/lisp/user-save.el b/lisp/user-save.el index 1284547..8e01af1 100644 --- a/lisp/user-save.el +++ b/lisp/user-save.el
@@ -73,9 +73,16 @@ whether the buffer needs to be saved."
73(define-minor-mode user-save-mode 73(define-minor-mode user-save-mode
74 "Mode to enable an an extra user-save hook." 74 "Mode to enable an an extra user-save hook."
75 :lighter " US" 75 :lighter " US"
76 :global t 76 :keymap user-save-mode-map)
77 :keymap 'user-save-mode-map 77
78 (if user-save-mode 78;;;###autoload
79(defun turn-off-user-save-mode ()
80 "Turn off `user-save-mode' in the current buffer."
81 (user-save-mode -1))
82
83;;;###autoload
84(define-globalized-minor-mode user-save-global-mode user-save-mode user-save-mode
85 (if user-save-global-mode
79 (when user-save-hook-into-kill-emacs 86 (when user-save-hook-into-kill-emacs
80 (add-hook 'kill-emacs-hook #'user-save-some-buffers)) 87 (add-hook 'kill-emacs-hook #'user-save-some-buffers))
81 (remove-hook 'kill-emacs-hook #'user-save-some-buffers))) 88 (remove-hook 'kill-emacs-hook #'user-save-some-buffers)))