From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 496 invoked from network); 6 Oct 2000 05:10:08 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 6 Oct 2000 05:10:08 -0000 Received: (qmail 12174 invoked by alias); 6 Oct 2000 05:09:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12912 Received: (qmail 12167 invoked from network); 6 Oct 2000 05:09:46 -0000 From: "Bart Schaefer" Message-Id: <1001006050940.ZM24538@candle.brasslantern.com> Date: Fri, 6 Oct 2000 05:09:40 +0000 X-Mailer: Z-Mail (5.0.0 30July97) To: Subject: Standard setopts for completion system, again MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > I've suggested before that we should have one ... function? alias? ... > that installs the "standard completion-system setopts" so that we don't > have to remember to edit all these different places. As I noted once before, the problem with having this be a function is that said function must unset localoptions, which means that the caller has to remember to set localoptions again. Grepping through the completion functions for `setopt', I find that I have some questions .... Builtins/_cd:14:setopt localoptions nonomatch Builtins/_popd:8:setopt extendedglob nonomatch Given these functions explicitly setopt nonomatch, does that mean that they intend patterns that don't match to remain unchanged? If that's the case, then they should also unsetopt nullglob. Commands/_read_comp:26:setopt localoptions extendedglob nobadpattern # xtrace promptsubst It looks like this function could use a few more of the standard setopts than it has, especially ksharrays, but I wanted to double-check. Core/_expand:10:setopt localoptions nullglob nonomatch Hmm, is it necessary to set both nullglob and nonomatch? Nullglob will make the patterns vanish before nomatch has a chance to complain. And this function ought either to get the rest of the standard setopts if it is meant to be called independent of _main_complete, or else it doesn't need any setopts at all. Core/_path_files:13:setopt localoptions nullglob rcexpandparam Core/_path_files:14:unsetopt markdirs globsubst shwordsplit nounset User/_mailboxes:70: setopt localoptions nullglob User/_man:3:setopt localoptions rcexpandparam User/_perl_modules:49: setopt localoptions extendedglob Other cases where either all or none of the standard options seems to be the right thing. Am I missing something? Here's a patch for the places where it's obvious cshnullglob needs to be unset. I changed Sven's `no*' forms back into an unsetopt in _main_complete; I don't think it's significantly faster to use one command instead of two, and it's much easier to read without all those repeated `no's. diff -ru common/Completion/Commands/_bash_completions current/Completion/Commands/_bash_completions --- Completion/Commands/_bash_completions Fri Aug 11 09:46:20 2000 +++ Completion/Commands/_bash_completions Thu Oct 5 21:56:22 2000 @@ -25,8 +25,8 @@ # that will not have been overridden, so you should add '~' to the # list of keys at the top of the for-loop. -setopt localoptions nullglob rcexpandparam extendedglob noshglob -unsetopt markdirs globsubst shwordsplit nounset ksharrays +setopt localoptions nullglob rcexpandparam extendedglob unset +unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob local key=$KEYS[-1] expl diff -ru common/Completion/Commands/_complete_debug current/Completion/Commands/_complete_debug --- Completion/Commands/_complete_debug Fri Sep 15 08:25:26 2000 +++ Completion/Commands/_complete_debug Thu Oct 5 21:56:22 2000 @@ -1,7 +1,7 @@ #compdef -k complete-word \C-x? -setopt localoptions nullglob rcexpandparam extendedglob noshglob -unsetopt markdirs globsubst shwordsplit nounset ksharrays +setopt localoptions nullglob rcexpandparam extendedglob unset +unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob setopt localtraps noerrexit ; trap - ZERR diff -ru common/Completion/Commands/_complete_help current/Completion/Commands/_complete_help --- Completion/Commands/_complete_help Thu Aug 3 07:46:42 2000 +++ Completion/Commands/_complete_help Thu Oct 5 21:56:22 2000 @@ -1,8 +1,8 @@ #compdef -k complete-word \C-xh _complete_help() { - setopt localoptions nullglob rcexpandparam extendedglob noshglob - unsetopt markdirs globsubst shwordsplit nounset ksharrays + setopt localoptions nullglob rcexpandparam extendedglob unset + unsetopt markdirs globsubst shwordsplit shglob ksharrays cshnullglob exec