Frank wrote:
What would make auto-enclose much more paredit like is automating the manipulation of parens. Not just adding a ) every time you type a ( but letting e you "slurp" expressions into the enclosing paren (whether [], {} or () parens) or "burp" them out, deleting empty pairs of parens, and so on.
Hey, did you happen to know about Command+', Command+Shift+", Command+(, Command+[, and Command+Shift+{ ? :-) They let you do exactly what I think you're saying.
1) Select an expression by either click+drag, double-clicking just inside any of ', ", (, [, {, }, ], or ), or, if you're at the keyboard, Command+Space when the text-cursor is positioned there. Note, the selection does not include the bracket/paren characters themselves, but up-to just inside them.
2) Press one of the above-mentioned Command key sequences. If you press the same one that you're already in, it will toggle between adding/removing that expression ("slurp"). If you press one of those Command-key sequences that is different than the expression, it will add that surrounding bracket around the expression, toggling it on and off ("burp").
- Chris
Paredit takes a bit of getting used to - precisely because you're leaning on the IDE more to manipulate expressions rather than adding/deleting characters but once you get used to it, it's awesome.
frank
Oops, for paren its Shift+Command+(, not Command+(.
On Thu, Apr 10, 2014 at 10:11 AM, Chris Muller asqueaker@gmail.com wrote:
Frank wrote:
What would make auto-enclose much more paredit like is automating the manipulation of parens. Not just adding a ) every time you type a ( but letting e you "slurp" expressions into the enclosing paren (whether [], {} or () parens) or "burp" them out, deleting empty pairs of parens, and so on.
Hey, did you happen to know about Command+', Command+Shift+", Command+(, Command+[, and Command+Shift+{ ? :-) They let you do exactly what I think you're saying.
- Select an expression by either click+drag, double-clicking just
inside any of ', ", (, [, {, }, ], or ), or, if you're at the keyboard, Command+Space when the text-cursor is positioned there. Note, the selection does not include the bracket/paren characters themselves, but up-to just inside them.
- Press one of the above-mentioned Command key sequences. If you
press the same one that you're already in, it will toggle between adding/removing that expression ("slurp"). If you press one of those Command-key sequences that is different than the expression, it will add that surrounding bracket around the expression, toggling it on and off ("burp").
- Chris
Paredit takes a bit of getting used to - precisely because you're leaning on the IDE more to manipulate expressions rather than adding/deleting characters but once you get used to it, it's awesome.
frank
On 10.04.2014, at 08:11, Chris Muller asqueaker@gmail.com wrote:
Frank wrote:
What would make auto-enclose much more paredit like is automating the manipulation of parens. Not just adding a ) every time you type a ( but letting e you "slurp" expressions into the enclosing paren (whether [], {} or () parens) or "burp" them out, deleting empty pairs of parens, and so on.
Hey, did you happen to know about Command+', Command+Shift+", Command+(, Command+[, and Command+Shift+{ ? :-) They let you do exactly what I think you're saying.
... if you use a US English keyboard layout.
- Bert -
- Select an expression by either click+drag, double-clicking just
inside any of ', ", (, [, {, }, ], or ), or, if you're at the keyboard, Command+Space when the text-cursor is positioned there. Note, the selection does not include the bracket/paren characters themselves, but up-to just inside them.
- Press one of the above-mentioned Command key sequences. If you
press the same one that you're already in, it will toggle between adding/removing that expression ("slurp"). If you press one of those Command-key sequences that is different than the expression, it will add that surrounding bracket around the expression, toggling it on and off ("burp").
- Chris
Paredit takes a bit of getting used to - precisely because you're leaning on the IDE more to manipulate expressions rather than adding/deleting characters but once you get used to it, it's awesome.
frank
Hey, did you happen to know about Command+', Command+Shift+", Command+(, Command+[, and Command+Shift+{ ? :-) They let you do exactly what I think you're saying.
... if you use a US English keyboard layout.
Yes, it works on US English keyboard's. Are you saying it doesn't on non? How could that be, since non-English surely needs all those same symbols too...?
On 10-04-2014, at 8:41 AM, Chris Muller asqueaker@gmail.com wrote:
Hey, did you happen to know about Command+', Command+Shift+", Command+(, Command+[, and Command+Shift+{ ? :-) They let you do exactly what I think you're saying.
... if you use a US English keyboard layout.
Yes, it works on US English keyboard's. Are you saying it doesn't on non? How could that be, since non-English surely needs all those same symbols too…?
But they’re not often in the same places. So the appropriate way to specify short-cuts would be cmd+( - leave out the shift because on a US kbd you have to shift to get ( but on a Madeupistan kbd you have ( with no shift but { requires shift-alt-meta2-richardstallman-opt to get to it.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful random insult:- Can't program his way out of a for-loop.
On 10 April 2014 16:11, Chris Muller asqueaker@gmail.com wrote:
Frank wrote:
What would make auto-enclose much more paredit like is automating the manipulation of parens. Not just adding a ) every time you type a ( but letting e you "slurp" expressions into the enclosing paren (whether [], {} or () parens) or "burp" them out, deleting empty pairs of parens, and so on.
Hey, did you happen to know about Command+', Command+Shift+", Command+(, Command+[, and Command+Shift+{ ? :-) They let you do exactly what I think you're saying.
- Select an expression by either click+drag, double-clicking just
inside any of ', ", (, [, {, }, ], or ), or, if you're at the keyboard, Command+Space when the text-cursor is positioned there. Note, the selection does not include the bracket/paren characters themselves, but up-to just inside them.
- Press one of the above-mentioned Command key sequences. If you
press the same one that you're already in, it will toggle between adding/removing that expression ("slurp"). If you press one of those Command-key sequences that is different than the expression, it will add that surrounding bracket around the expression, toggling it on and off ("burp").
Right, so that's part of it. By "slurp" I mean moving the inner brackets in (+ 1 (+ 2 3) 4) to (+ 1 (+ 2 3 4)). Moving from (+ 1 (+ 2 3 4)) to (+ 1 (+ 2 3) 4) would be to "burp" the 4 out of the inner expression.
In Smalltalk, I could see something like this happening. Ignore for the moment the fact that the code's clearly ridiculously side-effectful. You start with
self foo. self bar. self baz.
But you realise you should only send #bar under certain conditions. So you move your cursor before "self bar". You hit (, and your code changes to
self foo. (|) self bar. self baz.
where | indicates the cursor position. You type in the condition and right-arrow to move outside the parens. (Really, there needs to be a keypress called "move one expression forward"):
self foo. (self isBarrable)| self bar. self baz.
and you enter ifTrue: which, since it takes a block, adds a [] for you:
self foo. (self isBarrable) ifTrue: [|] self bar. self baz.
and then you can "slurp" the expression:
self foo. (self isBarrable) ifTrue: [self bar|]. self baz.
But then you realise that you only send #baz under the same condition, and you can slurp the next expression:
self foo. (self isBarrable) ifTrue: [ self bar. self baz|].
At a later time you change things so that the #baz send is unconditional, and you "burp" out the expression by moving the cursor inside the []s and hitting the "burp expression" command key.
self foo. (self isBarrable) ifTrue: [ self bar|]. self baz.
(I've also illustrated the editing experience autoformatting. In Lisp this is a no-brainer: if your code doesn't match Emacs indentation rules, it's wrong, end of discussion. (In Go, it's a _compiler error_ to deviate from One True Brace Style.))
I hope that explains what I wouldn't mind seeing in a Smalltalk text editor.
frank
- Chris
Paredit takes a bit of getting used to - precisely because you're leaning on the IDE more to manipulate expressions rather than adding/deleting characters but once you get used to it, it's awesome.
frank
.... I hope that explains what I wouldn't mind seeing in a Smalltalk text editor.
Yes, I've found myself doing that quite a bit and have not found a better way with Squeak than C&P. It's surprisingly cumbersome relative to seeing just one simple little close-brace in the way. But since I'm composing expressions mode, I don't like to fiddle with the closing brace on its own, so I C&P the expression. Yes, a hot-key for that would be nice.
Hey, thanks Chris for the reminder.
That gives me back the most used good things without the annoyances.
For my favourite " and ( it works with a German Keyboard layout (Win 7). Funny but ' does the same as ". [{ and| work if you temporarily switch to US Layout by ALT+SHIFT and happen to know their locations on the US Keyboard.
Cheers,
Herbert Am 10.04.2014 17:11, schrieb Chris Muller:
Frank wrote:
What would make auto-enclose much more paredit like is automating the manipulation of parens. Not just adding a ) every time you type a ( but letting e you "slurp" expressions into the enclosing paren (whether [], {} or () parens) or "burp" them out, deleting empty pairs of parens, and so on.
Hey, did you happen to know about Command+', Command+Shift+", Command+(, Command+[, and Command+Shift+{ ? :-) They let you do exactly what I think you're saying.
- Select an expression by either click+drag, double-clicking just
inside any of ', ", (, [, {, }, ], or ), or, if you're at the keyboard, Command+Space when the text-cursor is positioned there. Note, the selection does not include the bracket/paren characters themselves, but up-to just inside them.
- Press one of the above-mentioned Command key sequences. If you
press the same one that you're already in, it will toggle between adding/removing that expression ("slurp"). If you press one of those Command-key sequences that is different than the expression, it will add that surrounding bracket around the expression, toggling it on and off ("burp").
- Chris
Paredit takes a bit of getting used to - precisely because you're leaning on the IDE more to manipulate expressions rather than adding/deleting characters but once you get used to it, it's awesome.
frank
On 10-04-2014, at 10:13 AM, Herbert König herbertkoenig@gmx.net wrote:
Hey, thanks Chris for the reminder.
That gives me back the most used good things without the annoyances.
The enclose shortcuts have been in the system since, ooh, perhaps 1980? The important thing is that they don’t intrude, unlike automagically (and oh-so-often wrongly) adding close braces etc. It would be just fine to provide magic-key-( capability that added the close ) and put the cursor back in between them. Just don’t do it without being asked.
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful Latin Phrases:- Spero nos familiares mansuros. = I hope we'll still be friends.
squeak-dev@lists.squeakfoundation.org