This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-07-17
Channels
- # admin-announcements (22)
- # beginners (15)
- # boot (38)
- # cider (16)
- # clojure (68)
- # clojure-android (1)
- # clojure-berlin (27)
- # clojure-japan (7)
- # clojure-nl (7)
- # clojure-poland (2)
- # clojure-russia (164)
- # clojure-uk (2)
- # clojurescript (321)
- # datomic (42)
- # editors (45)
- # events (4)
- # indycljs (2)
- # jobs (7)
- # ldnclj (7)
- # liberator (4)
- # off-topic (29)
- # om (5)
- # onyx (8)
- # re-frame (6)
- # reagent (44)
- # slack-help (9)
thanks @cfleming
I’m still interested in feedback on the best way to select Clojure forms. Do people like CCW-style selection left/right extension? Something like mark-sexp? Move left/right while selecting?
IIRC the expanding selection was restricted to just the form? I would find it really useful if it then expanded to outer forms, so if cursor is between the ‘ll' (defn something [] (println “hello”)) I could expand once to select “hello”, expand again to select (println “hello”), expand again to select (defn….)
(is that what you are asking?)
At the moment I tend to move to front of the form and Cntr-Alt-delete
Emacs has mark-sexp, which marks the next sexp, and repeated invocations continues marking subsequent forms
A few people have asked for a version of move left/right which marks as you go, or if the movement commands could automatically expand/contract the selection.
excellent
I can’t see how I would use the left/right as that would surely mean your selection is unbalanced?
If you alt-up there, you’ll select (some-form). mark-sexp would select (some-form), then if you do it again you’d have (some-form)\n(some-other-form) selected, and so on.
So it’s for selecting multiple sibling forms. It’s something I want to do a surprising amount of the time. But all the options have a tricky balance between simplicity, flexibility, and adding a ton of commands (which all need keybindings etc)
ah OK, so you start outside the form. Yeah, I need that. The closest I have come is shift and down to highlight the lines and then shift+alt+left/right to end the selection. Muscle memory makes it not too painful
CCW style marking doesn’t require you to be outside the form - you could be inside (some-form), alt-up a couple of times to select it, then extend selection right.
I see. Yes from me then.
Not so fast. Note that you’ll need probably 4 new commands - extend/shrink left/right.
oh I see. So the ‘native’ IntelliJ selection isn’t sexp aware. Right.
Well, it is because Cursive extends it. But it’s purely hierarchical, up/down the sexp tree, not laterally into siblings.
I am reacting here, rather than thinking deeply, but couldn’t you make the behaviour you described the default behaviour in Clojure files? When would you not want the behaviour you described when selecting?
The problem is that the expand/shrink selection is baked into IntelliJ. I use it all the time in Java, for example.
I can reasonably trivially add extend left/right, but then you also probably need shrink left/right in case you accidentally go too far.
And not ‘wild’ in a good way I guess. It has been so long since I did anything in IntelliJ other than Clojure I forgot IntelliJ is used for other things 😉
In CCW, I guess Eclipse doesn’t have the expand/contract baked in, so there up is expand selection, left and right extend left and right, and down is “undo what I last did”.
and you can’t use this as a reason to get them to drop Java and pick up Clojure….. yeah OK, maybe not 😉
Additionally “undo what I last did” in IntelliJ is tricky because selection is complicated - multiple cursors, column selection mode, ugh
Yeah - undo-tree in emacs has spoilt all editors for me on that front. IntelliJ’s history is pretty close
Although this is a different kind of undo that only works on selections, since in IntelliJ at least undo doesn’t undo selection actions.
well for me, I could live in selection behaving one way in a Clojure file and a different way in a non-Clojure file as long as the semantics were the same.
I am sure what you come up with will be excellent based on previous experience Colin - I really don’t think I/we can say thank you enough.