Re: [code] [textadept] In-place Menu Editing

From: Mitchell <m.att.foicica.com>
Date: Mon, 9 Jun 2014 20:58:32 -0400 (EDT)

Hi Russell,

On Tue, 10 Jun 2014, Russell Dickenson wrote:

> Along the lines of a related enquiry, would this allow me to add to
> the Textadept menu, an option to open my init.lua, perhaps with a
> Textadept 'reset" to follow?
>
> I am interested in recreating an option in the Geany editor, which
> provides easy access to the customisation files.

Sure! Something like this should work:

   local tools = textadept.menu.menubar[4]
   tools[#tools + 1] = {'Open user init',
                        {io.open_file, _USERHOME..'/init.lua'}}

   events.connect(events.FILE_AFTER_SAVE, function(filename)
     if filename:find('[/\\]%.textadept[/\\]init%.lua$') then
       reset()
     end
   end)

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 Mon 09 Jun 2014 - 20:58:32 EDT

This archive was generated by hypermail 2.2.0 : Tue 10 Jun 2014 - 06:28:54 EDT