diff options
author | Bozhidar Batsov <bozhidar@tradeo.com> | 2015-01-25 14:36:57 +0200 |
---|---|---|
committer | Bozhidar Batsov <bozhidar@tradeo.com> | 2015-01-25 14:36:57 +0200 |
commit | 4bb032bbfc045c28dd724dad92d59bc1eaccd3b4 (patch) | |
tree | 4fe9ab9f271bf02c98fca67de02776fd8d2a0800 /cider-interaction.el | |
parent | 50f26217595c38ee913c8f961de01b151338086c (diff) |
Eval ns forms in the "user" namespace on interactive eval
Diffstat (limited to 'cider-interaction.el')
-rw-r--r-- | cider-interaction.el | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cider-interaction.el b/cider-interaction.el index a9504892..0cc70a41 100644 --- a/cider-interaction.el +++ b/cider-interaction.el @@ -1291,10 +1291,15 @@ If CALLBACK is nil use `cider-interactive-eval-handler'." (cider--clear-compilation-highlights) (-when-let (error-win (get-buffer-window cider-error-buffer)) (quit-window nil error-win)) - (nrepl-request:eval - form - (or callback (cider-interactive-eval-handler)) - (cider-current-ns))) + ;; always eval ns forms in the user namespace + ;; otherwise trying to eval ns form for the first time will produce an error + (let ((ns (if (cider-ns-form-p input) + "user" + (cider-current-ns)))) + (nrepl-request:eval + form + (or callback (cider-interactive-eval-handler)) + ns))) (defun cider--dummy-file-contents (form start-pos) "Wrap FORM to make it suitable for `cider-request:load-file'. |