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

Fix broken cider-eval-ns-form #3202

Merged
merged 3 commits into from
May 18, 2022

Conversation

danskarda
Copy link
Contributor

This pull request fixes bugs in cider-eval-ns-form introduced by recent addition of undef-all parameter:

  1. There was a typo in interactive parameter. "p" is a number which evaluates to true even if it is 0. Parameter is used in when condition, so undef-all branch is always executed.

  2. It uses magic value of (match-string 0). For me it returns string (ns and undef fails. Probably regexp in clojure-find-ns was recently changed, which broke cider-eval-ns-form without anybody noticing. I do not think it is a good idea to rely on magic side-effects of previous functions, so I replaced match-string with return value of cider-find-ns.

There is a last issue with undef in general. It undefs symbols of classes which are imported by default (eg Throwable). But I guess this is more an issue of nrepl middleware.

Copy link
Member

@vemv vemv left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the explanation, code makes sense to me as well.

Please update the changelog as surely we're good to go.

@danskarda
Copy link
Contributor Author

Changelog updated.

@yuhan0
Copy link
Contributor

yuhan0 commented May 18, 2022

Sorry about introducing so many bugs! I've just checked the other functions affected by that PR and they seem to be fine, it's just cider-eval-ns-form which escaped my attention because I've never used it.

The last point about symbols like Throwable being undef'ed was brought up in #3194, unfortunately it requires a update to cider-nrepl version after the fix is merged.

@bbatsov bbatsov merged commit e86f2f7 into clojure-emacs:master May 18, 2022
@bbatsov
Copy link
Member

bbatsov commented May 18, 2022

No worries! @danskarda Thanks for fixing this!

@bbatsov
Copy link
Member

bbatsov commented May 18, 2022

(I'll likely cut CIDER 1.4.1 after we merge the undef-all cider-nrepl update)

@vemv
Copy link
Member

vemv commented May 26, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants