Re: [code] [textadept] Language specific settings

From: Mitchell <m.att.foicica.com>
Date: Wed, 29 Jan 2014 10:40:11 -0500 (Eastern Standard Time)

Hi Richard,

On Wed, 29 Jan 2014, Richard Philips wrote:

> 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')

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.

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 - 10:40:11 EST

This archive was generated by hypermail 2.2.0 : Thu 30 Jan 2014 - 06:39:24 EST