lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: textedit - how to set tab size for correct column calculation?


From: David Wright
Subject: Re: textedit - how to set tab size for correct column calculation?
Date: Sat, 3 Nov 2018 22:50:53 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Sat 03 Nov 2018 at 15:05:42 (-0400), Br. Samuel Springuel wrote:
> On 2018-11-03 2:10 PM, David Baptista wrote:
> > <tab>c'<other stuff>
> 
> For Lilypond the tab is 8 spaces, thus the c' is on columns 9 and 10
> (one column for each character).  Lilypond is not aware of your editor
> settings (which change that result) and thus cannot account for that.
> The "\t" = "        " convention is an old one [1].

Bear in mind that that substitution only works if you're at the
start of a line or at a tab stop position.

> There has been a
> trend in recent times to reduce the number of spaces, especially for
> programming languages which use indentation as a meaningful
> representation of nesting level (and have lots of nesting).  Since
> Lilypond doesn't pay attention to indentation (it's merely an
> aesthetic thing to make human reading of the program easier), there
> probably hasn't been much call for breaking the old convention.

Yes, the emacs configuration I use has the indentation set to 2 for
LilyPond (and 4 for python).

Note that repeated use of the TAB key for LilyPond has no effect after
the first press, ie it does not keep advancing by 2, but just sets the
appropriate indentation according to its rules. (For python, its
behaviour is completely different.)

BTW the convention is old, but well respected as far as TAB characters
in files is concerned. But what has changed completely since the time
of typewriters is the action taken when the TAB key is pressed. TAB
is an instruction to the computer (a control character) rather than
a literal.

> Your editor, on the other hand, knows that there is a tab there and
> that it's displaying tabs as 4 spaces.

And *there's* the difference (between Input Method and File Contents).
Pressing the TAB key only results in a TAB character being placed in
the file when the indentation required has reached 8 or more (as in
the example attached).

> Clearly if the position it
> goes to when following the textedit link is wrong, then it's taking
> the column number to be the visible column number, not the
> hypothetical one which would result if the tabs were expanded using
> the old 8 space convention.  I don't know if your editor can be told
> "pretend tabs are 8 spaces when computing column numbers but only
> display them as 4", but that's the sort of thing you're asking it to
> do.

None of this is necessary or relevant when "TAB as an input key" is
decoupled from "TAB as a character in a file".

> What you can probably do, however, is set the editor to auto-expand
> tabs [2].  In this case, you can press the tab button and things will
> indent normally, but the editor will automatically insert multiple
> spaces (4, given your current settings) instead of tabs.  Thus your
> line would become:
> 
> > <space><space><space><space>c'<other stuff>
> 
> In this case a space is a single column character and Lilypond and
> your editor will agree that c' is in columns 5 and 6.  No issues with
> how many spaces in a tab to deal with.

Correct. And of course there's no real need to use TAB characters
for this purpose at all with modern storage capabilities and
compression programs.

> [1] https://superuser.com/a/355868
> [2] I see you use Notepad++ so https://stackoverflow.com/a/7471232

Cheers,
David.

Attachment: tabbing.ly
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]