Re: [code] Textadept: adding a top-level menu?

From: Phil S. <accountz.att.mailbox.org>
Date: Sat, 3 Nov 2018 00:09:58 +0100

Thanks much, somehow this notation didn't quite occur to me this way
during experimentations. Much obliged!

Other one-off question: there's seemingly no FILE_CLOSED event and a
BUFFER_DELETED handler does not get any (non-nil) args. To figure out
which file was just closed, do I need to manually keep track of open
buffers and then diff between previous-all-open-buffers and
current-all-open-buffers on every BUFFER_DELETED firing?

On 11/2/18 8:28 PM, Mitchell wrote:
> Hi Phil,
>
> On Fri, 2 Nov 2018, Phil S. wrote:
>
>> I bought & enjoyed the 'Textadept Quick Reference' but I'm wrestling
>> hopelessly with the seemingly-simple wish to add own top-level menus.
>> That is
>> obviously *without* cumbersomely copying the original 577-line
>> menu.lua to my
>> ~/.textadept/modules/textadept and tweaking it in a few places.
>>
>> The QuickReference has handy examples to easily extend *existing*
>> menus but I
>> can't figure out how to integrate custom top-level menus to the menubar.
>> Anyone know of a snippet or existing module out there that does this,
>> so one
>> can learn? Even the listed extensions in the Wiki that mention menus
>> tend to
>> only add items or sub-menus to already-existing top-level-menus.
>
> Just treat `textadept.menu.menubar` like a normal table.
>
>> From the command entry I was able to enter this:
>
> textadept.menu.menubar[#textadept.menu.menubar + 1] =
> {title='Hi',{'Foo',function()ui.print('Bar')end}}
>
> It appended a 'Hi' menu after 'Help'.
>
> 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 Fri 02 Nov 2018 - 19:09:58 EDT

This archive was generated by hypermail 2.2.0 : Sat 03 Nov 2018 - 06:42:13 EDT