* PATCH: minor example additions
@ 1999-03-29 13:45 Sven Wischnowsky
0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-03-29 13:45 UTC (permalink / raw)
To: zsh-workers
This makes `compconf' without arguments print the config keys set
(with their values, of course), and makes `_compalso' accept more than
one context/command name.
Bye
Sven
diff -u oc/Core/_compalso Completion/Core/_compalso
--- oc/Core/_compalso Mon Mar 29 11:48:52 1999
+++ Completion/Core/_compalso Mon Mar 29 15:41:47 1999
@@ -1,15 +1,17 @@
#autoload
-# This searches $1 in the array for normal completions and calls the result.
+# This searches $* in the array for normal completions and calls the result.
# It is used to include completions for another command or special context
# into the list generated by the calling function.
# For example the function for `-subscript-' could call this as in
# `_compalso -math-' to get the completions that would be generated for a
# mathematical context.
-local tmp ret=1
+local i tmp
-tmp="$_comps[$1]"
-[[ -z "$tmp" ]] || "$tmp" && ret=0
+for i; do
+ tmp="$_comps[$1]"
+ [[ -z "$tmp" ]] || "$tmp" && return 0
+done
-return ret
+return 1
diff -u oc/Core/compinit Completion/Core/compinit
--- oc/Core/compinit Mon Mar 29 11:48:52 1999
+++ Completion/Core/compinit Mon Mar 29 15:43:02 1999
@@ -218,17 +218,24 @@
# and sets the according values in `compconfig'.
# Arguments may be `foo=bar' to set key `foo' to `bar' or `baz' to
# set key `baz' to the empty string.
+# If no arguments are given, all configurations keys set are displayed.
compconf() {
local i
- for i; do
- if [[ "$i" = *\=* ]]; then
- compconfig[${i%%\=*}]="${i#*\=}"
- else
- compconfig[$i]=''
- fi
- done
+ if (( $# )); then
+ for i; do
+ if [[ "$i" = *\=* ]]; then
+ compconfig[${i%%\=*}]="${i#*\=}"
+ else
+ compconfig[$i]=''
+ fi
+ done
+ else
+ for i in ${(k)compconfig}; do
+ print ${(r:25:)i} $compconfig[$i]
+ done
+ fi
}
# Now we automatically make the definition files autoloaded.
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-03-29 13:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-29 13:45 PATCH: minor example additions Sven Wischnowsky
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).