Re: [code] textadept-ncurse and tmux

From: Mitchell <m.att.foicica.com>
Date: Fri, 17 May 2013 17:56:26 -0400 (Eastern Daylight Time)

Simon,

On Fri, 17 May 2013, Simon wrote:

> On Fri, May 17, 2013 at 2:29 PM, Mitchell <m.att.foicica.com> wrote:
> [snip]
>>> 12. Although TAN doesn't have a split screen itself, would it be possible
>>> to somehow get it to play nicely with e.g. tmux so that e.g. 10 files
> open
>>> would be 10 different instances of TAN in 10 different tmux windows? How
> to
>>> get TAN's open command to create a new tmux window with a new instance of
>>> TAN automatically, and get the name of the window to be the name of the
>>> file edited? I guess TAN's own copy and paste will not work between the
>>> different TAN instances, or? How to get around this? Would it be easier
> to
>>> make separate TAN processes do IPC rather than implement window splitting
>>> in TAN?
>>
>> Textadept cannot open new files in new instances unfortunately, GUI or
> terminal.
>
> It seems that to create a new tmux window running a new instance of
> textadept-curses then the following line can be executed:
>
> tmux new-window -n <file name> 'textadept-curses <file name>'
>
> Which will automatically create a new tmux window and name it after the
> file. And in the new window, as soon as one quits the new textadept-curses
> instance then the tmux window automatically disappears. I'm wondering
> whether it makes sense to try and execute such a command after
> textadept-curses has selected a file to open, instead of opening it...
> probably this is just hacking the lua, or?

This is an interesting idea. I wonder if it works around the fact that
Textadept cannot spawn processes from its internal Lua state. (Functions
like `os.execute()` and `io.popen()` block the main instance until the
thread finishes.) To give this a try, you would replace the 'co' key with
your own that asks for a file and then runs the command you gave for tmux.
For example:

     -- In ~/.textadept/init.lua
     keys['co'] = function()
       local file = gui.dialog('fileselect', ...)
       if file then os.execute('tmux ... '..file) 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 Fri 17 May 2013 - 17:56:26 EDT

This archive was generated by hypermail 2.2.0 : Sat 18 May 2013 - 06:31:41 EDT