about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-01-29 14:20:55 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-01-29 14:20:55 +0000
commit4db0b10fc2f5b5c1344004cdb28ef257d8e5de85 (patch)
tree2ea644d905f2aac33e75663585d8e3aeaed89047
parent772189d23e58fd993c96440aabc64b58b29d8a7c (diff)
downloadzsh-4db0b10fc2f5b5c1344004cdb28ef257d8e5de85.tar.gz
zsh-4db0b10fc2f5b5c1344004cdb28ef257d8e5de85.tar.xz
zsh-4db0b10fc2f5b5c1344004cdb28ef257d8e5de85.zip
18156: use reply array instead of ali for plugins and document new styles
-rw-r--r--ChangeLog9
-rw-r--r--Completion/Unix/Type/_email_addresses20
-rw-r--r--Doc/Zsh/compsys.yo24
3 files changed, 43 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index e3375dd7f..722135d94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-01-29  Oliver Kiddle  <opk@zsh.org>
+
+	* 18156: Completion/Unix/Type/_email_addresses, Doc/Zsh/compsys.yo:
+	use more conventional reply array for plugins, document new styles
+	used in _email_addresses and document bashcompinit
+
+	* 18149, 18153: Completion/bashcompinit: new function for
+	emulating bash's programmable completion system
+
 2003-01-27  Bart Schaefer  <schaefer@zsh.org>
 
 	* 18144: Src/init.c: no SIGHUP handler if parent was ignoring
diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses
index fe4f252c8..3d2ce2911 100644
--- a/Completion/Unix/Type/_email_addresses
+++ b/Completion/Unix/Type/_email_addresses
@@ -7,14 +7,14 @@
 #
 # Plugins are written as separate functions with names starting `_email-'.
 # They should either do their own completion or return the addresses in the
-# ali array in the form 'alias:address' and return 300. The -c option is
+# reply array in the form 'alias:address' and return 300. The -c option is
 # passed on to plugins (and -n could be if needed ever). New plugins will be
 # picked up and run automatically.
 
 # plugins
 (( $+functions[_email-mail] )) ||
 _email-mail() {
-  ali=( ${${${(M)${(f)"$(<$files[$plugin])"}:#alias*}##alias[[:blank:]]##}/[[:blank:]]##/:} )
+  reply=( ${${${(M)${(f)"$(<$files[$plugin])"}:#alias*}##alias[[:blank:]]##}/[[:blank:]]##/:} )
   return 300
 }
 (( $+functions[_email-mutt] )) || _email-mutt() { _email-mail }
@@ -22,13 +22,13 @@ _email-mail() {
 
 (( $+functions[_email-MH] )) ||
 _email-MH() {
-  ali=( ${${(f)"$(_call_program aliases ali)"}/: /:} )
+  reply=( ${${(f)"$(_call_program aliases ali)"}/: /:} )
   return 300
 }
 
 (( $+functions[_email-pine] )) ||
 _email-pine() {
-  ali=( ${${${${${(f)"$(<~/.addressbook)"}:#*DELETED*}:#\ *}/	[^	]#	/:}%%	*} )
+  reply=( ${${${${${(f)"$(<~/.addressbook)"}:#*DELETED*}:#\ *}/	[^	]#	/:}%%	*} )
   return 300
 }
 
@@ -77,7 +77,7 @@ _email-local() {
 }
 
 _email_addresses() {
-  local -a plugins ali list args
+  local -a plugins reply list args
   local -A opts files
   local plugin rcfile expl ret fret
 
@@ -147,17 +147,17 @@ _email_addresses() {
 
 	  if (( fret == 300 )); then
 	    if (( ! $+opts[-c] )) && [[ $opts[-n] = $plugin ]]; then
-	      zformat -a list ' -- ' "${ali[@]}"
+	      zformat -a list ' -- ' "${reply[@]}"
 	      _wanted mail-aliases expl 'alias' compadd "$@" \
-		  -d list - ${ali%%:*} && ret=0
+		  -d list - ${reply%%:*} && ret=0
 	    else
 	      if (( $#args )); then
-		ali=( ${(SM)${ali#*:}##$~__addrspec} )
+		reply=( ${(SM)${reply#*:}##$~__addrspec} )
 	      else
 		# remove lines not containing `@' as they probably aren't addresses
-		ali=( "${(@)${(M@)ali:#*@*}#*:}" )
+		reply=( "${(@)${(M@)reply:#*@*}#*:}" )
 	      fi
-	      compadd -a "$@" "$expl[@]" ali && ret=0
+	      compadd -a "$@" "$expl[@]" reply && ret=0
 	    fi
 	  fi
 	done
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index e589533cf..a8a1bbe42 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1244,6 +1244,15 @@ time.  If the style is set to any other value, or is unset, files will be
 sorted alphabetically by name.  If the value contains the string
 `tt(reverse)', sorting is done in decreasing order.
 )
+kindex(filter, completion style)
+item(tt(filter))(
+This is used by the LDAP plugin for e-mail address completion to specify
+the attributes to match against when filtering entries. So for example, if
+the style is set to `tt(sn)', matching is done against surnames. Standard
+LDAP filtering is used so normal completion matching is bypassed. If this
+style is not set, the LDAP plugin is skipped. You may also need to set the
+tt(command) style before it can connect to your LDAP server though.
+)
 kindex(force-list, completion style)
 item(tt(force-list))(
 This forces a list of completions to be shown at any point where listing is
@@ -2091,6 +2100,13 @@ the opposite end of the history.  If this style is set to `false' (the
 default), tt(_history_complete_word) will loop immediately as in a
 menu completion.
 )
+kindex(strip-comments, completion style)
+item(tt(strip-comments))(
+If set to `true', this style causes non-essential comment text to be
+removed from the completion matches. Currently it is only used when
+completing e-mail addresses where it removes any display name from the
+addresses, cutting them down to plain var(user@host) form.
+)
 kindex(subst-globs-only, completion style)
 item(tt(subst-globs-only))(
 This is used by the tt(_expand) completer.  If it is set to `true',
@@ -2856,6 +2872,14 @@ tt(COMPLETE_IN_WORD) option is set; otherwise, the cursor will
 be moved to the end of the current word before the completion code is
 called and hence there will be no suffix.
 )
+findex(bashcompinit)
+item(tt(bashcompinit))(
+This function provides compatibility with bash's programmable completion
+system. When run it will define the functions, tt(compgen) and
+tt(complete) which correspond to the bash builtins with the same names. It
+will then be possible to use completion specifications and functions
+written for bash.
+)
 enditem()
 
 texinode(Bindable Commands)(Completion Functions)(Control Functions)(Completion System)