about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2003-04-03 10:24:40 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2003-04-03 10:24:40 +0000
commitf713bf4b090214856eb3b0d1596dfa30271b3a2d (patch)
tree5d4927d2d695bfb9c1a290aa5016d758c933387c
parent7d4014c30afdc2b22711803f8fd567304bb8f6a8 (diff)
downloadzsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar.gz
zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.tar.xz
zsh-f713bf4b090214856eb3b0d1596dfa30271b3a2d.zip
18432: Minor miscellany of comments and rationalisations.
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Unix/Command/_mh3
-rw-r--r--Completion/Unix/Command/_perforce12
-rw-r--r--Doc/Zsh/expn.yo5
-rw-r--r--Functions/TCP/tcp_spam4
-rw-r--r--Functions/Zle/transpose-words-match14
6 files changed, 40 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index d72fef3ea..6bcf12232 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2003-04-03  Peter Stephenson  <pws@csr.com>
 
+	* 18432: Completion/Unix/Command/_mh,
+	Completion/Unix/Command/_perforce, Doc/Zsh/expn.yo,
+	Functions/TCP/tcp_spam, Functions/Zle/transpose-words-match:
+	miscellany: use _path_files for more control in _mh; check
+	arguments in tcp_spam; handle negative prefix arguments in
+	transpose-words-match; a few comments elsewhere.
+
 	* unposted: Functions/Zle/.distfiles, Functions/Zle/bash-*: remove
 	bash-* word functions in favour of selectable ones (18394).
 
diff --git a/Completion/Unix/Command/_mh b/Completion/Unix/Command/_mh
index d25870281..bf30b000d 100644
--- a/Completion/Unix/Command/_mh
+++ b/Completion/Unix/Command/_mh
@@ -1,7 +1,6 @@
 #compdef ali dist flist flists folder folders forw comp inc mark refile repl scan show next prev packf rmf rmm pick whom mhn mhpath mhlist mhstore mhshow mhparam mhmail
 
 # Completion for all possible MH commands.
-
 local mymhdir=${$(_call_program mhpath mhpath + 2>/dev/null):-~/Mail}
 local mhlib=/usr/lib/mh
 
@@ -84,7 +83,7 @@ else
       compadd "$expl[@]" $(mark $foldnam 2>/dev/null | awk -F: '{ print $1 }') &&
         ret=0
       compadd "$expl[@]" reply next cur prev first last all unseen && ret=0
-      _files "$expl[@]" -W folddir -g '<->' && ret=0
+      _path_files "$expl[@]" -W folddir -g '<->' && ret=0
     done
     (( ret )) || return 0
   done
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index b14ab25fb..34db61478 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -187,6 +187,18 @@
 # command are appended to the remaining words of the style before calling
 # the command.
 #
+# Programmes taking p4-style arguments
+# ====================================
+#
+# It is possible to use the _perforce completion with other commands
+# which behave like a subcommand of p4 by setting the service type
+# to p4-<subcommand>.  For example,
+#   compdef _perforce p4cvsmap=p4-files
+# says that the command `p4cvsmap' takes arguments like `p4 files'.
+# Often the options will be different; if this is a problem, you
+# will need to write your own completer which loads _perforce and
+# calls its functions directly.
+#
 # TODO
 # ====
 #
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index b3dc53dab..cf5f98f9e 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -374,6 +374,11 @@ noderef(Parameters)
 for a description of parameters, including arrays, associative arrays,
 and subscript notation to access individual array elements.
 
+Note in particular the fact that words of unquoted parameters are not
+automatically split on whitespace unless the option tt(SH_WORD_SPLIT) is
+set; see references to this option below for more details.  This is an
+important difference from other shells.
+
 In the expansions discussed below that require a pattern, the form of
 the pattern is the same as that used for filename generation;
 see noderef(Filename Generation).  Note that these patterns, along with
diff --git a/Functions/TCP/tcp_spam b/Functions/TCP/tcp_spam
index b516ebaa2..bafe269b9 100644
--- a/Functions/TCP/tcp_spam
+++ b/Functions/TCP/tcp_spam
@@ -75,6 +75,10 @@ if (( ! ${#sessions} )); then
   print "No connections to spam." >&2
   return 1
 fi
+if (( ! $# )); then
+  print "No commands given." >&2
+  return 1
+fi
 
 if [[ -n $transmit ]]; then
   cmd=tcp_send
diff --git a/Functions/Zle/transpose-words-match b/Functions/Zle/transpose-words-match
index 52891b6ac..6fb60a01d 100644
--- a/Functions/Zle/transpose-words-match
+++ b/Functions/Zle/transpose-words-match
@@ -15,16 +15,24 @@ autoload match-words-by-style
 
 local curcontext=":zle:$WIDGET" skip
 local -a matched_words
-integer count=${NUMERIC:-1}
+integer count=${NUMERIC:-1} neg
+
+(( count < 0 )) && (( count = -count, neg = 1 ))
 
 while (( count-- > 0 )); do
     match-words-by-style
 
     [[ -z "$matched_words[2]$matched_words[5]" ]] && return 1
 
-    LBUFFER="$matched_words[1]$matched_words[5]${(j..)matched_words[3,4]}\
+    if (( neg )); then
+	LBUFFER="$matched_words[1]"
+	RBUFFER="$matched_words[5]${(j..)matched_words[3,4]}\
+$matched_words[2]${(j..)matched_words[6,7]}"
+    else
+	LBUFFER="$matched_words[1]$matched_words[5]${(j..)matched_words[3,4]}\
 $matched_words[2]"
-    RBUFFER="${(j..)matched_words[6,7]}"
+	RBUFFER="${(j..)matched_words[6,7]}"
+    fi
 
 done