Skip to content

Commit

Permalink
add option to control whether loading a buffer prompts you to save th…
Browse files Browse the repository at this point in the history
…e corresponding file

fixes gh-469
  • Loading branch information
cemerick committed Feb 5, 2014
1 parent 2f99279 commit 1948664
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
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

0 comments on commit 1948664

Please sign in to comment.