Re: [code] [textadept] Latest Changes in hg

From: Mitchell <m.att.foicica.com>
Date: Wed, 11 Sep 2013 11:39:54 -0400 (Eastern Daylight Time)

Robert,

On Wed, 11 Sep 2013, Robert Gieseke wrote:

> Hi Mitchell,
>
> Am 9/10/13 3:09 AM, schrieb Mitchell:
>>
>>>> I've found a small issue, the new 'initialized' event [1] makes it
>>>> impossible to simply overwrite key short cuts in my 'init.lua', as
>>>> apparently [2] postpones loading 'textadept.keys'. Should running
>>>> the
>>>> _USERHOME init.lua wrapped be in 'initialized' event as well?
>>>
>>> No, because modules need to be loaded before `events.INITIALIZED` is
>>> fired. This includes modules loaded from `~/.textadept/init.lua`.
>>> Wrap
>>> your key bindings in an `events.INITIALIZED` handler. I need to
>>> update
>>> the manual with this information.
>>
>> I changed my mind. The old method will stay. It just involves renaming
>> `buffer:reload()`, `buffer:save()`, etc. to `io.reload()`,
>> `io.save()`,
>> etc. Come to think of it, I'm not really sure I like mixing io
>> functions
>> (or anything external for that matter) with buffer objects in the
>> first
>> place. After all, it's `textadept.editing.block_comment()`, not
>> `buffer:block_comment()`.
>>
>
> I'm trying to understand the new INITIALIZED event. My problem is that
> modules that piggy-back on user theme styles like Textredux or
> highlighting the margins for the active buffer are now loaded before any
> buffer is actually loaded.

INITIALIZED is not what you want; it is run pretty much at the end of the
startup process. Connect to VIEW_NEW for setting view stuff like margin
colors and BUFFER_NEW for buffer-specific stuff. Theme colors and styles
are available with either event if you need them. Those events are run as
early as possible.

> Is this correct?
> After loading and initializing all modules first files given on the
> command line are loaded, then (if none) the session file is processed.

Correct.

> For the margin highlighting it's easy to workaround by wrapping the code
> in an INITIALIZED event, for Textredux this is a bit more convoluted
> since other modules depend on its style module.
>
> Is there a way to get theme properties before any file is loaded?
> Maybe I'm misunderstanding things …

If you connect to VIEW_NEW or BUFFER_NEW, you can use
buffer.property['...'] to get all theme information. This happens before
any file is loaded.

I'm not sure I fully understand the problem, but I hope this helps.

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 11 Sep 2013 - 11:39:54 EDT

This archive was generated by hypermail 2.2.0 : Thu 12 Sep 2013 - 06:43:03 EDT