diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-09-29 12:45:58 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-09-29 13:00:09 +0000 |
commit | acf0227c9f7d84304f1e8fe05c392dafa4b3a34e (patch) | |
tree | 6f201123d92e22b192501de45462aee8144c81a7 /modules | |
parent | 8e22bbd2c6f5b5b2e629430cc47901e44728e879 (diff) | |
download | nixlib-acf0227c9f7d84304f1e8fe05c392dafa4b3a34e.tar nixlib-acf0227c9f7d84304f1e8fe05c392dafa4b3a34e.tar.gz nixlib-acf0227c9f7d84304f1e8fe05c392dafa4b3a34e.tar.bz2 nixlib-acf0227c9f7d84304f1e8fe05c392dafa4b3a34e.tar.lz nixlib-acf0227c9f7d84304f1e8fe05c392dafa4b3a34e.tar.xz nixlib-acf0227c9f7d84304f1e8fe05c392dafa4b3a34e.tar.zst nixlib-acf0227c9f7d84304f1e8fe05c392dafa4b3a34e.zip |
modules/emacs: add revert opt to "Save file ...?"
This prompt is generated by magit when doing some git operations (including magit-status) when there are unsaved buffers in the repository. Often unsaved buffers are just ones that I typed a character in my mistake and didn't mean to edit, so it's convenient to be able to discard the changes directly from the prompt.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/workstation/emacs/init.el | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/workstation/emacs/init.el b/modules/workstation/emacs/init.el index 7d65b30dc7ba..40136d6ba400 100644 --- a/modules/workstation/emacs/init.el +++ b/modules/workstation/emacs/init.el @@ -32,6 +32,11 @@ (global-set-key (kbd "C-x g") 'magit-status) (global-set-key (kbd "C-x M-g") 'magit-dispatch) +;; Allow reverting buffers directly from the "Save file ...?" message. +(add-to-list 'save-some-buffers-action-alist + `(?r ,(lambda (buf) (with-current-buffer buf (revert-buffer t t))) + ,(purecopy "revert this buffer"))) + ;;; Rainbow Delimiters ;;; (add-hook 'prog-mode-hook #'rainbow-delimiters-mode) |