From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18387 invoked from network); 29 May 2001 11:58:36 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 29 May 2001 11:58:36 -0000 Received: (qmail 15530 invoked by alias); 29 May 2001 11:58:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14530 Received: (qmail 15507 invoked from network); 29 May 2001 11:58:26 -0000 From: Sven Wischnowsky Date: Tue, 29 May 2001 13:57:31 +0200 (MET DST) Message-Id: <200105291157.NAA09013@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: PATCH: Re: vi editting troubles In-Reply-To: <200105290659.IAA08490@beta.informatik.hu-berlin.de> I wrote: > Bart Schaefer wrote: > > > On May 23, 11:18am, Wayne Davison wrote: > > > > > > An off-the-cuff suggestion: Would it be possible to have the C code > > > call a "set completion defaults" shell function > > > > The problem with any shell-function-based solution is that it requires a > > special case for the `localoptions' setting. > > > > Better, perhaps, would be to augment the _comp_options variable with a > > _comp_setup variable, which would look something like this: > > > > _comp_setup='setopt ${_comp_options[@]} localtraps; > > exec > trap - ZERR' > > > > and then `eval' that variable in any function that is an entry point into > > the completion system. > > Hm, not one reply so far (unless I've missed something). > > This is of course better than what I suggested in 14449 because I always > forget about eval. I'd even volunteer to make that change... or is > anyone really against it? Here it is. There are still some functions in Base/Widget that don't eval $_comp_setup but they either call _main_complete later or something entirely different anyway (and use emulate -L or some such), so I wasn't sure if we should use it there, too. Some part of my brain says yes, other parts say no or `for some...'. Bye Sven Index: Completion/compinit =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/compinit,v retrieving revision 1.4 diff -u -r1.4 compinit --- Completion/compinit 2001/04/29 19:12:14 1.4 +++ Completion/compinit 2001/05/29 11:54:54 @@ -139,7 +139,18 @@ NO_cshnullglob NO_allexport NO_aliases + NO_errexit ) + +# And this one should be `eval'ed at the beginning of every entry point +# to the completion system. It sets up what we currently consider a +# sane environment. That means we set the options above, make sure we +# have a valid stdin descriptor (zle closes it before calling widgets) +# and don't get confused by user's ZERR trap handlers. + +_comp_setup='setopt localoptions localtraps ${_comp_options[@]}; + exec