-
-
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
Fix shortcut for REPL buffers when type is "any" #2484
Fix shortcut for REPL buffers when type is "any" #2484
Conversation
Test failures seem to be due to an upstream change: vspinu/sesman#10 |
cider-connection.el
Outdated
@@ -702,7 +702,8 @@ are synonyms. If ENSURE is non-nil, throw an error if either there is | |||
no linked session or there is no REPL of TYPE within the current session." | |||
(if (and (derived-mode-p 'cider-repl-mode) | |||
(or (null type) | |||
(string= cider-repl-type type))) | |||
(string= cider-repl-type type) | |||
(string= "any" type))) |
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.
Hmm, as any
and multi
can't be synonyms here maybe we should treat them differently by default? It also seems to me that this check should be after the null
check, so the code reads better.
On a related note - can you please change these types to be symbols instead of strings everywhere. It's very weird to pass around types as strings in Elisp and I guess this was just some oversight of ours when REPL types were added. For backward compatibility you can just coerce type arguments to symbol in methods like this one (there's a function cider-maybe-symbol
or something like this.
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.
Also - if we're using symbols we can use the more effecient eq
checks instead of string=
and equal
.
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.
Hmm, as any and multi can't be synonyms here maybe we should treat them differently by default?
How do you men differently?
I can take care of the rest.
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.
Well, in this particular code snippet passing "multi" will result in the same bug. :-) I'm saying this because in some places we treat "multi" and "any" as the same and somewhere differently. Probably we should agree they are different.
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.
The fix doesn't look quite right to me. This function becomes unreadable with all those if-else and cons.
Any objection against reverting #2467 and just adding (when (equal type "any") (setq type "multi"))
as the first line in the function?
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.
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 think it'd better to use something like (member type '(any multi))
instead of converting any
to multi
. As a said - there are cases where semantically they won't be exactly the same, so I'd rather keep them separate.
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 would need to be done at least twice in this function and at least once in the utility function. Plus there is already a re-assignment to "multi" in the let
part. I If the semantics of this function ever diverges one can modify it later, for now the simplicity of the code is more important. None of us noticed the issue with the original PR.
@kommen
sorry, by reverting I meant reverting the "any" implementation for this function only, not the whole patch
@kommen Ping :-) |
1d7a634
to
b21eb37
Compare
@bbatsov I've addressed two of your comments. Regarding changing the "clj", "cljs", "any" and "multi" repl types from strings to symbols: Line 1011 in d1eef83
You think it is fine to change it here as well? |
Yep. In the end there should be not strings referring to repl types, only symbols. |
cider-connection.el
Outdated
(scored-repls | ||
(delq nil | ||
(mapcar (lambda (b) | ||
(let ((bparams (cider--gather-connect-params nil b))) | ||
(when (eq cljsp (string-match-p "cljs" (plist-get bparams :repl-type))) | ||
(when (eq cljsp (string-match-p "cljs" |
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.
Anybody knows what cljsp
is supposed to be about? I assume it is to consider pending-cljs
repls to be reused by cljs
repls? But not sure.
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.
It's non-nil when it's either cljs or pending-cljs.
@bbatsov I've pushed the current state of my branch. Things still needed:
Not sure I will have time this week to address these though. |
This is ready for review. |
@kommen The code looks good. You just need to squash together all commits related to the transition from strings to symbols. |
CHANGELOG.md
Outdated
|
||
### Changes | ||
|
||
* [#2484](https://github.com/clojure-emacs/cider/pull/2484): REPL types are now symbols instead of strings |
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.
You forgot the .
here.
Thanks @bbatsov! I'll test this branch in day to day work somewhen this week to be more confident it doesn't break anything and then will address your comments. |
Sounds like a plan to me! |
48c8531
to
c06d707
Compare
Is the PR ready to go? |
using it the branch for day to day stuff i found some more issues stilll. i’d rather test it a bit more. |
but i don’t know of any remaining issues right now |
Well, if you work it day-to-day I guess it doesn't break anything major. :-) Anyways, I'm fine with you testing it longer if you prefer that. |
f3726df
to
1b3509a
Compare
Make public functions backwards compatible by converting type string to symbol
1b3509a
to
085d013
Compare
@bbatsov I've squashed the commits to combine them logically. As pauld on the slack also tried the branch and confirmed it fixed an issue for him, I think this should be good to merge. |
Thanks! |
Awesome job folks I have just bumped into this and wanted to say thanks! |
This fixes a regression from #2467 where in clojure repl buffers the cider eldoc feature stopped working.
Before submitting the PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
make test
)make lint
) which is based onelisp-lint
and includescheckdoc
, check-declare, packaging metadata, indentation, and trailing whitespace checks.Thanks!
If you're just starting out to hack on CIDER you might find this section of its
manual extremely useful.