* Completion troubles
@ 2000-05-01 16:21 Oliver Kiddle
2000-05-01 17:45 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Kiddle @ 2000-05-01 16:21 UTC (permalink / raw)
To: Zsh workers
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 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). The sed command to get the list of languages does
little more than output a list of words (some of which contain spaces)
but I can provide an sample .nedit file if you have trouble reproducing
it.
The other thing is the _expand completer now seems to be expanding
everything after a tilde which is annoying. I'm sure that it used to
work (not expanding anything after tilde), then it started completing
named directories and home directories. Now it also expands ~+ so I
can't use it and get the very useful list of directories in the stack to
complete from. 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 rather than
completing the variable names. _expand should either do something useful
or pass on to the next completer.
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Completion troubles
2000-05-01 16:21 Completion troubles Oliver Kiddle
@ 2000-05-01 17:45 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-05-01 17:45 UTC (permalink / raw)
To: Zsh workers
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-05-01 17:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-01 16:21 Completion troubles Oliver Kiddle
2000-05-01 17:45 ` Bart Schaefer
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).