Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion troubles
- X-seq: zsh-workers 11043
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Re: Completion troubles
- Date: Mon, 1 May 2000 17:45:27 +0000
- In-reply-to: <390DAF22.A11AFB7B@xxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <390DAF22.A11AFB7B@xxxxxxxxxxxxx>
On May 1, 5:21pm, Oliver Kiddle wrote:
} Subject: Completion troubles
}
} I've had a couple of problems with the latest zsh:
}
} nedit -lm <tab>
} Gives me a message about _all_labels:39: command not found: -M
I get an error message about ~/.nedit not being found. I don't have
to have a .nedit to run nedit, do I?
} I can't see where this might be a problem anywhere in _nedit. I can
} reproduce it from a basic zsh -f based setup (although it complains
} about -J instead).
Use _complete_debug, ^X?, and examine the trace file. You should see
a line similar to this (I have PS4='+%1N:%i%1(_.:%_.): ') somewhere:
+_wanted:23:while: _all_labels -J neditlanguages expl language mode compadd -
(with the list of languages following the "_"). _all_labels expects the
command to run to be $4 ("compadd" above, "language mode" is $3). I have
a suspicion that you're getting the wrong version of _nedit somehow, but
I can't be sure.
} The other thing is the _expand completer now seems to be expanding
} everything after a tilde which is annoying.
Hmm, that doesn't happen to me; I get this sort of thing:
zagzig[76] ls ~-<TAB>
Completing directory stack
0 -- /usr/src/local/zsh/zsh-forge/current
1 -- /usr/src/local/zsh/zsh-3.1.6
If there is no directory stack, then it immediately inserts `0/' and
goes on completing.
} I think _expand really needs a rethink because it is more
} trouble than it is worth at the moment. For example, if you do:
} cd ${foo<tab>
} you get a message about a closing brace being expected
That one also works for me. I think you must have the `substitute' style
set to a true value. However, we can fix the problem with the closing
brace; that happens because a missing close-brace is a parse error that
aborts the entire function. The workaround is to force that parse error
into a subshell; unpleasant, but nothing else will do. (Ick, those kind
of aborts do very unpleasant things to _complete_debug, leaving stderr
pointing into the completion trace file. I can't think of a fix, though.)
Index: Completion/Core/_expand
===================================================================
@@ -32,13 +32,14 @@
exp=("$word")
# First try substitution. That weird thing spanning multiple lines
-# changes quoted spaces, tabs, and newlines into spaces.
+# changes quoted spaces, tabs, and newlines into spaces and protects
+# this function from aborting on parse errors in the expansion.
{ zstyle -s ":completion:${curcontext}:" substitute expr ||
{ [[ "$curcontext" = expand-word:* ]] && expr=1 } } &&
[[ "${(e):-\$[$expr]}" -eq 1 ]] &&
- exp=( "${(e)exp//\\[
-]/ }" )
+ exp=( ${(f)"$(print -lR - ${(e)exp//\\[
+]/ } 2>/dev/null)"} )
# If the array is empty, store the original string again.
Index: Completion/User/_nedit
===================================================================
@@ -44,7 +44,7 @@
"$nedit_common[@]"
fi
-[[ $state = lang ]] &&
+[[ $state = lang && -f ~/.nedit ]] &&
_wanted neditlanguages expl 'language mode' \
compadd - ${(f)"$(sed -n \
'/^nedit.languageMode/,/^nedit/ s/.* \([^:]*\).*/\1/p' < ~/.nedit)"}
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author