Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: was: Re: Inserting all completions
- X-seq: zsh-workers 7953
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: was: Re: Inserting all completions
- Date: Mon, 20 Sep 1999 14:27:51 +0200 (MET DST)
- In-reply-to: Sven Wischnowsky's message of Mon, 20 Sep 1999 11:56:14 +0200 (MET DST)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
I wrote:
> Currently no completion function uses this. Maybe I'll change
> `_expand' to allow this kind of `expansion', too.
Here it is. Controlled by the key `expand_completions'.
Bye
Sven
diff -u -r oldcompletion/Commands/_expand_word Completion/Commands/_expand_word
--- oldcompletion/Commands/_expand_word Mon Sep 20 13:06:50 1999
+++ Completion/Commands/_expand_word Mon Sep 20 14:24:06 1999
@@ -10,12 +10,14 @@
local oem="$compconfig[expand_menu]"
local oeo="$compconfig[expand_original]"
local oep="$compconfig[expand_prompt]"
+local oec="$compconfig[expand_completions]"
compconfig[expand_substitute]="${compconfig[expandword_substitute]}"
compconfig[expand_glob]="${compconfig[expandword_glob]-$oeg}"
compconfig[expand_menu]="${compconfig[expandword_menu]-$oem}"
compconfig[expand_original]="${compconfig[expandword_original]-$oeo}"
compconfig[expand_prompt]="${compconfig[expandword_prompt]-$oep}"
+compconfig[expand_completions]="${compconfig[expandword_completions]-$oec}"
_main_complete _expand
@@ -24,3 +26,4 @@
compconfig[expand_menu]="$oem"
compconfig[expand_original]="$oeo"
compconfig[expand_prompt]="$oep"
+compconfig[expand_completions]="$oec"
diff -u -r oldcompletion/Core/_expand Completion/Core/_expand
--- oldcompletion/Core/_expand Mon Sep 20 13:06:51 1999
+++ Completion/Core/_expand Mon Sep 20 14:18:59 1999
@@ -58,6 +58,14 @@
local exp word="$PREFIX$SUFFIX" group=-V expl expl2 disp
+# First, see if we should insert all *completions*.
+
+if [[ -n "$compconfig[expand_completions]" &&
+ "${(e):-\$[$compconfig[expand_substitute]]}" -eq 1 ]]; then
+ compstate[insert]=all
+ return 1
+fi
+
# Do this only for the first global matcher.
[[ "$compstate[matcher]" -le 1 ]] || return 1
diff -u od/Zsh/compsys.yo Doc/Zsh/compsys.yo
--- od/Zsh/compsys.yo Mon Sep 20 14:16:47 1999
+++ Doc/Zsh/compsys.yo Mon Sep 20 14:26:45 1999
@@ -479,6 +479,10 @@
ifzman(the section `Completion System Configuration' below)\
ifnzman(noderef(Completion System Configuration)).
+In a different mode selected by the tt(expand_completions)
+configuration key, all em(completions) generated for the string on the
+line are inserted.
+
None of these configuration keys has a default value.
)
item(tt(_list))(
@@ -1346,8 +1350,16 @@
`tt(%B)', etc. Also, the sequence `tt(%o)' in this string will be
replaced by the original string.
)
+item(tt(expand_completions))(
+If this is set and non-empty, its value will be evaluated in the same
+way as tt(expand_substitute) and if the result is `tt(1)', no
+expansions will be generated, but instead the completions will be
+generated as normal and all of them will be inserted in the command
+line.
+)
item(tt(expandword_substitute), tt(expandword_glob),
-tt(expandword_menu),tt(expandword_original), tt(expandword_prompt))(
+tt(expandword_menu), tt(expandword_original), tt(expandword_prompt),
+tt(expandword_completions))(
If these keys are set, they are used by the tt(_expand_word) bindable
command to override the values for the configuration keys with the
tt(expand_) prefix.
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author