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

Add negative prefix to cider-refresh for refresh only #1893

Closed
expez opened this issue Dec 20, 2016 · 6 comments
Closed

Add negative prefix to cider-refresh for refresh only #1893

expez opened this issue Dec 20, 2016 · 6 comments

Comments

@expez
Copy link
Member

expez commented Dec 20, 2016

Most of the time I want cider-refresh to call cider-refresh-before-fn and cider-refresh-after-fn but sometimes I only want the refresh. I've been using advice to add a negative arity branch to cider-refresh and it's pretty nice.

P.S. I've never been in a situation where I wanted to run before-fn or after-fn only so this won't lead to an explosion in hard to remember prefixes.

@bbatsov
Copy link
Member

bbatsov commented Dec 20, 2016

Sounds reasonable to me.

@dpsutton
Copy link
Contributor

Well, those functions are clojure code written as strings in elisp. Seems like they won't be too general across all projects. Does it make sense to have the prefix argument invoke the refresh functions and the default refresh behavior not call them? Would you prefer to prefix invoke the refresh functions or prefix escape them, I guess.

@expez
Copy link
Member Author

expez commented Dec 20, 2016

Well, those functions are clojure code written as strings in elisp.

No, cider just expects a name which resolves to a function, .e.g user/stop and user/start or user/cider-refresh-before.

Seems like they won't be too general across all projects.

Not sure why that matters, I want them to not be called when I give negative prefix. In any event, even though the name is the same, what user/start or user/cider-refresh-before, does in each project can be different.

Does it make sense to have the prefix argument invoke the refresh functions and the default refresh behavior not call them? Would you prefer to prefix invoke the refresh functions or prefix escape them, I guess.

We already have a prefix and a double prefix behavior, which we can't change without upsetting other people. So I don't want to change the current prefix options, just add another variant.

@dpsutton
Copy link
Contributor

I hadn't thought of their use like that, expez. The examples that I've seen have been defn forms written out. I like the way you use it. Thanks for explaining that.

And I missed that they already had prefix and double prefix. I thought there was only an invocation and the prefix option was blank. I'll get on this.

@dpsutton
Copy link
Contributor

So I've got the patch ready, I'm just wondering about a convention:


(let ((clear? (member mode '(clear 16)))
        (refresh-all? (member mode '(refresh-all 4)))
        (inhibit-refresh-fns (< mode 0)))

This is cider-refresh which takes an argument. You can see that it also takes some keywords. I can't find where these are invoked though. I'll add a keyword here but does anyone know where these keywords are used?

@bbatsov
Copy link
Member

bbatsov commented Dec 27, 2016

Fixed by #1899.

@bbatsov bbatsov closed this as completed Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants