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

Re: PATCH: rewrite of completion matching



Here it is a week later, and I'm finally getting a chance to really
pay attention to this patch.

All of the exposition sounds sensible so I'm diving right down into
the patch itself for comments/questions ... seems I don't have many.

On Jun 7,  9:34pm, Peter Stephenson wrote:
}
} +classes.  The only special behaviour in correspondence classes is if
} +the form on the left and the form on the right are each one of
} +tt([:upper:]), tt([:lower:]).  In these cases the
} +character in the word and the character on the line must be the same up
} +to a difference in case.  Hence to make any lower case character on the
} +line match the corresponding upper case character in the trial
} +completion you can use `tt(m:{[:lower:]}={[:upper:]})'.  Although the
} +matching system does not yet handle multibyte characters, this is likely
} +to be a future extension, at which point this syntax will handle
} +arbitrary alphabets ; hence this form, rather than the use of explicit
} +ranges, is thee recommended form.  In other cases
} +`tt([:)var(name)tt(:])' forms are allowed, but imply no special
} +constraint on the characters beyond that implied by the test itself.

I'm afraid I don't follow "imply no special constraint".  Suppose I
write m:{[:punct:]}={[:space:]} -- what have I just told zsh to do?
And why does that differ in other than the obvious way from what it
does when I tell it m:{[:lower:]}={[:upper:]} ?

I *think* you mean that m:{[:punct:]}={[:space:]} is "any single
punctuation character matches any single whitespace character,"
whereas m:{[:lower:]}={[:upper:]} is "each lower case character
matches the corresponding upper case character."  That is, the former
works like "sed 's/[[:punct:]]/[[:space:]]/g'" but the latter works
like "tr '[:lower:]' '[:upper:]'".

(As "tr" allows only lower/upper to be used like this, I guess that
makes sense.)

} +example(compadd -M 'L:|[nN][oO]= M:_= M:{[:up[er:]}={[:lower:]}' - \ 

Typo there s/p\[e/ppe/.



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