Skip to content

Commit

Permalink
New possible value for `cider-prompt-save-file-on-load'
Browse files Browse the repository at this point in the history
  • Loading branch information
Malabarba committed Aug 22, 2015
1 parent faf708f commit 1edcbd0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### New features

* [#1271](https://github.com/clojure-emacs/cider/issues/1271): New possible value (`noconfirm`) for `cider-prompt-save-file-on-load`.
* [#1197](https://github.com/clojure-emacs/cider/issues/1197): Display some indication that we're waiting for a result for long-running evaluations.
* [#1127](https://github.com/clojure-emacs/cider/issues/1127): Make it possible to associate a buffer with a connection (via `cider-assoc-buffer-with-connection`).
* [#1217](https://github.com/clojure-emacs/cider/issues/1217): Add new command `cider-assoc-project-with-connection` to associate a project directory with a connection.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ Buffer name will look like *cider-repl project-name:port*.
the buffer being loaded, if it's modified:

```el
;; Don't prompt nor save
(setq cider-prompt-save-file-on-load nil)
;; Just save without prompting
(setq cider-prompt-save-file-on-load nil)
```

Expand Down
12 changes: 9 additions & 3 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,13 @@ which will use the default REPL connection."
:group 'cider)

(defcustom cider-prompt-save-file-on-load t
"Controls whether to prompt to save the file when loading a buffer."
:type 'boolean
"Controls whether to prompt to save the file when loading a buffer.
If nil, files are not saved.
If t, the user is prompted to save the file if it's been modified.
If the symbol `noconfirm', save the file without confirmation."
:type '(choice (const t :tag "Prompt to save the file if it's been modified")
(const nil :tag "Don't save the file")
(const noconfirm :tag "Save the file without confirmation"))
:group 'cider
:package-version '(cider . "0.6.0"))

Expand Down Expand Up @@ -2233,7 +2238,8 @@ The heavy lifting is done by `cider-load-file'."
(user-error "Buffer %s is not associated with a file" (buffer-name)))
(when (and cider-prompt-save-file-on-load
(buffer-modified-p)
(y-or-n-p (format "Save file %s? " buffer-file-name)))
(or (eq cider-prompt-save-file-on-load 'noconfirm)
(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 1edcbd0

Please sign in to comment.