summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--cider-interaction.el14
-rw-r--r--doc/miscellaneous_features.md3
3 files changed, 18 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2c7a62c3..e90985cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
### New Features
+* [#1990](https://github.com/clojure-emacs/cider/issues/1990): Add new customation variable `cider-prompt-save-file-on-cider-refresh` to allow auto-saving buffers when `cider-refresh` is called.
* Add new function `cider-load-all-files`, along with menu bar update.
* Add new customization variable `cider-special-mode-truncate-lines`.
* Add an option `cider-inspector-fill-frame` to control whether the cider inspector window fills its frame.
diff --git a/cider-interaction.el b/cider-interaction.el
index 30bc2cf6..dffa73a8 100644
--- a/cider-interaction.el
+++ b/cider-interaction.el
@@ -111,6 +111,17 @@ If the symbol `always-save', save the file without confirmation."
:group 'cider
:package-version '(cider . "0.6.0"))
+(defcustom cider-prompt-save-file-on-cider-refresh t
+ "Controls whether to prompt to save clojure file when calling ‘cider-refresh’.
+If nil, files are not saved.
+If t, the user is prompted to save files if it's been modified.
+If the symbol `always-save', save the files without confirmation."
+ :type '(choice (const t :tag "Prompt to save files if it's been modified")
+ (const nil :tag "Don't save the files")
+ (const always-save :tag "Save the files without confirmation"))
+ :group 'cider
+ :package-version '(cider . "0.15.0"))
+
(defcustom cider-completion-use-context t
"When true, uses context at point to improve completion suggestions."
:type 'boolean
@@ -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
+ (save-some-buffers (eq cider-prompt-save-file-on-cider-refresh 'always-save)
+ (lambda () (derived-mode-p 'clojure-mode))))
(cider-map-connections
(lambda (conn)
;; Inside the lambda, so the buffer is not created if we error out.
diff --git a/doc/miscellaneous_features.md b/doc/miscellaneous_features.md
index 0cca3366..b21779bd 100644
--- a/doc/miscellaneous_features.md
+++ b/doc/miscellaneous_features.md
@@ -145,6 +145,9 @@ and
(setq cider-refresh-show-log-buffer t)
```
+* By default, all Clojure buffers are prompted to be saved. This behaviour can be
+ customized using `cider-prompt-save-file-on-refresh`.
+
## Tracing function execution
You can trace the results produced by functions using <kbd>C-c M-t v</kbd>. The