Bug#368390: zsh: Update for mpc completion

2006-05-21 Thread R.Ramkumar
Package: zsh
Version: 4.3.2-8
Severity: wishlist
Tags: patch

Hi!

I should have sent these with the --no-status patch, but somehow
missed it. Well, better late than never! This patch adds three
commands added to the latest stable release of mpc (crop, stats,
toggle). Actually I have added support for a couple of commands
(dealing with output manipulation) for the current cvs version, hope
that isn't too much of a problem :) Here's the patch:

--- _mpc.orig	2006-05-22 00:26:24.991140600 +0530
+++ _mpc	2006-05-07 22:08:25.0 +0530
@@ -26,14 +26,19 @@
 
   mpc_cmds=(
 add:add a song to the current playlist
+crop:remove all songs except for the currently playing song
 del:remove a song from the current playlist
 play:start playing
 next:play the next song in the current playlist
 prev:play the previous song in the current playlist
 pause:pause the currently playing song
+toggle:toggles Play/Pause, plays if stopped
 stop:stop the currently playing playlists
 seek:seek to the position specified in percent
 clear:clear the current playlist
+outputs:show the current outputs
+enable:enable a output
+disable:disable a output
 shuffle:shuffle the current playlist
 move:move song in playlist
 playlist:print the current playlist
@@ -49,7 +54,9 @@
 search:search for a song
 crossfade:set and display crossfade settings
 update:scan music directory for updates
+stats:display statistics about MPD
 version:report version of MPD
+status:display MPD status
   )
 
   if (( CURRENT == 1 )); then
@@ -154,6 +161,13 @@
   fi
 }
 
+(( $+functions[_mpc_helper_outputs] )) ||
+_mpc_helper_outputs() {
+  local vals outline
+  vals=(${${${${(M)${(f)$(mpc outputs 2 /dev/null)}:#Output * \(*\) is (en|dis)abled}##Output }%%\) is (en|dis)abled}/ \(/:})
+  _describe -t outputs output vals
+}
+
 _mpc_add() {
   _mpc_helper_files
 }
@@ -170,6 +184,14 @@
   _message floating point percent value
 }
 
+_mpc_enable() {
+  _mpc_helper_outputs
+}
+
+_mpc_disable() {
+  _mpc_helper_outputs
+}
+
 _mpc_move() {
   if (( $#words = 3 )); then
 _mpc_helper_songnumbers

Regards,
Ramkumar.

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (101, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.16-beyond2
Locale: LANG=en_IN, LC_CTYPE=en_IN (charmap=UTF-8)

Versions of packages zsh depends on:
ii  debconf [debconf-2.0] 1.5.0  Debian configuration management sy
ii  libc6 2.3.6-7GNU C Library: Shared libraries
ii  libncurses5   5.5-1.1Shared libraries for terminal hand

Versions of packages zsh recommends:
ii  libcap1   1:1.10-14  support for getting/setting POSIX.
ii  libpcre3  6.4-2  Perl 5 Compatible Regular Expressi

-- no debconf information

-- 
WARN_(accel)(msg null; should hang here to be win compatible\n);
   -- WINE source code


Bug#368390: zsh: Update for mpc completion

2006-05-21 Thread R.Ramkumar
Hi!

Ah well... one more bug in the original mpc completion! Don't know
how long this had gone unnoticed. Single quotes with variables
inside! Hopefully the last update for patching up _mpc completion..

--- _mpc.orig	2006-05-22 01:31:53.578904480 +0530
+++ _mpc	2006-05-22 01:31:02.348692656 +0530
@@ -4,15 +4,15 @@
 
 # set this style to whatever --format string you want to use when
 # constructing the list of playlist entries
-zstyle -s ':completion:${curcontext}:*' mpc-format-string MPC_FORMAT_STRING
+zstyle -s :completion:${curcontext}:* mpc-format-string MPC_FORMAT_STRING
 foo=(--format ${(q)MPC_FORMAT_STRING:-%file%})
 
 # set this style to the music_directory of mpd to get _files based completion
 # for commands like add
-zstyle -s ':completion:${curcontext}:' mpd-music-directory MPD_MUSIC_DIR
+zstyle -s :completion:${curcontext}: mpd-music-directory MPD_MUSIC_DIR
 
 # matcher used for playlist completion
-zstyle -s ':completion:${curcontext}:' mpd-playlist-matcher \
+zstyle -s :completion:${curcontext}: mpd-playlist-matcher \
   MPC_PLAYLIST_MATCHER
 : ${MPC_PLAYLIST_MATCHER:='m:{a-z}={A-Z} l:|=**'}
 
@@ -26,14 +26,19 @@
 
   mpc_cmds=(
 add:add a song to the current playlist
+crop:remove all songs except for the currently playing song
 del:remove a song from the current playlist
 play:start playing
 next:play the next song in the current playlist
 prev:play the previous song in the current playlist
 pause:pause the currently playing song
+toggle:toggles Play/Pause, plays if stopped
 stop:stop the currently playing playlists
 seek:seek to the position specified in percent
 clear:clear the current playlist
+outputs:show the current outputs
+enable:enable a output
+disable:disable a output
 shuffle:shuffle the current playlist
 move:move song in playlist
 playlist:print the current playlist
@@ -49,7 +54,9 @@
 search:search for a song
 crossfade:set and display crossfade settings
 update:scan music directory for updates
+stats:display statistics about MPD
 version:report version of MPD
+status:display MPD status
   )
 
   if (( CURRENT == 1 )); then
@@ -154,6 +161,13 @@
   fi
 }
 
+(( $+functions[_mpc_helper_outputs] )) ||
+_mpc_helper_outputs() {
+  local vals outline
+  vals=(${${${${(M)${(f)$(mpc outputs 2 /dev/null)}:#Output * \(*\) is (en|dis)abled}##Output }%%\) is (en|dis)abled}/ \(/:})
+  _describe -t outputs output vals
+}
+
 _mpc_add() {
   _mpc_helper_files
 }
@@ -170,6 +184,14 @@
   _message floating point percent value
 }
 
+_mpc_enable() {
+  _mpc_helper_outputs
+}
+
+_mpc_disable() {
+  _mpc_helper_outputs
+}
+
 _mpc_move() {
   if (( $#words = 3 )); then
 _mpc_helper_songnumbers

Regards,
Ramkumar.

-- 
WARN_(accel)(msg null; should hang here to be win compatible\n);
   -- WINE source code