"Fix indentation as you type" : yeah, it's there!

162 views
Skip to first unread message

Laurent PETIT

unread,
Jul 25, 2013, 6:08:18 PM7/25/13
to clojuredev-users
Hello,

I'm happy to release to the wild the first alpha version of
Counterclockwise featuring what I've called the "autoshift" feature.

## tl;dr
- It's alpha.
- I need feedback.
- Update Site: http://updatesite.ccw-ide.org/branch/autoshift/autoshift-travis000104-git40b4075e5c7694be23892195c18e1c27e6371037/
- Standalone version:
http://updatesite.ccw-ide.org/branch/autoshift/autoshift-travis000104-git40b4075e5c7694be23892195c18e1c27e6371037/products/

## What is that?
- Well, while you type, the lines of code that need to be shifted
right or left are shifted right or left. - Automatically.

## Does it preserve my carefully handcrafted indentation?
- Yes. It's not "autoreindent", it's "autoshift". You manually "shift"
some form to right (you added chars in front of it), or to the left
(you deleted chars in front of it) => the following lines that need to
also be move are shifted by the same delta.

## Is it buggy?
- Oh yes, I bet on it.
- And that's *why* I need you! I've created a separate "autoshift" branch

## I want to help debug it, how?

- Find standalone version, that you can download and install without
touching your current Eclipse, here:
http://updatesite.ccw-ide.org/branch/autoshift/autoshift-travis000104-git40b4075e5c7694be23892195c18e1c27e6371037/products/

- from Update Site: uninstall your current version of
Counterclockwise, and reinstall from
http://updatesite.ccw-ide.org/branch/autoshift/autoshift-travis000104-git40b4075e5c7694be23892195c18e1c27e6371037/

## What are the current known limitations?

- not (yet) automatically applied after some paredit commands. (e.g.
after "raise over")
- not (yet) integrated with copy/cut/paste.

Cheers,

--
Laurent

Laurent PETIT

unread,
Jul 25, 2013, 6:12:01 PM7/25/13
to clojuredev-users
Ah! I forgot to mention that it works well with Tab! => Tab now
reindents not just the current line, but also all the dependent ones!

2013/7/26 Laurent PETIT <lauren...@gmail.com>:

Softaddicts

unread,
Jul 25, 2013, 6:31:02 PM7/25/13
to clojured...@googlegroups.com
Glad it's called autoshiFt :)

Luc P.
> --
> You received this message because you are subscribed to the Google Groups "counterclockwise-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clojuredev-use...@googlegroups.com.
> To post to this group, send email to clojured...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojuredev-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
Softaddicts<lprefo...@softaddicts.ca> sent by ibisMail from my ipad!

Laurent PETIT

unread,
Jul 25, 2013, 6:42:50 PM7/25/13
to clojuredev-users
2013/7/26 Softaddicts <lprefo...@softaddicts.ca>:
> Glad it's called autoshiFt :)

LOL

Lee Spector

unread,
Jul 25, 2013, 6:50:00 PM7/25/13
to clojured...@googlegroups.com

On Jul 25, 2013, at 6:12 PM, Laurent PETIT wrote:

> Ah! I forgot to mention that it works well with Tab! => Tab now
> reindents not just the current line, but also all the dependent ones!

If one *does* want re-indentation (= ignore how I may have messed it up and indent according to the rules) then does one have to fight with this?

I should probably try to see... but: I'm really happy to see the standalone version links! But if I download and run one of those is there a chance it will mess up my existing installation through preference files that are stored in some common place, etc? I don't really understand how Eclipse does things and the setup seems a bit fragile... which is also why I'm also often hesitant to try new versions, because I have a sense that mysterious complications can arise and that it can be complicated to revert....

-Lee

Laurent PETIT

unread,
Jul 25, 2013, 6:59:36 PM7/25/13
to clojuredev-users
2013/7/26 Lee Spector <lspe...@hampshire.edu>:
>
> On Jul 25, 2013, at 6:12 PM, Laurent PETIT wrote:
>
>> Ah! I forgot to mention that it works well with Tab! => Tab now
>> reindents not just the current line, but also all the dependent ones!
>
> If one *does* want re-indentation (= ignore how I may have messed it up and indent according to the rules) then does one have to fight with this?

No fight. Only peace ;-)

If there's a mess at some point, or you really want the re-indentation
feature, just select the relevant lines, then type Ctrl+i (Cmd+i on OS
X)


> I should probably try to see... but: I'm really happy to see the standalone version links! But if I download and run one of those is there a chance it will mess up my existing installation through preference files that are stored in some common place, etc?

Not that I'm aware of.

Eclipse stores "Installation" related stuff inside the Eclipse
directory you created when you unzipped it. It will be the same for
Counterclockwise Standalone.

Then an Eclipse "Installation" can be started on a Workspace. Then you
can switch to another workspace. Or restart to another workspace. Each
workspace keeps its metadata in a .metadata/ folder inside the
workspace's root dir (that's where you find the relevant Eclipse logs
for instance).

So if you don't want to have your project settings messed up, better
copy your workspace also, and indicate the copy when the Standalone
application will first start.

>I don't really understand how Eclipse does things and the setup seems a bit fragile... which is also why I'm also often hesitant to try new versions, because I have a sense that mysterious complications can arise and that it can be complicated to revert....

Generally, if you backup your workspace and do not install the new
Eclipse "on top" (in the same folder) as the existing one, things
should be okay.

Also note that if your projects folders live outside the workspace
folder (they are just "referenced" from the workspace, then), then of
course their content will be shared between the 2 Eclipse, and it's up
to you to decide if you want that, or not.

Cheers,

--
Laurent

Laurent PETIT

unread,
Jul 25, 2013, 7:03:56 PM7/25/13
to clojuredev-users
For contributors: please note that the "autoshift" branch is Work In
Progress, and will be heavily interactively rebased eventually.

2013/7/26 Laurent PETIT <lauren...@gmail.com>:

Lee Spector

unread,
Jul 25, 2013, 7:16:01 PM7/25/13
to clojured...@googlegroups.com

On Jul 25, 2013, at 6:59 PM, Laurent PETIT wrote:
>
> No fight. Only peace ;-)
>
> [etc]

All of this sounds great, Laurent. Very helpful and I'll probably try new versions more readily now.

-Lee

Laurent PETIT

unread,
Jul 28, 2013, 6:21:21 PM7/28/13
to clojuredev-users
I've "promoted" the autoshift stuff into the beta channel, meaning
you'll be able to update via the software update site
http://updatesite.ccw-ide.org/beta

This is an experimental feature, so there's a way to disable it if you
find it too awkward for some reason, and I'm not able to fix it
quickly enough:
Window > Preferences > Clojure > Editor > [EXPERIMENTAL - Autoshift]

The Standalone Counterclockwise product corresponding to the latest
beta to date is here:

http://updatesite.ccw-ide.org/branch/master/master-travis000109-git7e5003cc8c3744d2e6dfa716ade8976072f055ab/products/


Cheers,

--
Laurent




2013/7/26 Lee Spector <lspe...@hampshire.edu>:

Niels van Klaveren

unread,
Jul 29, 2013, 4:25:22 AM7/29/13
to clojured...@googlegroups.com
The zips for the standalone version seem to be corrupt. All are 15/16M big, which is 0.1 of the previous version size, so I guess something went wrong there..

Laurent PETIT

unread,
Jul 29, 2013, 11:11:30 AM7/29/13
to clojuredev-users
2013/7/29 Niels van Klaveren <niels.va...@gmail.com>:
> The zips for the standalone version seem to be corrupt. All are 15/16M big,
> which is 0.1 of the previous version size, so I guess something went wrong
> there..

You're right, my bad. The server ran out of disk, and the scripts (and
I) didn't notice.

Made some space, and have triggered a new build for the master branch.
Will update the beta software update site files as soon as the build
is finished.

Cheers,

--
Laurent

Laurent PETIT

unread,
Jul 29, 2013, 11:39:01 AM7/29/13
to clojuredev-users
OK, the Travis build 110 worked and you can find the standalone products here:

http://updatesite.ccw-ide.org/branch/master/master-travis000110-git2fa7bea99be49b487b1bfd32c8edb5cb47ba12aa/products/

I've also updated the beta branch: http://updatesite.ccw-ide.org/beta/


2013/7/29 Laurent PETIT <lauren...@gmail.com>:

Justin Kramer

unread,
Jul 30, 2013, 8:12:38 AM7/30/13
to clojured...@googlegroups.com
Pretty excited about this feature! Just upgraded and noticed a few issues:

1) Alt+R now inserts ® instead of raising the form. (I was previously using 0.20.0.master-travis000102-git75512b6843a242e2ab3c9f4057c42c884653b2ea which worked correctly.)

2) Given this:

(defn foo [bar]
  (baz
    qux
    corg))

Select "(baz...)". Type "(let[" then ENTER. Indenting happens as you type, but the "qux" and "corg" lines are not actually indented properly: it's one space off, since it did not indent after the initial opening parenthesis; an additional tab is necessary to correct it.

3) After the scenario listed in 2 above, pressing Cmd+Z several times scrolls the editor upward (unnecessarily) in addition to undoing.

Justin

Laurent PETIT

unread,
Jul 30, 2013, 8:18:51 AM7/30/13
to clojuredev-users
2013/7/30 Justin Kramer <jkkr...@gmail.com>:
> Pretty excited about this feature! Just upgraded and noticed a few issues:
>
> 1) Alt+R now inserts ® instead of raising the form. (I was previously using
> 0.20.0.master-travis000102-git75512b6843a242e2ab3c9f4057c42c884653b2ea which
> worked correctly.)

Ahh, I noticed this also, I thought it was just my configuration ...
you're on OS X ?

>
> 2) Given this:
>
> (defn foo [bar]
> (baz
> qux
> corg))
>
> Select "(baz...)". Type "(let[" then ENTER. Indenting happens as you type,
> but the "qux" and "corg" lines are not actually indented properly: it's one
> space off, since it did not indent after the initial opening parenthesis; an
> additional tab is necessary to correct it.

Yeah, this is expected: currently, the mechanism is generic, and only
the forms *after* the text edit are shifted.

I will extend the mechanism, specifically, for the inners of what is
modified, by calling it after commands such as "Raise over", "Open
paren", etc.

> 3) After the scenario listed in 2 above, pressing Cmd+Z several times
> scrolls the editor upward (unnecessarily) in addition to undoing.

Oh, this is annoying indeed. Maybe I should try another approach for
marking the "additionally edited" (indented) region.

Justin Kramer

unread,
Jul 30, 2013, 8:37:26 AM7/30/13
to clojured...@googlegroups.com
On Tuesday, July 30, 2013 8:18:51 AM UTC-4, laurent.petit wrote:
2013/7/30 Justin Kramer <jkkr...@gmail.com>:
> Pretty excited about this feature! Just upgraded and noticed a few issues:
>
> 1) Alt+R now inserts ® instead of raising the form. (I was previously using
> 0.20.0.master-travis000102-git75512b6843a242e2ab3c9f4057c42c884653b2ea which
> worked correctly.)

Ahh, I noticed this also, I thought it was just my configuration ...
you're on OS X ?


Yep. In addition to Alt+R/S/J, can't seem to get slurp/barf to work, either.
 
>
> 2) Given this:
>
> (defn foo [bar]
>   (baz
>     qux
>     corg))
>
> Select "(baz...)". Type "(let[" then ENTER. Indenting happens as you type,
> but the "qux" and "corg" lines are not actually indented properly: it's one
> space off, since it did not indent after the initial opening parenthesis; an
> additional tab is necessary to correct it.

Yeah, this is expected: currently, the mechanism is generic, and only
the forms *after* the text edit are shifted.

I will extend the mechanism, specifically, for the inners of what is
modified, by calling it after commands such as "Raise over", "Open
paren", etc.

Ok, sounds good. It still beats having to perform the "tab-down-tab-down-tab-down-tab" ritual :-)
 

> 3) After the scenario listed in 2 above, pressing Cmd+Z several times
> scrolls the editor upward (unnecessarily) in addition to undoing.

Oh, this is annoying indeed. Maybe I should try another approach for
marking the "additionally edited" (indented) region.

Thanks for your hard work!

Justin 

Niels van Klaveren

unread,
Jul 30, 2013, 9:01:13 AM7/30/13
to clojured...@googlegroups.com
Barfage/slurpage and Alt-R raising aren't working either in this new version under Windows (x64, Indigo & beta channel)

Laurent PETIT

unread,
Jul 30, 2013, 11:35:44 AM7/30/13
to clojuredev-users
Ok, so I messed up things with the interaction with those commands.
Will look at it quickly.

Note 1 : it is possible to deactivate the feature globally via
preferences > Clojure > Editor > ... if you're missing the
barfage/slurpage/etc. stuff (which I can understand ;-)

Note 2 : When you type the Esc. Key, it disables the autoshift feature
for the next keystroke, as it is already disabling the rest of paredit
features.


2013/7/30 Niels van Klaveren <niels.va...@gmail.com>:

Laurent PETIT

unread,
Jul 31, 2013, 6:53:38 AM7/31/13
to clojuredev-users
2013/7/30 Justin Kramer <jkkr...@gmail.com>:
> On Tuesday, July 30, 2013 8:18:51 AM UTC-4, laurent.petit wrote:
>>
>> 2013/7/30 Justin Kramer <jkkr...@gmail.com>:
>> > Pretty excited about this feature! Just upgraded and noticed a few
>> > issues:
>> >
>> > 1) Alt+R now inserts ® instead of raising the form. (I was previously
>> > using
>> > 0.20.0.master-travis000102-git75512b6843a242e2ab3c9f4057c42c884653b2ea
>> > which
>> > worked correctly.)
>>
>> Ahh, I noticed this also, I thought it was just my configuration ...
>> you're on OS X ?
>>
>
> Yep. In addition to Alt+R/S/J, can't seem to get slurp/barf to work, either.

Fixed and released in beta. It was a dumb error on my part, easily
fixed. Released in beta channel.

Standalone products:

http://updatesite.ccw-ide.org/branch/master/master-travis000114-gitbc2712908c29dbddedf65238febfd743dffa153d/products/

Laurent PETIT

unread,
Aug 2, 2013, 1:42:54 AM8/2/13
to clojuredev-users
New beta in http://updatesite.ccw-ide.org/beta/

This beta fixes a number of bugs with the feature,

and also introduces the first "autoshift-aware" paredit command:
"Raise over" (Alt+R)

More will follow when I'm back from vacations.

Standalone products:

http://updatesite.ccw-ide.org/branch/master/master-travis000120-git7f18a374a4a23e167295614c94fba12282186f3f/products/

Cheers,

--
Laurent


2013/7/31 Laurent PETIT <lauren...@gmail.com>:

Timo Mihaljov

unread,
Aug 6, 2013, 12:42:18 AM8/6/13
to clojured...@googlegroups.com
On 26.07.2013 01:08, Laurent PETIT wrote:
> I'm happy to release to the wild the first alpha version of
> Counterclockwise featuring what I've called the "autoshift" feature.

I just gave it a quick try (from a build of the master branch). What a
great feature!

--
Timo

Laurent PETIT

unread,
Sep 5, 2013, 3:41:12 PM9/5/13
to clojuredev-users
Hi,

Status update: after recovering from the holidays, and having fought
bravely clojure zippers to make them do what I want, I've finally been
able to push a new beta release of Counterclockwise.

It addresses all the outstanding issues the young "autoshift" feature
had in the previous beta ( weird behaviours in the editor, total
inability to use the repl's editor anymore).

Please give it a try.

Next week I will create a new stable release, unless more problems
have been reported with the autoshift feature.

The main question will be: should I enable it by default, or let
people go to the Clojure Preferences to enable it?

I would really like to enable it by default, but it will all depend on
the feedback (or lack of) I will receive until next thursday.

Those who follow the master branch software update site can directly
update from http://updatesite.ccw-ide.org/branch/master/

Or you can install by directly pointing to the version's specific update site:
http://updatesite.ccw-ide.org/branch/master/master-travis000126-gitcd826fde979c1b13a4cb8acce5409ae88c761b81/

As usual, you can do a safe try by downloading the whole standalone
IDE and giving it a try without touching your installation:

http://updatesite.ccw-ide.org/branch/master/master-travis000126-gitcd826fde979c1b13a4cb8acce5409ae88c761b81/products/


Cheers,

--
Laurent

2013/8/6 Timo Mihaljov <ti...@mihaljov.info>:

Laurent PETIT

unread,
Sep 6, 2013, 4:44:15 PM9/6/13
to clojuredev-users
I forgot to update the beta branch itself, for those not willing to
follow every commit to the master branch!

It's fixed, and the beta is now available at:

http://updatesite.ccw-ide.org/beta/

Cheers,

--
Laurent

2013/9/5 Laurent PETIT <lauren...@gmail.com>:

Timo Mihaljov

unread,
Sep 7, 2013, 4:00:58 AM9/7/13
to clojured...@googlegroups.com
On 05.09.2013 22:41, Laurent PETIT wrote:
> Next week I will create a new stable release, unless more problems
> have been reported with the autoshift feature.
>
> The main question will be: should I enable it by default, or let
> people go to the Clojure Preferences to enable it?
>
> I would really like to enable it by default, but it will all depend on
> the feedback (or lack of) I will receive until next thursday.

I haven't yet had a chance to play with the updated autoshift, but the
first version was already such an improvement to the editing experience
that I can't imagine turning it off (or using an editor that doesn't
have it :-). Here's a +1 for enabling it by default.

--
Timo

John Szakmeister

unread,
Sep 7, 2013, 8:03:59 AM9/7/13
to clojured...@googlegroups.com
I've been using it for the past day or so... I really like it too. +1
from me as well.

Thank you Laurent!

-John

Laurent PETIT

unread,
Sep 7, 2013, 8:51:51 AM9/7/13
to clojured...@googlegroups.com
Hi John, thanks for the feedback. 
Don't hesitate to report again in a few days after more time spent using it. 

Cheers,

Laurent 

Thank you Laurent!

-John

Justin Kramer

unread,
Sep 10, 2013, 7:46:35 AM9/10/13
to clojured...@googlegroups.com
Some feedback after having used it for a few days:

* Much improved experience from the previous version (I had disabled it after encountering the weird REPL behavior).

* Seeing some erratic scrolling behavior when undoing changes.

* Still occasionally resort to the "down, tab, down, tab, down, tab" dance to re-indent lines, since it's often one or two spaces off.

* A bug showed up that I'm not sure is related to this, but only appeared recently. Turning off autoshift doesn't fix it. When you have hanging parens/brackets with cursor positioned at |:

(foo|
  )

Pressing ) results in:

(foo
)|

I run into this a lot.

Despite minor issues, I'm happy overall with autoshift and think having it on by default is a good idea.

Justin

Laurent PETIT

unread,
Sep 10, 2013, 7:53:40 AM9/10/13
to clojuredev-users
2013/9/10 Justin Kramer <jkkr...@gmail.com>:
> Some feedback after having used it for a few days:
>
> * Much improved experience from the previous version (I had disabled it
> after encountering the weird REPL behavior).
>
> * Seeing some erratic scrolling behavior when undoing changes.

Indeed, this is annoying, and may be due to the way Eclipse handles
multiple "edit commands" at once.
I'll see whether I can improve it (maybe by mergint the edits by
myself, and thus only handing a single edit to the Eclipse framework).

> * Still occasionally resort to the "down, tab, down, tab, down, tab" dance
> to re-indent lines, since it's often one or two spaces off.

I don't understand this one, and would like some more explanation,
please. Is this due to erratic behaviour, or a systematic "hole" in
the autoshift feature, or another usecase ? Even if another usecase,
if you can explain it with a detailed example, I'd be happy.

> * A bug showed up that I'm not sure is related to this, but only appeared
> recently. Turning off autoshift doesn't fix it. When you have hanging
> parens/brackets with cursor positioned at |:
>
> (foo|
> )
>
> Pressing ) results in:
>
> (foo
> )|
>
> I run into this a lot.

Right, that's a regression due to changes in the grammar parse tree. I
must fix it before going stable.


> Despite minor issues, I'm happy overall with autoshift and think having it
> on by default is a good idea.

Sure, so I'll fix issues with the goal of having the option set by default.

Expect a new beta this thursday.

Justin Kramer

unread,
Sep 10, 2013, 12:23:35 PM9/10/13
to clojured...@googlegroups.com
On Tuesday, September 10, 2013 7:53:40 AM UTC-4, laurent.petit wrote:
2013/9/10 Justin Kramer <jkkr...@gmail.com>:

> * Still occasionally resort to the "down, tab, down, tab, down, tab" dance
> to re-indent lines, since it's often one or two spaces off.

I don't understand this one, and would like some more explanation,
please. Is this due to erratic behaviour, or a systematic "hole" in
the autoshift feature, or another usecase ? Even if another usecase,
if you can explain it with a detailed example, I'd be happy. 

Let's say I have this form:

(let [foo 1
      bar 2])

I want to wrap it in a "when" clause, so I select the entire form, and type "(when true" then press ENTER. I now have this:

(when true
  (let [foo 1
       bar 2]))

The "bar 2" line is improperly indented, so I press DOWN a couple times, then TAB to indent it.

This kind of scenario happens all the time, except with more nesting and more DOWN/TAB/DOWN/TAB necessary to correct the indentation.

Hope that clarifies,

Justin

Laurent PETIT

unread,
Sep 10, 2013, 12:37:48 PM9/10/13
to clojured...@googlegroups.com
Right, because I've only added autoshift with the raise over command right now. 
But even there, as compared to before, I expect that you just need (in your example) to type tab in 2 lines ('let case): the second line, and the line after the bindings. Right ? 

I will se how hard it would be to support more paredit commands before the stable version. 


Hope that clarifies,

Justin

Justin Kramer

unread,
Sep 10, 2013, 1:30:39 PM9/10/13
to clojured...@googlegroups.com
On Tuesday, September 10, 2013 12:37:48 PM UTC-4, laurent.petit wrote:


Le mardi 10 septembre 2013, Justin Kramer a écrit :
On Tuesday, September 10, 2013 7:53:40 AM UTC-4, laurent.petit wrote:
2013/9/10 Justin Kramer <jkkr...@gmail.com>:

> * Still occasionally resort to the "down, tab, down, tab, down, tab" dance
> to re-indent lines, since it's often one or two spaces off.

I don't understand this one, and would like some more explanation,
please. Is this due to erratic behaviour, or a systematic "hole" in
the autoshift feature, or another usecase ? Even if another usecase,
if you can explain it with a detailed example, I'd be happy. 

Let's say I have this form:

(let [foo 1
      bar 2])

I want to wrap it in a "when" clause, so I select the entire form, and type "(when true" then press ENTER. I now have this:

(when true
  (let [foo 1
       bar 2]))

The "bar 2" line is improperly indented, so I press DOWN a couple times, then TAB to indent it.

This kind of scenario happens all the time, except with more nesting and more DOWN/TAB/DOWN/TAB necessary to correct the indentation.

Right, because I've only added autoshift with the raise over command right now. 
But even there, as compared to before, I expect that you just need (in your example) to type tab in 2 lines ('let case): the second line, and the line after the bindings. Right ? 

Right, but in practice, I just hammer down/tab repeatedly to avoid the mental overhead of deciding what does or does not need correction. I like not having to think about indentation at all ;-)
 
I will se how hard it would be to support more paredit commands before the stable version. 

Thanks!

Justin 
Reply all
Reply to author
Forward
0 new messages