On Thu, 8 Aug 2013 23:38:08 -0400, Alexey Radul <axo...@gmail.com> wrote: > > The one trick is, in > > |foo > > ! bar > > does forward-<anything>-sexp scope over just foo, or all of foo and > > bar? With actual s-expressions, there would be an explicit open paren > > there, so whether the cursor was in front of or behind it would > > determine the answer. The immortality of having implemented an > > excellent editor mode awaits anyone who can solve this problem (in a > > coherent and useful way).
This is a cogent question, and after thinking about it some more, I *think* I have one plausible answer. By default, choose to scope to the t-expression (not the n-expression) when the cursor is at at the beginning of an it-expression (this is the ambiguous case). In all other cases there is no ambiguity, so scope it to the n-expression. Then, add a special "scope-change" keystroke (either prefix or postfix) to handle the rare cases where this default is not intended. I think that's the right default, because nicely-formatted t-expressions almost never begin with the character "(". If an indenting sweet-expression (an "it-expression") begins with a neoteric-expression that is a list, it is typically formatted as "x(a b)", not as "(x a b)". Generally stuff that begins with "(" is legacy, not something formatted to t-expressions. So if you mean *JUST* the n-expression, you can normally just move your cursor to the later paren (which *is* visible). An n-expression *can* begin with "(", of course, so a special "scope-change" keystroke is appropriate for those rare cases. This default has the nice property that moving the cursor determines scope, which is what happens now anyway. Some examples... If the cursor is at the beginning of a t-expression ("|"=cursor): |bar(baz) quux zot zug A forward slurp would slurp the following *t-expression*: bar(|baz) quux zot ! zug If you mean to slurp just the first n-expression, move the cursor, e.g.: bar(|baz) quux zot zug A forward slurp would then produce: bar(|baz quux) zot zug If you didn't want to have to have different modes for sweet-expression and non-sweet-expression processing, you could make an exception for neoteric-expressions that begin with "(" at the beginning of an it-expression. In that case, many users might not notice a difference...! Of course, trying it out and experimenting with it is the only way to really determine if it makes sense, but it seems straightforward. --- David A. Wheeler ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk _______________________________________________ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss