Re: [code] [textadept] Language specific settings

From: Mitchell <m.att.foicica.com>
Date: Thu, 30 Jan 2014 08:46:46 -0500 (Eastern Standard Time)

Richard,

On Thu, 30 Jan 2014, Richard Philips wrote:

> Hello Mitchell,
>
>
>
>> This kind of feature is built-in to buffers. Since buffers are
>> individual Lua tables, what you described can be done using
>> properties:
>>
>> buffer.dictionary_function = myfunction
>>
>> --[[ and then later ]]
>>
>> myfunction = buffer.dictionary_function
>>
>> Your custom properties exist individually per-buffer.
>>
>> I hope I'm understanding your use-case correctly.
>>
>>
>
>
> This is what I am doing right now :-)
>
> The problem with this approach is that this is somewhat disorganized.
> If the buffer API changes it could lead to name conflicts.
>
> Better would be if we could work in the following way:
>
> buffer.local_properties["dictionary_function"] = myfunction
>
> ...
>
> myfunction = buffer.local_properties["dictionary_function"]
>
> with the guarantee that buffer.local_properties is not used for other
> purposes.

Since the buffer is tied to the Scintilla API, there can be no
"guarantee". However, "local_properties" will likely not be used in
Scintilla so you may safely use that without worry. I will not use it as
part of Textadept's API either (I've already put too many custom things in
the buffer table anyway...).

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 Thu 30 Jan 2014 - 08:46:46 EST

This archive was generated by hypermail 2.2.0 : Fri 31 Jan 2014 - 06:36:29 EST