Re: [code] [textadept] Textadept 11.0 alpha

From: Mitchell <m.att.foicica.com>
Date: Thu, 2 Apr 2020 10:19:50 -0400 (EDT)

Hi Robert,

On Thu, 2 Apr 2020, Robert Gieseke wrote:

> Hi Mitchell,
>
> i've started getting Textredux ready for Textadept 11:
>
> https://github.com/rgieseke/textredux/commit/1aaea677bd2262831e32df1a7ebf33c16290a46f
>
> Went quite painless, thanks a lot for your work on this update!
>
> One question, right now i have to load Textredux as
>
> events.connect(events.INITIALIZED, function()
> local textredux = require("textredux")
> textredux.hijack()
> keys.cg = textredux.ctags.goto_symbol
> end)
>
> Previously it wasn't necessary to wrap this in an event, i found a
> section in the manual "Those types of function calls must occur within
> functions (e.g. in a key binding, menu item, or events.INITIALIZED event
> handler)." - but was just curious what has changed?

By waiting until `events.INITIALIZED` to work with menu and key binding values, you are guaranteed to be working with fully initialized menus and keys (as opposed to them being changed later by some modules loaded after textredux). I think technically things will still load if you were to call `hijack()` outside of `events.INITIALIZED`, but you might experience subtle bugs that would be hard to track down.

If you could be more specific as to why or how you've determined it's now necessary for you to wrap it in an `events.INITIALIZED` handler, I could probably give you a better explanation.

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 02 Apr 2020 - 10:19:50 EDT

This archive was generated by hypermail 2.2.0 : Fri 03 Apr 2020 - 06:29:25 EDT