Re: [code] [textadept] Language specific settings

From: Richard Philips <richard.philips.att.gmail.com>
Date: Wed, 29 Jan 2014 10:16:41 +0100

Hi,

On the discussion of file type (better word than language ?) specific
settings,
I often find a similar need.

I give an example: recently I developed an advanced spelling checker for
Textadept.
Advanced, because it uses a function (dependent on the file type) to
determine
which dictionary to use.

(I often work with files which contain text in different languages
so the spelling checker has to determine which dictionary to use).

It would be nice to have a stable API to store/retrieve this function.

Something like:

     buffer:set_user_property('dictionary_function', myfunction)

     myfunction = buffer:get_user_property('dictionary_function')

Richard

On 01/28/2014 08:05 PM, Mitchell wrote:
> 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 Wed 29 Jan 2014 - 04:16:41 EST

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