Skip to content

add option to control whether loading a buffer prompts you to save the corresponding file #470

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

Merged
merged 1 commit into from
Feb 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kbd>C-c C-k</kbd> 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
Expand Down
6 changes: 5 additions & 1 deletion cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)))
Expand Down