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

From: Robert Gieseke <rob.g.att.web.de>
Date: Thu, 12 Sep 2013 13:04:47 +0200

Am 9/11/13 5:39 PM, schrieb Mitchell:
>> 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.
>
>> 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.

Apologies for not linking to code examples. To highlight the margin I
used this: https://github.com/rgieseke/ta-common/blob/master/highlight.lua

When I just stop caching the color values this works fine!

But for Textredux I'm still a bit stuck. In the 'core.style' we generate
default styles the other styles used for lists etc. are based on
(https://github.com/rgieseke/textredux/blob/master/core/style.lua#L270).
This 'style' module is required by other modules and loaded before
INITIALIZED is emitted.
Maybe I have to rewrite this to lazily read the default styles.

As a workaround I can wrap requiring like
events.connect(events.INITIALIZED, function()
   require 'textredux.hijack'
   common = require 'common'
end)

Thanks,
Robert

-- 
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 12 Sep 2013 - 07:04:47 EDT

This archive was generated by hypermail 2.2.0 : Fri 13 Sep 2013 - 06:44:58 EDT