Re: [code] Invoking a menu bar item from command entry possible?

From: Mitchell <m.att.foicica.com>
Date: Sat, 22 Jun 2013 23:22:37 -0400 (EDT)

Victor,

On Sat, 22 Jun 2013, Victor T. wrote:

> Richard Philips wrote:
> On 06/22/2013 07:50 AM, Victor T. wrote:
> Hi,
>
> Quick question, how do you invoke a specific menu
> item from the command entry?
>
>
> Hi,
>
> I always check:
>
>     textadept/modules/textadept/menu.lua
>
>
> Richard
>
>
> The local menubar seems to show the command of interest but it isn't
> accessible outside of textadept/modules/textadept/menu.lua.
>
> I could copy and paste the command and tables from there and call it with
> keys.run_command like menu.lua does but that's poor encapsulation and it
> doesn't promote ease of use if I have to keep referring and copying from
> menu.lua every time I need to do something like this.

Menu items use the Textadept API[1]. Since the items are either Lua
functions or tables, you can do a simple translation. For example:

     -- menu.lua command --> Lua command entry text
     buffer.new --> buffer.new()
     {io.snapopen, _HOME} --> io.snapopen(_HOME)
     {view.split, view, true} --> view:split(true)

I hope that helps,
Mitchell

[1]: http://foicica.com/textadept/api

-- 
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 22 Jun 2013 - 23:22:37 EDT

This archive was generated by hypermail 2.2.0 : Sun 23 Jun 2013 - 06:49:56 EDT