zsh-workers
 help / color / mirror / code / Atom feed
* PATCH 1/2: _tmux: redirect error output when no server is running
@ 2012-03-24 10:18 Mikael Magnusson
  2012-03-24 10:18 ` PATCH 2/2: _tmux: Complete also for unambiguous prefixes Mikael Magnusson
       [not found] ` <20120326161510.GA2115@pug.qqx.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Mikael Magnusson @ 2012-03-24 10:18 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_tmux |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 5fb7219..3327b14 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -1097,7 +1097,7 @@ function __tmux-buffers() {
         local -a bopts; bopts=()
     fi
 
-    buffers=( ${${(f)"$(command tmux list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
+    buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
     _describe -t buffers 'buffers' buffers
 }
 
@@ -1105,7 +1105,7 @@ function __tmux-bound-keys() {
     local expl
     local -a keys
 
-    keys=( ${${${${(f)"$(command tmux list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
+    keys=( ${${${${(f)"$(command tmux 2> /dev/null list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
     _describe -t keys 'keys' keys
 }
 
@@ -1124,7 +1124,7 @@ function __tmux-choose-stuff() {
 function __tmux-clients() {
     local expl
     local -a clients
-    clients=( ${${(f)"$(command tmux list-clients)"}/:[ $'\t']##/:} )
+    clients=( ${${(f)"$(command tmux 2> /dev/null list-clients)"}/:[ $'\t']##/:} )
     _describe -t clients 'clients' clients
 }
 
@@ -1400,7 +1400,7 @@ function __tmux-panes() {
         opts=( )
     fi
     num=0
-    command tmux list-panes "${opts[@]}" | while IFS= read -r line; do
+    command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do
         panes+=( $(( num++ )):${line//:/} )
     done
     _describe -t panes 'panes' panes "$@"
@@ -1421,7 +1421,7 @@ function __tmux-server-options() {
 function __tmux-sessions() {
     local expl
     local -a sessions
-    sessions=( ${${(f)"$(command tmux list-sessions)"}/:[ $'\t']##/:} )
+    sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
     _describe -t sessions 'sessions' sessions "$@"
 }
 
@@ -1479,7 +1479,7 @@ function __tmux-windows() {
     else
         opts=( )
     fi
-    wins=( ${${(M)${(f)"$(command tmux list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
+    wins=( ${${(M)${(f)"$(command tmux 2> /dev/null list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
     _describe -t windows 'windows' wins "$@"
     if [[ ${IPREFIX} != *: ]]; then
         _wanted sessions expl 'sessions' __tmux-sessions -S:
-- 
1.7.10-rc2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH 2/2: _tmux: Complete also for unambiguous prefixes
  2012-03-24 10:18 PATCH 1/2: _tmux: redirect error output when no server is running Mikael Magnusson
@ 2012-03-24 10:18 ` Mikael Magnusson
       [not found] ` <20120326161510.GA2115@pug.qqx.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Mikael Magnusson @ 2012-03-24 10:18 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_tmux |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 3327b14..39befe8 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -1528,6 +1528,18 @@ function _tmux() {
             if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then
                 tmuxcommand="${_tmux_aliasmap[$tmuxcommand]}"
             fi
+            if ! (( ${+functions[_tmux-$tmuxcommand]} )); then
+              local low high
+              low=$_tmux_commands[(i)$tmuxcommand*]
+              high=$_tmux_commands[(I)$tmuxcommand*]
+              if (( low == high )); then
+                tmuxcommand=${_tmux_commands[low]%%:*}
+              elif (( low < high )); then
+                _message -e "Ambiguous command $tmuxcommand"
+              else
+                _message -e "Subcommand $tmuxcommand not known"
+              fi
+            fi
             curcontext="${curcontext%:*:*}:tmux-${tmuxcommand}:"
             _call_function ret _tmux-${tmuxcommand}
         fi
-- 
1.7.10-rc2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH 1/2: _tmux: redirect error output when no server is running
       [not found] ` <20120326161510.GA2115@pug.qqx.org>
@ 2012-03-26 16:18   ` Mikael Magnusson
  0 siblings, 0 replies; 3+ messages in thread
From: Mikael Magnusson @ 2012-03-26 16:18 UTC (permalink / raw)
  To: zsh workers; +Cc: aaron

---------- Forwarded message ----------
From: Aaron Schrab <aaron@schrab.com>
Date: 26 March 2012 18:15
Subject: Re: PATCH 1/2: _tmux: redirect error output when no server is running
To: Mikael Magnusson <mikachu@gmail.com>


At 11:18 +0100 24 Mar 2012, Mikael Magnusson <mikachu@gmail.com> wrote:
>
> -    buffers=( ${${(f)"$(command tmux list-buffers "${bopts[@]}")"}/:[ >$'\t']##/:} )
> +    buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )


Unfortunately this can cause problems.  In my experience directing
tmux's STDERR do /dev/null causes that invocation to hang on Linux
apparently due to a bug in the epoll implementation.  This can be
worked around by setting EVENT_NOEPOLL environment variable to 1
before starting the server, but if tmux is using a version of libevent
before 2.0 (which is quite common) that will occasionally cause the
tmux server to die.

There's a thread about this on the tmux-users mailing list:

http://sourceforge.net/mailarchive/message.php?msg_id=28004727


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-26 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-24 10:18 PATCH 1/2: _tmux: redirect error output when no server is running Mikael Magnusson
2012-03-24 10:18 ` PATCH 2/2: _tmux: Complete also for unambiguous prefixes Mikael Magnusson
     [not found] ` <20120326161510.GA2115@pug.qqx.org>
2012-03-26 16:18   ` PATCH 1/2: _tmux: redirect error output when no server is running Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).