Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: error using custom widget: widgets can only be called when ZLE is active [solved]
- X-seq: zsh-users 11073
- From: Mikel Ward <mikel@xxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: error using custom widget: widgets can only be called when ZLE is active [solved]
- Date: Sun, 10 Dec 2006 11:10:27 +1100
- In-reply-to: <457B444E.2020207@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <457B444E.2020207@xxxxxxxxxxxxx>
Hi
The error message lead me to believe the error was in the first line of
the function (i.e. zsh backward-word), but by deduction I found out the
actual problem was trying to run zle in a subshell.
Manipulating the kill ring array directly instead of calling "zle
yank-pop" seems to work.
expand-word-path ()
{
zle backward-word
zle set-mark-command
zle forward-word
zle copy-region-as-kill
word=$killring[0]
killring[0]=()
realpath=$(realpath $word 2>/dev/null)
if test -n "$realpath"
then
zle backward-kill-word
zle -U "$realpath"
fi
}
The only thing now is invoking it on an empty word multiple times does
weird things. Probably some edge cases I have to look at, such as when
$word is empty.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author