-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 super-save layer that auto-saves buffers #4964
Conversation
Define your packages in and initialize them in I fixed the wizard but @syl20bnr is waiting a bit it seems |
See this example. |
This layer is inspired by Bozhidar Batsovs super-save (https://github.com/bbatsov/super-save), but is adapted to work with Spacemacs. Using the original package proved to be impractical for integrating with Spacemacs, and since it is not a large package, the functionality was reimplemented. When you enable this layer, switching windows or Spacemacs losing focus causes an automatic save to the current buffer.
Thanks for the hint! I updated the PR. I amended the commit to satisfy the one commit rule. |
👍 |
👍 |
What is the difference between this and what we currently have? |
@robbyoconnor Spacemacs currently doesn't save the file if the buffer loses focus. That would be nice to have. It would save me a lot of mistaken compiles. |
Oh nevermind :) |
I come from prelude, and would love to have this layer in as well. I am not used to saving stuff manually anymore 👍 |
@sirech Please 👍 the PR. The maintainers looks that those numbers. |
@mmainz Thank you for the PR, it is on the top of my queue of PR to merge but first I want to know why the original package does not play well with Spacemacs, what issues did you fix with your own implementation ? |
@syl20bnr I honestly forgot what the problem was :) |
@mmainz thank you for the answer, I will just merge this PR and check for you how we can improve it. |
Any update on this? It would be nice to auto save buffer when losing focus. |
This PR broke with the update to 0.200.8, as it relies on --- a/layers/super-save/packages.el
+++ b/layers/super-save/packages.el
@@ -10,7 +10,7 @@
;;; License: GPLv3
(defconst super-save-packages
- '(window-numbering))
+ '(winum))
(defgroup super-save nil
"Smart-saving of buffers."
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? y
@@ -29,17 +29,17 @@
"evil-window-down"
"evil-window-left"
"evil-window-right"
- "select-window-by-number"
- "select-window-0"
- "select-window-1"
- "select-window-2"
- "select-window-3"
- "select-window-4"
- "select-window-5"
- "select-window-6"
- "select-window-7"
- "select-window-8"
- "select-window-9")
+ "winum-select-window-by-number"
+ "winum-select-window-0"
+ "winum-select-window-1"
+ "winum-select-window-2"
+ "winum-select-window-3"
+ "winum-select-window-4"
+ "winum-select-window-5"
+ "winum-select-window-6"
+ "winum-select-window-7"
+ "winum-select-window-8"
+ "winum-select-window-9")
"A list of commands which would trigger `super-save-command'."
:group 'super-save
:type '(repeat string))
Stage this hunk [y,n,q,a,d,/,K,j,J,g,e,?]? y
@@ -87,7 +87,7 @@
(super-save-mode (super-save-initialize))
(t (super-save-stop))))
-(defun super-save/post-init-window-numbering ()
+(defun super-save/post-init-winum ()
(super-save-mode +1))
;;; packages.el ends here I guess it could be debatable whether waiting for |
The above snippet auto-saves upon every |
Why not add |
@mmainz Are you still on this? |
This layer is inspired by Bozhidar Batsovs
super-save (https://github.com/bbatsov/super-save), but is adapted to
work with Spacemacs. Using the original package proved to be impractical
for integrating with Spacemacs, and since it is not a large package, the
functionality was reimplemented.
When you enable this layer, switching windows or Spacemacs losing focus
causes an automatic save to the current buffer.
I want to say I'm not very experienced in Emacs LISP, so if you see something weird in the code, it's probably because of that. Then again, there are only minor modifications to the original super-save code.
If for some reason you don't like to have this layer in the Spacemacs repository, no hard feelings. I can just put it in its own repository and use it from there. But I thought there might be other people like me that have forgotten how to save manually since using super-save :)