Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Jürgen Hestermann

Am 2016-11-23 um 15:03 schrieb Graeme Geldenhuys:
> If you want columns, then columns you shall have. ;-)
> See attachment. I've also reduced the tabSize to 2, to make it more
> representative of common Object Pascal coding style standards.

Well, actually I would like to have the tabsize zero.
I just want to align with tabs, not add space.
These 2 things should not be combined.


> The only thing I can see that is still different to your original code
> [which ET can't do] is make your const/var column right aligned.

Yes, although this would be no show stopper for me.


> See attached screenshot. Again, I've enabled jEdit's setting to show
> where I inserted TAB characters to make it easier to reproduce.

Looks nearly as I would like it.
If only I could specify a new block without adding a line without tabstops
then I would be very interested in these elastic tabstops.
Currently, whenever I change variable or parameter names
I have to (re)align manually which would be automatic with ET.

The other drawback of ET is, that all alignment is gone if you
view the code in an editor that does not support ET.
But if it would become more common, this issue may go away over time...

___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Graeme Geldenhuys
On 2016-11-23 13:31, Jürgen Hestermann wrote:
> Also, you didn't align the parameters in your screenshot as I did in my 
> example.
> I have one 'column' for:

If you want columns, then columns you shall have. ;-)
See attachment. I've also reduced the tabSize to 2, to make it more
representative of common Object Pascal coding style standards.

The only thing I can see that is still different to your original code
[which ET can't do] is make your const/var column right aligned.

See attached screenshot. Again, I've enabled jEdit's setting to show
where I inserted TAB characters to make it easier to reproduce.


> In the end, you arrange your alignment according to the limitations
> of elastic tabstops (ET)

Not at all. To the contrary, the "my style #2" is exactly the coding
standard I use in all my code (ET enabled or not). You are welcome to
verify this by looking at the fpGUI or tiOPF code available on
SourceForge. I use a coding style that is very similar, if not exactly
like, the code shown in Delphi 7's VCL units. So no, I didn't adjust my
styling to fit ET in any way, it just happens to work very well together.


ps:
  In case you are interested. jEdit supports local buffer settings
  embedded inside the file you are editing. For Object Pascal code,
  you can place the following anywhere in the first 10 or last 10 lines
  of a .pas file. If I had to use it, I would personally stick it at
  the end of the unit, far out of the way.

 { :mode=pascal:tabSize=2:elasticTabstops=true: }


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Graeme Geldenhuys
On 2016-11-23 12:38, Jürgen Hestermann wrote:
> But this happens quite often in my code in function/procedure
> declarations as I align the parameters and directly after this

See attached screenshot. It shows three options.

  1) your original code
  2) I live to define each parameter individually with modifier
 and data type. But this layout makes the code stretch for
 to the right, meaning I might have to scroll horizontally
 to see all the parameter definitions.
  3) Slightly reworked (2) - no more horizontal scrolling required


I know coding style is a very personal thing. So I'm not saying you must
change your, I'm just showing examples of others.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Jürgen Hestermann

Am 2016-11-23 um 13:26 schrieb Graeme Geldenhuys:
> On 2016-11-23 12:14, Jürgen Hestermann wrote:
>> In your screenshot you use empty lines
>> but no comment lines to separate the blocks.
> It makes no difference... it has the same result. See attached
> screenshot, where I added comments using a // prefix.
> You seem to be missing how indentation or alignment is triggered with
> ET. It only happens when a TAB (U+0009) character is found.

Yes, I see now.
It will only be a problem when 2 (different) blocks
with elastic tabstops are directly following each other
(without a line that has no tabstops as a separator).

But this happens quite often in my code in function/procedure
declarations as I align the parameters and directly after this
the var declarations are aligned too (but not aligned to the parameter 
declaration):

--
function MyProcedureThatDoesSomething(const Path,
SourceItemName,
TargetPath,
TargetItemName  : MyStringType;
CopyProgressRoutine : 
CopyProgressRoutineTyp;
  const Flag: boolean;
out ErrorCode   : DWord;
var ItemSkipped : boolean;
  const ExistingMode: 
OverwriteExistingModeTyp) : boolean;
var Flags,
VolumeS,
VolumeT: DWord;
S,T: MyStringType;
FileEntryS,
FileEntryT : BasicFileTyp;
H  : hwnd;
--

In this case I would need to insert an empty (or comment line) between
both blocks which I do not want in all cases.

___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Graeme Geldenhuys
On 2016-11-23 12:14, Jürgen Hestermann wrote:
> In your screenshot you use empty lines
> but no comment lines to separate the blocks.

It makes no difference... it has the same result. See attached
screenshot, where I added comments using a // prefix.


You seem to be missing how indentation or alignment is triggered with
ET. It only happens when a TAB (U+0009) character is found.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Graeme Geldenhuys
Damn spelling mistakes. Seems I'm having finger troubles today. :-)


> other languages), so if need be, add blacks lines if you must. Often it

Should have been:

  ... so if need be, add _blank_ lines if you must.


> use ET. Also, if you want what things to be aligned when using an ET

Should have been:

  ... if you _don't_ want things to be aligned...



Regards,
  Graeme

___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Jürgen Hestermann

Am 2016-11-23 um 13:10 schrieb Graeme Geldenhuys:

On 2016-11-22 18:29, Jürgen Hestermann wrote:

I tried a new file in JEdit (I don't know what format this has then)
but a line beginning with double backslash did not separate the blocks.
Even worse, it was taken as the first column of the whole block.

See attached.


In your screenshot you use empty lines
but no comment lines to separate the blocks.
___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Graeme Geldenhuys
On 2016-11-23 11:25, Jürgen Hestermann wrote:
> I am wondering how you can achieve this kind of code alignment

Yes, easily, because only lines 1 & 2 have TAB characters. Line 3 has no
TAB characters, so ET's algorithm doesn't need to do anything with it.
See attached screenshot.

Also remember, Object Pascal is not sensitive to whitespace (like some
other languages), so if need be, add blacks lines if you must. Often it
makes a method implementation easier to read too - separating related
tasks in a single method implementation. I do that, even when I don't
use ET. Also, if you want what things to be aligned when using an ET
enabled editor, then use spaces instead of a TAB character. Like any
programming style - make it work for you.

Elastic Tabstops will obviously not be a perfect fit for everybody -
nothing ever is. But (to me at least) it is a damn sight better than
anything before it. The pros far outweigh the cons for me. The pure joy
of multiple developers looking at the exact same file, but each
developer having their own style (indentation and padding) preferences
applied is a huge plus for me. Also in DDL SQL having field comments
perfectly align next to table fields is awesome. Also viewing TAB
delimited data dumps is awesome - giving text editors the ability to
view data like Excel or LibreOffice Calc.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Graeme Geldenhuys
On 2016-11-22 18:29, Jürgen Hestermann wrote:
> I tried a new file in JEdit (I don't know what format this has then)
> but a line beginning with double backslash did not separate the blocks.
> Even worse, it was taken as the first column of the whole block.


See attached.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other


Re: [fpc-other] Underscores in numerical literals - grouping

2016-11-23 Thread Jürgen Hestermann

Am 2016-11-22 um 19:29 schrieb Jürgen Hestermann:
> Am 2016-11-22 um 17:59 schrieb Graeme Geldenhuys:
> > Inserting a blank line between the two blocks will treat themt
> > differently with different indentation widths.
>
> Yes. But sometimes I do not want to be forced to
> insert a blank line just to achieve this and
> sometimes I even want to align what is separated
> by a blank line.

I am wondering how you can achieve this kind of
code alignment

-
MyvariableA := 0;
Myx := 1;
MyProcedureCall(Param1,Param2,Param3);
-

by using elastic tabstops and without having
an empty line between the 2nd and 3rd code line.
Wouldn't the 3rd line always expand the first
column of the block shifting the ':=' far to the right?
___
fpc-other maillist  -  fpc-other@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other