Re: [code] Tab spacing weirdness in 6.3

From: Mitchell <m.att.foicica.com>
Date: Wed, 6 Feb 2013 09:31:31 -0500 (Eastern Standard Time)

Hi,

On Wed, 6 Feb 2013, lists.att.drwilly.de wrote:

> On Feb 05, 2013 09:46, Mitchell wrote:
>> Michael,
>>
>> It looks like you are using a custom theme. Check if you're setting
>> buffer.indent = 2 anywhere in it.
>>
>> If your buffer.tab_size == 4 (which it does according to the screenshot)
>> and tabbing inserts two spaces, I'm almost certain buffer.indent == 2. The
>> default themes leave buffer.indent == 0 so it matches buffer.tab_size and
>> averts this kind of confusion.
>>
>> Mitchell
>
> So I just found out why the settings I made in my init.lua weren't working.
> It's also the reason why the defaults that are in the documentation differ from the actual defaults in the editor.

Sorry for the confusion :(

What is stated in the documentation is the *Scintilla* default, not ta's
default. I understand this could be a particularly bad source of
confusion, but in the context where you would adjust these settings,
namely in themes, I think it makes sense. For example:

     -- Inside themes/light/buffer.lua
     -- ...
     buffer.tab_width = 2

If you were to call Adeptsense's show_apidoc() on tab_width, you would see
the default as being 8, but it is being overridden to 2.

A counter argument could be made that if I updated the documentation to
use all of ta's default values, then a user creating a new theme might be
awfully confused when they assume the default tab_width is 2 and then
wonder why it's 8 when they don't explicitly set it to 2...

> To be honest I'm a little mindblown.
> Why on earth would every theme that TA ships with set
> buffer.tab_width = 2
> buffer.use_tabs = false
> buffer.tab_indents = true
> and override whatever settings the user tries to use?
> Why would a 'theme' interfere with editor settings at all??

It's a compromise. init.lua cannot be executed every time a buffer is
opened to set buffer settings. The purpose of init.lua is for user
initialization scripts. I needed a way to have custom buffer and view
settings that could be executed every time a buffer/view is opened and
that's where the "theme" concept comes from. I think the manual
documentation on Themes makes this clear, but please give feedback if it
is not.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Wed 06 Feb 2013 - 09:31:31 EST

This archive was generated by hypermail 2.2.0 : Thu 07 Feb 2013 - 06:32:22 EST