Save method twice to update formatting in cls

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Save method twice to update formatting in cls

Mark Wilden
The formatting of the source in the .cls files doesn't match what I see in
the browser. I have auto-format-on-accept turned on, so I'll type a line
more or less free-flow, accept it, and continue typing. After I save the
package in PAX format, the resulting cls doesn't appear to include that last
reformatting--it shows the last edits I made, though.


Reply | Threaded
Open this post in threaded view
|

Re: Save method twice to update formatting in cls

Blair McGlashan-2
Mark

You wrote in message news:[hidden email]...
> The formatting of the source in the .cls files doesn't match what I see in
> the browser. I have auto-format-on-accept turned on, so I'll type a line
> more or less free-flow, accept it, and continue typing. After I save the
> package in PAX format, the resulting cls doesn't appear to include that
last
> reformatting--it shows the last edits I made, though.

I think you are misunderstanding the auto-format option. It is auto-format
on display, rather than save, the purpose being to be able to display
third-party source (or your own source) in some standard form controlled by
your formatter settings.

If you want the source that you save to be in standard format, then use
Ctrl+Shift+S instead of Shift+S when saving it. I do this by habit now.

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Save method twice to update formatting in cls

Mark Wilden
"Blair McGlashan" <blair@no spam object-arts.com> wrote in message
news:3eccecb8$[hidden email]...
>
> I think you are misunderstanding the auto-format option. It is auto-format
> on display, rather than save, the purpose being to be able to display
> third-party source (or your own source) in some standard form controlled
by
> your formatter settings.

Then why does it reformat when I press ^S? Hmmm. I guess it's saving out the
source, then redisplaying it, which is when the reformatter kicks in again.

> If you want the source that you save to be in standard format, then use
> Ctrl+Shift+S instead of Shift+S when saving it. I do this by habit now.

I used to do Ctrl+Shift+S, but was hoping the auto-format option would avoid
the extra effort. If you want auto-formatting, it seems to me that you'd
want it everytime you accept.

(I'm not real happy with the choice of ^S and ^W for non-Windows commands
anyway, to be honest. ^S should save a file and ^W should close a window.)

I'm really enjoying the formatter, BTW. I hate what it does to the source
sometimes, but I'm getting used to it. The important thing is that I don't
have to play typesetter anymore. I just type the code in higgly
piggly--sometimes all on one line, sometimes broken up--and expect the
formatter to make it readable. I think that saves significant time.


Reply | Threaded
Open this post in threaded view
|

Re: Save method twice to update formatting in cls

Blair McGlashan-2
Mark

You wrote in message news:[hidden email]...
> "Blair McGlashan" <blair@no spam object-arts.com> wrote in message
> news:3eccecb8$[hidden email]...
> >
> > I think you are misunderstanding the auto-format option. It is
auto-format
> > on display, rather than save, the purpose being to be able to display
> > third-party source (or your own source) in some standard form controlled
> by
> > your formatter settings.
>
> Then why does it reformat when I press ^S? Hmmm. I guess it's saving out
the
> source, then redisplaying it, which is when the reformatter kicks in
again.

Exactly.

> > If you want the source that you save to be in standard format, then use
> > Ctrl+Shift+S instead of Shift+S when saving it. I do this by habit now.
>
> I used to do Ctrl+Shift+S, but was hoping the auto-format option would
avoid
> the extra effort. If you want auto-formatting, it seems to me that you'd
> want it everytime you accept.

I suppose so. We originally conceived it as a "display-time only" option.
What do others think?

> (I'm not real happy with the choice of ^S and ^W for non-Windows commands
> anyway, to be honest. ^S should save a file and ^W should close a window.)

Well "saving" the method source is the nearest thing to saving a "file"
(document) in the browser. Also this happened to be the shortcut key in our
favourite Smalltalk (and our least favourite Smalltalk :-)) when we started
writing Dolphin.

As for Ctrl+W, its true that some important Microsoft apps do use it to
close a window or "document" (e.g. explorer, IE, word), but it is by no
means standard, having a different (even inverted) meaning in some MS apps
(e.g. Outlook Express), and doing nothing at all in others (e.g. Notepad,
Frontpage, Media Player). It isn't listed as a standard windows shortcut key
in the Windows XP help. I believe the standard accelerators for this purpose
are Alt+F4 (close window) and/or Ctrl+F4 (close document). Having said that
I have no particular preference for it being associated with reformat
without save. The choice was made on the basis of a vote, although I admit
the turnout at the election was very limited :-). Ctrl+W happens to be the
key used in Visual Age, and conformity with that is useful for some users.

>
> I'm really enjoying the formatter, BTW. I hate what it does to the source
> sometimes, but I'm getting used to it. The important thing is that I don't
> have to play typesetter anymore. I just type the code in higgly
> piggly--sometimes all on one line, sometimes broken up--and expect the
> formatter to make it readable. I think that saves significant time.

Thats true, but more importantly for me is that it frees me from having to
waste thinking energy on just how code should be formatted. Like you I
sometimes don't particularly like the results, but I don't care about that
anymore because it is at least consistent, and the brain quickly learns to
recognise a consistent form. I no longer get into "formatting paralysis",
and concentrate completely on the codes function rather than its layout.
Also I know that no one format will satisfy all readers of the code, so
careful manual formatting to my own taste is really not worth the effort.
Likewise I can view/reformat others code in that same format without wasting
time and risking RSI. Actually it is this which motivated the "auto-format"
option. The idea is that the underlying format of the source code really
doesn't matter, and that each user should be able to display it in some
reasonable approximate to their own preferred style. Of course one's
preferred style might not be supported by the configurable formatter, but it
is open to modification/subclassing/replacement if this is really that
important to you. I'm sure even the comment handling could be sorted (or at
least improved upon) by someone who care about it enough :-).

Regards

Blair


Reply | Threaded
Open this post in threaded view
|

Re: Save method twice to update formatting in cls

Chris Uppal-3
Blair McGlashan wrote:

>I'm sure even the comment handling could be sorted (or at
> least improved upon) by someone who care about it enough :-).

Those of us who care about such things wouldn't touch autoformatting with a
barge-pole (no smiley).

Now, if the IDE recorded which methods had been machine mis-formatted with the
connivance of the author (so I could know that there was no useful information
retained in the layout), then I'd be quite happy to auto-format *only* the code
that had thus been pre-mangled -- after all a pretty, but semantically void,
layout is better than an ugly, but semantically void, layout.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Save method twice to update formatting in cls

Mark Wilden
In reply to this post by Blair McGlashan-2
"Blair McGlashan" <blair@no spam object-arts.com> wrote in message
news:3ecdeed5$[hidden email]...

> > (I'm not real happy with the choice of ^S and ^W for non-Windows
commands
> > anyway, to be honest. ^S should save a file and ^W should close a
window.)
>
> Well "saving" the method source is the nearest thing to saving a "file"
> (document) in the browser. Also this happened to be the shortcut key in
our
> favourite Smalltalk (and our least favourite Smalltalk :-)) when we
started
> writing Dolphin.

The trouble is that there are several places (a workspace, the view
composer) where ^S would be the natural way to save the file.

> As for Ctrl+W, its true that some important Microsoft apps do use it

Actually, I first discovered this keystroke in Codewarrior, and it does seem
to be well supported in other apps, though it's not publicized. It maps to
Alt-F4, while being much easier to use. It fits very well into the other
left-hand Windows functions.

> > I'm really enjoying the formatter, BTW. I hate what it does to the
source
> > sometimes, but I'm getting used to it. The important thing is that I
don't
> > have to play typesetter anymore. I just type the code in higgly
> > piggly--sometimes all on one line, sometimes broken up--and expect the
> > formatter to make it readable. I think that saves significant time.
>
> Thats true, but more importantly for me is that it frees me from having to
> waste thinking energy on just how code should be formatted.

Yup, good point (followed be even more good stuff).