zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _todo.sh
@ 2010-08-06 15:47 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2010-08-06 15:47 UTC (permalink / raw)
  To: Zsh hackers list

The latest versions use "+" for priority and append a footer to lists
that needs stripping off.

Index: Completion/Unix/Command/_todo.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_todo.sh,v
retrieving revision 1.7
diff -p -u -r1.7 _todo.sh
--- Completion/Unix/Command/_todo.sh	6 Jun 2010 13:44:12 -0000	1.7
+++ Completion/Unix/Command/_todo.sh	6 Aug 2010 15:27:44 -0000
@@ -6,9 +6,9 @@
 #  - "replace" will complete the original text for editing
 #  - completing priorities will cycle through A to Z (even without
 #    menu completion)
-#  - list and listall will complete p:<project> and @<where> from
+#  - list and listall will complete +<project> and @<where> from
 #    values in existing entries
-#  - will complete after p: and @ if typed in message text
+#  - will complete after + and @ if typed in message text
 
 setopt localoptions braceccl
 
@@ -53,7 +53,7 @@ case $state in
   case $words[NORMARG] in
     (append|del|do|prepend|pri|replace)
     if (( NORMARG == CURRENT - 1 )); then
-      itemlist=(${${(M)${(f)"$(todo.sh -p list)"}##<-> *}/(#b)(<->) (*)/${match[1]}:${match[2]}})
+      itemlist=(${${(M)${(f)"$(todo.sh -p list | sed '/^--/,$d')"}##<-> *}/(#b)(<->) (*)/${match[1]}:${match[2]}})
       _describe -t todo-items 'todo item' itemlist
     else
       case $words[NORMARG] in
@@ -64,7 +64,7 @@ case $state in
 	nextstate=proj
 	;;
 	(replace)
-	compadd -Q -- "${(qq)$(todo.sh -p list "^0*${words[CURRENT-1]} ")##<-> }"
+	compadd -Q -- "${(qq)$(todo.sh -p list "^0*${words[CURRENT-1]} " | sed '/^--/,$d')##<-> }"
 	;;
       esac
     fi
@@ -102,15 +102,15 @@ case $nextstate in
   ;;
 
   (proj)
-  # This completes stuff beginning with p: (projects) or @ (contexts);
+  # This completes stuff beginning with + (projects) or @ (contexts);
   # these are todo.sh conventions.
-  if [[ ! -prefix p: && ! -prefix @ ]]; then
+  if [[ ! -prefix + && ! -prefix @ ]]; then
     projmsg=$txtmsg
   fi
   # In case there are quotes, ignore anything up to whitespace before
-  # the p: or @ (which may not even be there yet).
+  # the + or @ (which may not even be there yet).
   compset -P '*[[:space:]]'
   _wanted search expl $projmsg \
-    compadd ${${=${${(M)${(f)"$(todo.sh -p list)"}##<-> *}##<-> }}:#^(p:*|@*)}
+    compadd $(todo.sh lsprj) $(todo.sh lsc)
   ;;
 esac

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-06 16:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-06 15:47 PATCH: _todo.sh Peter Stephenson

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).