Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vi editting troubles



On May 22,  8:04pm, Paul Ackersviller wrote:
} Subject: Re: vi editting troubles
}
} Peter Stephenson wrote:
} > > Another strange thing I notice when I turn on shell tracing is that my
} > > TRAPZERR function runs in the middle of _history_complete_word -- is
} > > there something I should be doing to avoid this?
} > 
} > Oh, yuk.  We really need some way of getting the effect of `setopt
} > localtraps; unfunction TRAPZERR' in all completion functions.
} 
} Are you saying this is still a potential problem in a general sense?

Yes.  The completion functions use a non-zero return value to report
various conditions (often as simple as that no completions were found).
The ZERR trap triggers on every such "failure".  In _main_complete,
which is called e.g. when you press TAB, there is code to fix up three
different potential problems:

(1) The completion functions assume a particular collection of setopts,
    so a call is made to initialize them properly.

(2) ZLE closes stdin when running a widget.  This confuses some external
    commands, so _main_complete redirects from /dev/null.

(3) Turn off ZERR trapping.

However, there are several functions that are called as completion widgets
without passing through _main_complete; _history_complete_word is one.  We
did a sweep through them and took care of item (1) everywhere, but items
(2) and (3) were not always caught.  It isn't always necessary to do
anything about (2), but it appears it is always necessary to handle (3).
The only question is whether to sweep the functions again, or figure out
some centralized way to fix it for good.

} If it helps to know, _history_complete_word no longer shows me any
} errors

That's only because you aren't actually invoking _history_complete_word
any more.

} and this behaviour goes away with Bart's suggestion of moving
} `bindkey -v' after `compinit'.  You could document this as a bug, but
} how can you ensure people always use this ordering?

We can't ensure it, which is why I directed a question to zsh-workers
about the reason for the choice of keybindings.  I'm a bit surprised that
no one spoke up.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author