Re: [code][Textadept] Unable to modify context_menu

From: Robert Gieseke <rob.g.att.web.de>
Date: Sun, 6 Aug 2017 21:44:36 +0200

Hi Franck,

try

events.connect(events.INITIALIZED, function()
 local context_menu = textadept.menu.context_menu
 context_menu[#context_menu + 1] = {'label', function() end}
end)

In textadept/menu.lua (events.connect(events.INITIALIZED,
set_contextmenus) you can see that the menu is only set in an
INITIALIZED event handler, so the table is still non-existing when you
try to add to it.

I think this is currently not properly documented in the manual.

Cheers,
Robert

Am 06/08/17 um 09:12 schrieb Franck Guadagnini:
> Hi,
>
> Where should I put code to modify context_menu?
> textadept.menu.context_menu[#textadept.menu.context_menu + 1] = {…}
> works from the command entry, but if set in any of my config files, I get at Textadept's start the error "attempt to get length of a nil value (field 'context_menu')".
>
> Best,
> Franck--
> 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.
>

-- 
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 Sun 06 Aug 2017 - 15:44:36 EDT

This archive was generated by hypermail 2.2.0 : Mon 07 Aug 2017 - 06:43:57 EDT