Open arichiardi opened 9 years ago
Ok, so maybe I should ask questions here.
Currently, I would do, if the cursor is at the | location : expand right, expand left, expand left.
What we could do, is use expand up, and, instead of immediately selecting all the siblings inside the binding, it could select 'binding1 (map f coll)'
Is it what you're asking for?
If so, we could indeed add some logic to do that in paredit, e.g. something generic like :
2015-07-31 14:41 GMT+02:00 Andrea Richiardi notifications@github.com:
An idea for a possible feature (hijacked form expand-region.el). In Clojure, we usually have let blocks like this (where | is point):
(let [binding1 |(map f coll) binding2 :constant] ..do..)
I always want to select binding1 |(map f coll) together so that I can go to my repl and easily paste it after a def, like: (def binding1 (map f coll)), but at the second expand-region actually selects the whole content of the let.
We could probably easily implement it in CCW.
— Reply to this email directly or view it on GitHub https://github.com/laurentpetit/ccw/issues/831.
Laurent Petit
I am asking exactly something like that!
About the context, maybe just let
and friends is appropriate as my purpose is really only the one described...that is to be able to just write () ... def
in a repl and paste so that I can obtain a symbol bound to an expression.
The map literal has some corner cases. For instance when the key is a keyword.
I don't understand why key being a keyword is a corner case?
2015-07-31 16:18 GMT+02:00 Andrea Richiardi notifications@github.com:
I am asking exactly something like that!
About the context, maybe just let and friends is appropriate as my purpose is really only the one described...that is to be able to just write () ... def in a repl and paste so that I can obtain a symbol bound to an expression.
The map literal has some corner cases. For instance when the key is a keyword.
— Reply to this email directly or view it on GitHub https://github.com/laurentpetit/ccw/issues/831#issuecomment-126706800.
Laurent Petit
Because of this:
{:key1 |4
:key2 5}
> (def :key 4)
java.lang.RuntimeException: First argument to def must be a Symbol
Well you are right, if we remove the colon it would work.
I didn't say it would be interesting for exactly your use case. But that it also makes sense, for maps, to have an intermediate selection level which takes the key/value pair, e.g. for copy/paste elsewhere, or deletion, etc.
2015-07-31 16:29 GMT+02:00 Andrea Richiardi notifications@github.com:
Well you are right, if we remove the colon it would work.
— Reply to this email directly or view it on GitHub https://github.com/laurentpetit/ccw/issues/831#issuecomment-126708931.
Laurent Petit
Yes that's useful as well!
An idea for a possible feature (hijacked form
expand-region.el
). In Clojure, we usually have let blocks like this (where | is point):(let [binding1 |(map f coll) binding2 :constant] ..do..)
I always want to select binding1 |(map f coll) together so that I can go to my repl and easily paste it after a def, like: (def binding1 (map f coll)), but at the second expand-region actually selects the whole content of the let.
We could probably easily implement it in CCW.