Skip to content
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

New possible value for `cider-prompt-save-file-on-load' #1271

Merged
merged 1 commit into from
Aug 23, 2015
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
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 (`always-save`) 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,7 +429,10 @@ Buffer name will look like *cider-repl project-name:port*.
the buffer being loaded, if it's modified:

```el
;; Don't prompt and don't save
(setq cider-prompt-save-file-on-load nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nil -> noconfirm

;; Just save without prompting
(setq cider-prompt-save-file-on-load 'always-save)
```

* Change the result prefix for REPL evaluation (by default there's no prefix):
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 `always-save', 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 always-save :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 'always-save)
(y-or-n-p (format "Save file %s? " buffer-file-name))))
(save-buffer))
(cider-load-file buffer-file-name)))

Expand Down