-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
[#1990] Adds option to auto-save buffers when calling cider-refresh #1994
Conversation
The functionality probably doesn't need to be in the body of that let, and it would make sense if the first few lines were
This would look nicer as a function so we could sprinkle this around in other locations as well that I'm sure will make sense. One area of concern: in an IDE we would easily and care-free save all files. In emacs, it's possible we span multiple projects. Should we worry about filtering down to just the current project (using perhaps |
@@ -1541,6 +1552,9 @@ refresh functions (defined in `cider-refresh-before-fn' and | |||
(let ((clear? (member mode '(clear 16))) | |||
(refresh-all? (member mode '(refresh-all 4))) | |||
(inhibit-refresh-fns (member mode '(inhibit-fns -1)))) | |||
(when cider-prompt-save-file-on-cider-refresh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should limited only to project-specific buffers. It would be odd to save all Clojure buffers on refresh IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we had some function returning those, implementing something like this should trivial.
@dpsutton is completely right. |
I haven't felt the pain of this bug as I run prelude and have the autosaving all buffers on by default when switching. Perhaps this is an avenue that we could pursue? Rather than ensuring a particular project's files are saved, allow the user to enable CIDER to always save all buffers. This issue would seemingly go away, and we don't need to worry about project boundaries since the user is the one that gives explicit approval for CIDER to save all buffers all the time? The functionality is done in prelude through the use of advice. It works well but i've heard function advice is the unwelcome part of emacs lisp, but here's the functionality. I'm not saying that this is necessarily the correct way forward but it does skirt dealing with comparing file locations and notions of projects while making refreshing easier. |
I'm not sure what's the Prelude functionality you're referring to. I know I'll be extremely annoyed if I get warning about the unsaved source buffers in unrelated projects. I also know that getting this right is trivial, so I don't see the point in not doing it properly. |
the functionality i was talking about was prelude autosaving files when they lose focus:
I was just offering a different approach that would get us the same answers. I wouldn't have it ask but just continually save all clj(s|c) as you leave buffers.
True. I only wanted to point out a possible alternative. |
I wrote this a long time ago, but I recall it actually saved just the buffer you were into. It's pointless to save all buffers when you lose focus. |
I'll merge this and improve it myself. |
@bbatsov thanks for taking it on. Been a bit busy and haven't had the time to follow up on improving my elisp skills! |
Fixes #1990. Adds an option to auto-save buffers when calling cider-refresh. There is an option
cider-prompt-save-file-on-cider-refresh
which allows users to customize this behaviour. By default, the user is prompted for each clojure buffer to save.make test
)M-x checkdoc
warnings