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

Re: Non-intuitive completion



Bart Schaefer wrote:

> ...
> 
> Now, if you'd like to see some REALLY strange behavior, which definitely
> IS a bug in my book, try
> 
> zsh% bindkey '^I' expand-or-complete
> zsh% setopt nounset
> zsh% print $ZSH_*<TAB>

The problem is that docomplete() temporarily sets noerrs=1 around the
call to doexpansion(). After some other function calls paramsubst()
finally calls zerr() which does nothing if noerrs is set, i.e. it
doesn't even set errflag which would be correctly handled in
doexpansion().
The patch below fixes the problem by making zerr() set errflag
independent of the setting of noerrs. I am far from knowing if this
should go there (or in paramsubst() or in prefork(), or in...). Of
course setting it at the lowest function in the call chain can have
all kinds of nasty side effects. Maybe someone with more experience in 
zerr() stuff could comment on this (please).

Bye
 Sven

*** os/utils.c	Thu Dec  3 09:10:46 1998
--- Src/utils.c	Thu Dec  3 12:07:49 1998
***************
*** 52,59 ****
  void
  zerr(const char *fmt, const char *str, int num)
  {
!     if (errflag || noerrs)
  	return;
      errflag = 1;
      trashzle();
      /*
--- 52,61 ----
  void
  zerr(const char *fmt, const char *str, int num)
  {
!     if (errflag || noerrs) {
! 	errflag = 1;
  	return;
+     }
      errflag = 1;
      trashzle();
      /*


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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