Re: [code] [textadept] Language specific settings

From: Mitchell <m.att.foicica.com>
Date: Tue, 28 Jan 2014 14:05:44 -0500 (Eastern Standard Time)

Hi Rob,

On Mon, 27 Jan 2014, Rob Kendrick wrote:

> On Mon, Jan 27, 2014 at 03:39:01PM +0100, Robert Gieseke wrote:
>> Hi Klaus,
>>
>> Am 27.01.14 03:32, schrieb Klaus Borges:
>>> Hello,
>>>
>>> I'd like to know the appropriate way to put language specific settings,
>>> such as tab indenting for one specific language and space for others.
>>> Should I put those settings on the lexer file?
>>
>> if it's only tab indenting (or a few properties) you could put in
>> your init.lua, e.g. for JavaScript:
>>
>> events.connect(events.LEXER_LOADED, function(lang)
>> if lang == 'javascript' then buffer.tab_width = 4 end
>> end)
>
> This strikes me as a common enough desire that there should probably be
> some built-in infrastructure for doing it that allows more succinct
> configuration.

Do you have an idea? I cannot think of one that has as much flexibility as
doing something language-specific in a LEXER_LOADED event. For
example, using tables for indentation settings feels too constraining:

   textadept.file_types.indentation.javascript = {
     use_tabs = true,
     tab_width = 4
   }

I'd have to figure out what tables to add and call for what properties,
etc. I admit the anonymous function route looks clunky, but it's
surprisingly powerful and flexible.

> In such a thing, I believe it might be desirable to allow the
> configuration of indentation rules not just based on lexer in use, but
> path, as not all projects follow the same.

I cannot imagine what a framework for this would look like... ideas?

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 Tue 28 Jan 2014 - 14:05:44 EST

This archive was generated by hypermail 2.2.0 : Wed 29 Jan 2014 - 06:40:01 EST