>
> I plan on submitting my hook patches instead which obsolete this.
>

Since we're also talking about improvements in tmux scripting let me
throw a few ideas that would greatly boost tmux scripting
capabilities:

1 - Shared memory support through a tmux command. Something like zsh
'zstyle' command(which is basically a key-value storage), but the data
would be stored on the tmux server with a per-session context , so we
could have programs running in different panes sharing/modifying data
in a race-condition-proof way:
   tmux shm set KEY VALUE  # set a value
   tmux shm get KEY VALUE [default_value] # gets a value if exists, or
set and return it in a atomic way if a default value was provided
   tmux shm pop KEY # pops a value

2 - Shared/exclusive locks and semaphores:
   tmux lock shared KEY # only returns when a shared lock can be acquired on KEY
   tmux lock exclusive KEY # only returns when a exclusive lock can be
acquired on KEY
   tmux wait KEY # blocks until a signal is received on KEY
   tmux signal KEY # makes all currently running 'tmux wait KEY' commands return


One example where I needed a semaphore in scripting tmux can be seen
here: 
https://github.com/tarruda/dot-files/blob/master/.zsh/tmux.d/vi.zsh#L35-L54
Basically, when I run the command 'vi' it opens the file in a existing
vim server for the current project. if vim is not opened, then it
splits the window, waits until vim is running before sending the
'edit' command to the vim server. The wait part is done by using a
named pipe and is shown in lines 35-54. This could be more easily
achieved with tmux wait/signal commands.

With the hooks support and these additions tmux scripting capabilities
would be almost limitless, tmux would literally become an IDE with
eclipse-like capabilities and extensible through simple shell scripts
or any other language.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to