Skip to content

Add defcustom inf-clojure-prompt-when-set-ns #46

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
Mar 3, 2017
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 @@ -5,6 +5,7 @@
### New Features

* [#34](https://github.com/clojure-emacs/inf-clojure/pull/34): Add support for socket REPL connections.
* [#46](https://github.com/clojure-emacs/inf-clojure/pull/46): Make it possible to disable prompt on `inf-clojure-set-ns`.
* New interactive command `inf-clojure-display-version`.

### Bugs Fixed
Expand Down
15 changes: 13 additions & 2 deletions inf-clojure.el
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ This should usually be a combination of `inf-clojure-prompt' and
:type 'regexp
:group 'inf-clojure)

(defcustom inf-clojure-prompt-on-set-ns t
"Controls whether to prompt when switching namespace."
:type '(choice (const :tag "always" t)
(const :tag "never" nil))
:group 'inf-clojure)

(defvar inf-clojure-buffer nil
"The current inf-clojure process buffer.

Expand Down Expand Up @@ -620,8 +626,13 @@ See variable `inf-clojure-ns-vars-command'."

(defun inf-clojure-set-ns (ns)
"Set the ns of the inferior Clojure process to NS.
Defaults to the ns of the current buffer."
(interactive (inf-clojure-symprompt "Set ns to" (clojure-find-ns)))
Defaults to the ns of the current buffer, always prompting before
setting, unless `inf-clojure-prompt-on-set-ns` is nil."
(interactive (list (if inf-clojure-prompt-on-set-ns
(inf-clojure-symprompt "Set ns to" (clojure-find-ns))
(clojure-find-ns))))
(when (or (not ns) (equal ns ""))
(user-error "No namespace selected"))
(comint-proc-query (inf-clojure-proc) (format inf-clojure-set-ns-command ns)))

(defun inf-clojure-apropos (var)
Expand Down