-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Tidying up switch-to-relevant-buffer. #451
Conversation
@@ -158,17 +158,44 @@ of the current source file." | |||
(interactive "P") | |||
(if (not (cider-connected-p)) | |||
(message "No active nREPL connection.") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are they blank lines in the code? In Lisps blank lines are generally considered bad style.
You've removed |
My bad, just saw it now. |
I wonder if it makes sense to make |
Spaces removed and defcustom added. |
underlying project directories: | ||
|
||
```el | ||
(setq cider-repl-tab-command 'cider-switch-to-current-repl-buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be cider-switch-to-repl-command
:-)
Yeah I just saw and fixed :-) |
|
||
You can display the current nREPL connection using <kbd>C-c M-d</kbd> and rotate through available connections using <kbd>C-c M-r</kbd>. | ||
To explicitly choose the REPL buffer that <kbd>C-c C-z</kbd> uses based on project directory, use a double prefix <kbd>C-u C-u C-c C-z</kbd>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you should mention somewhere, that this assumes you're using cider-switch-to-relevant-repl
.
Fair enough I can fix that (although I think we're in extremely rare territory :-)). For the sake of simplicity I'd like to have a single msg that applies to all ambiguous cases, right now it's: "Could not determine relevant nREPL connection, using current...". So I could add a check to cider-find-connection-buffer-for-project-directory that doesn't return a match if there is more than one possible matching repl connection. |
Fair enough. You'll also have to rebase the final version of the branch against the current |
Fair enough = put the extra check into cider-find-connection-buffer-for-project-directory? |
Yes. |
Changes made. |
It's in good shape but lets merge this tomorrow, I'll review it all again in the am. |
Ready for review/merge & couple of things:
|
… against ambiguous switch.
^ 1 last commit to make terser the msg "Switch to REPL". Done for now :-) |
Tidying up switch-to-relevant-buffer.
|
||
CIDER maintains a list of nREPL connections and a single 'default' connection. When you execute CIDER commands in a Clojure editing buffer such as to compile a namespace, these commands are executed against the default connection. | ||
|
||
You can display the default nREPL connection using <kbd>C-c M-d</kbd> and rotate the default connection using <kbd>C-c M-r</kbd>. Another option for setting the default connection is to execute the command <kbd>M-x nrepl-make-repl-connection-default</kbd> in the appropriate REPL buffer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C-c M-d
and C-c M-r
have been removed right? Or have I missed something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only from cider-repl-mode
. They're still available in cider-mode
.
Just to add my experience, the project I'm working on has required me to connect to multiple repls on different machines as well as open 2 repls to the same project on my own machine :). I appreciate that I have the option to use the original |
@vedang where ambiguity exists cider-switch-to-relevant will behave the same as cider-switch-to-current, so for your use case there should be no difference apart from the message printed. That said, I can imagine how you'd want the most bare bones switching behavour possible given your scenario. |
Hi,
What's in here:
cider-switch-to-relevant-repl-buffer is mapped to C-c C-z. I've tidied related keybindings, and specially removed the ability to rotate and to display the current nrepl connection from the REPL mode (still exists for CIDER mode). It makes little sense to do it here, and generally I think it's good to prune where possible.
cider-switch-to-relevant-repl-buffer again takes 2 prefix args (first one does the namespace switch, second one triggers IDO to select project).
Switch will NOT be made based on project dir if there exists a REPL connection without a project dir. If this is so, then a message is printed.
Better message output when a switch is made.
Some notes:
I've kept cider-switch-to-repl-buffer around. This is because it's quite discreet in what it does and it does offer users an option if they dislike the funkier behavour. In time someone might remove it.
I've tried to make "Managing multiple sessions" in the readme a little more easy going. There are issues around the precise terminology to use, like "CIDER minor mode" vs "Clojure buffer", or "current nrepl connection" vs "default nrepl connection", "switch vs select".