diff --git a/CHANGELOG.md b/CHANGELOG.md index 3606c3108..aa29c9fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,10 @@ ### New features -* [#460](https://github.com/clojure-emacs/cider/issues/316) Support for cider-nrepl's complete middleware for CLJ/CLJS autocomplete. +* [#460](https://github.com/clojure-emacs/cider/issues/316) Support for +cider-nrepl's complete middleware for CLJ/CLJS autocomplete. +* [#469](https://github.com/clojure-emacs/cider/issues/469) Add option +`cider-prompt-save-file-on-load`. * New interactive command `cider-insert-defun-in-repl`. * New interactive command `cider-insert-ns-form-in-repl`. diff --git a/README.md b/README.md index 03df08af5..841d49447 100644 --- a/README.md +++ b/README.md @@ -211,6 +211,13 @@ Buffer name will look like *cider-repl project-name:port*. (setq cider-repl-print-length 100) ; the default is nil, no limit ``` +* Prevent C-c C-k from prompting to save the file corresponding to + the buffer being loaded, if it's modified: + +```el +(setq cider-prompt-save-file-on-load nil) +``` + * Change the result prefix for REPL evaluation (by default there's no prefix): ```el diff --git a/cider-interaction.el b/cider-interaction.el index ea08e1bac..8999eda98 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -87,6 +87,9 @@ which will use the default REPL connection." :type 'symbol :group 'cider) +(defcustom cider-prompt-save-file-on-load t + "Controls whether to prompt to save the file when loading a buffer.") + (defface cider-error-highlight-face '((((supports :underline (:style wave))) (:underline (:style wave :color "red") :inherit unspecified)) @@ -1242,7 +1245,8 @@ under point, prompts for a var." (check-parens) (unless buffer-file-name (error "Buffer %s is not associated with a file" (buffer-name))) - (when (and (buffer-modified-p) + (when (and cider-prompt-save-file-on-load + (buffer-modified-p) (y-or-n-p (format "Save file %s? " (buffer-file-name)))) (save-buffer)) (cider-load-file (buffer-file-name)))