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

Re: PATCH: _insert_all_matches bindable command

On Sep 20,  3:08pm, Andrej Borsenkow wrote:
} - I could not find a way to supress suffix addition. It is weird as it is
} added only to the last match anyway. Sven?

This happens any time you insert multiple matches.  Look at the code for
the add-space style in _expand -- it deliberately changes the compadd
command for each match in order to suppress the suffix or change it to
a space.

} sourceforge CVS server is down, so I just send the function itself

BTW, for those of you who don't get sourceforge user update mailings, the
scheduled downtime this weekend has been canceled, and will be sometime in
October instead.

} zstyle -s ":completion:${curcontext}:" old-list list
} # If there is already an old list,
} # and either the style :insert-all-matches:old-list is `always',
                   :completion:insert-all-matches:* old-list  ??
} # or it is not `never', then insert the existing list
} # (even if it was generated by another widget).
} # Else just call completion and insert whatever matches it generated
} # TODO: does not work in menu selection
} if [[ -n $compstate[old_list] && $list != never &&
}       $LASTWIDGET != _complete_help && $WIDGET != _complete_help ]]; then

It's never possible for $WIDGET to be _complete_help, is it?  Both this
function and _complete_help must be separately bound to keystrokes.  You
would only need to test $WIDGET if this were a completer like _expand.

And you can do

  if [[ -n $compstate[old_list] ]] && $LASTWIDGET != _complete_help &&
  	! zstyle -t ":completion:${curcontext}:" old-list never; then

instead of separately fetching the value into $list and then testing it.

} else
}     curcontext="$oldcurcontext"
}     _main_complete
}     ret=$?
}     compstate[insert]=all
}     return $ret
} fi

Why reset the current context?  And why not just

    _main_complete && compstate[insert]=all

??  Do you really want to set compstate[insert] when the function is going
to return nonzero?

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