Re: [code] Re: [textadept] Menu problem in textadept 8.7

From: Mitchell <m.att.foicica.com>
Date: Sat, 21 May 2016 11:34:59 -0400 (EDT)

Hi Richard,

On Fri, 20 May 2016, Mitchell wrote:

> Hi Richard,
>
> On Fri, 20 May 2016, Richard Philips wrote:
>
>> Hi Mitchell,
>>
>>
>> local x = textadept.menu.context_menu
>>
>>
>> does not give an error any more, but I cannot change the context_menu:
>>
>>
>> if textadept.menu.context_menu then
>> local m = textadept.menu.context_menu
>> m[#m+1] = SEPARATOR
>> m[#m+1] = {'Close', io.close_buffer}
>> end
>>
>>
>> does not change the context menu.

I forgot that all menus are loaded on `events.INITIALIZED`. Only the
menubar was mentioned in 8.7's changelog[1], but it applies to context and
tab menus too. I assume your code is in "~/.textadept/init.lua"? If so,

   events.connect(events.INITIALIZED, function()
     local x = textadept.menu.context_menu
     ...
   end)

should work.

> Sorry for the trouble. It seems my fix was rather hasty. I'll look into this
> more later today and get back to you.

The fix is still valid, as there shouldn't be a stack overflow, but the
initial `nil` result was because the menus haven't loaded yet.

Cheers,
Mitchell

[1]: http://foicica.com/lists/code/201604/3171.html

-- 
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 Sat 21 May 2016 - 11:34:59 EDT

This archive was generated by hypermail 2.2.0 : Sun 22 May 2016 - 06:34:25 EDT