-
-
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
Define command to run -main #1174
Conversation
"Run -main or FUNCTION, prompting for its namespace if necessary. | ||
With a prefix argument, prompt for function to run instead of -main." | ||
(interactive (list (when current-prefix-arg (read-string "Function name: ")))) | ||
(-when-let (response (nrepl-sync-request:eval |
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 be better to move this inlined code to a simple middleware op.
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.
Which middleware would you put it in? info
? ns
?
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.
But Idk... Isn't this a little narrow for a middleware?
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'd put it in ns. Middleware shouldn't be complex - it should just get some work done. The problem with evaluating strings is twofold:
- The meaning of the code is obscured by implementation details
- Even simple code can be problematic (in your case you're not using FQ names, which means that in some namespaces this code will misbehave)
All added. Along with clojure-emacs/cider-nrepl#221 |
(let* ((completions (mapcar #'cider--var-namespace vars)) | ||
(def (or (car cider--namespace-history) | ||
(car completions)))) | ||
(format "(#'%s/-main)" |
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.
Btw, shouldn't this cover the option of function
being used?
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.
Oops. :-)
Tests added and name fixed. |
👍 |
Fix #1011.
Something like this?
Not sure where to bind it.