-
Notifications
You must be signed in to change notification settings - Fork 112
Introduce cljr-building-ast-cache?
#408
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
Conversation
perhaps a before and after hook would be much nicer and more useful too. would be easy to implement the above with them and more. |
and thanks for investing your time and energy :) |
✌️ Note that at least in the project I'm hacking on, analysis happens twice on startup: So, for example, a callback that issued a Internally, the user-built helper would have to use internal variables. Which is kind of a roundabout way of doing what my proposed commit does. I had planned to do this in my emacs.d:
i.e. the user may have to try the command a second time, which can be simpler than having callbacks, excess variables, etc WDYT? |
I don't think it should happen twice. I can only try to reproduce in the evening tho |
hooks vs variable: I just think hooks are a more generic way for client code to interact with and also a superset of what you are proposing |
clj-refactor.el
Outdated
(cljr--call-middleware-async | ||
(cljr--create-msg "warm-ast-cache") | ||
(lambda (res) | ||
(cljr--maybe-rethrow-error res) | ||
(cljr--maybe-nses-in-bad-state res) | ||
(setq cljr-building-ast-cache? nil) |
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 the first thing, or it's going to report t
because an error was rethrown, right?
Finally, there's only one byte-compilation warning:
Dunno how to fix, also hesitant about improving it since you may dislike the empty lambdas (see diff) in the first place. |
clj-refactor.el
Outdated
:group 'cljr | ||
:type 'function) | ||
|
||
(defcustom cljr-after-warming-ast-cache-hook (lambda (response)) |
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.
Think it's customary to use nil
as the default here, and then put the funcall
below in a when
.
In any event, I'd prefer something a little less elegant over a compile warning about unused locals.
@vemv any progress on this? no rush, but as far as i can see there is a only a small step missing (see expez's comment) |
Hi, sorry I'm having a busy week! I'll do it asap |
no rush really. just did not want this to slip through the cracks |
This is somewhat unrelated, but you can fix unused argument warnings by prepending the argument name with an underscore (to signify to the compiler that you intend the variable to be unused). |
Allows to reload code at the right time, avoiding clojure-emacs/refactor-nrepl#134
Feedback addressed, branch rebased against master. Tested out again and the callbacks keep working. |
Thanks for seeing this through, @vemv! 👍 |
Allows one to build helpers to reload code at the right time, avoiding clojure-emacs/refactor-nrepl#134
As this is a simple variable, not sure if should go into changelog/readme?
Cheers - Victor