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

Re: [PATCH] Add zsh/re2 module with conditions

On 2016-09-08 at 23:14 +0200, Oliver Kiddle wrote:
> Phil Pennock wrote:
> > At this point, I haven't done anything about rebinding =~ to handle
> > this.  It's purely new infix-operators based on words.  I'm thinking
> > perhaps something along the lines of $zsh_reop_modules=(regex), with
> > `setopt rematch_pcre` becoming a compatibility interface that acts as
> > though `pcre` were prepended to that list and
> >
> >   zsh_reop_modules=(pcre regex)
> >
> > having the same effect.  Then I could use `zsh_reop_modules=(re2 regex)`.
> > Does this seem sane?  Anyone have better suggestions?  I do want to have
> If the first listed module in the array has control of =~, what is
> the meaning of subsequent ones?

Ignored, as long as the first one could be loaded.

The first loadable one gets =~
It's bound and tied at that point.
If the variable is re-assigned to, the shell would try again to work
through the list.

> How about perhaps using a module alias so you would do, e.g.
>   zmodload -A zsh/default/regex=zsh/re2

Would probably need to be more than that, to be able to alias explicit
features.  It's C: infix-conditionals which need to be grabbed, a
different one from each module.


Attachment: signature.asc
Description: Digital signature

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