From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2375 invoked from network); 22 Mar 1999 12:45:01 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Mar 1999 12:45:01 -0000 Received: (qmail 8163 invoked by alias); 22 Mar 1999 12:44:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5872 Received: (qmail 8156 invoked from network); 22 Mar 1999 12:44:14 -0000 Date: Mon, 22 Mar 1999 13:44:12 +0100 (MET) Message-Id: <199903221244.NAA08021@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: PATCH: completion examples Here are the changes for the example functions... The most important change is that I've split `_main_complete' in several functions, which I called `completers' for now. The original completion code is in `_complete', the correcting completion is in `_approximate' (any suggestions for a better name, anyone?) and then there is a new one called `_correct' which does only correction, not completion. `_main_complete' now mainly calls the completer functions given by `compconf completer=...'. The default value is only `_complete', but you set this to, e.g.: compconf completer=_complete:_correct:_approximate which will make _main_complete call them in turn to generate matches until one returns zero (which means that matches were found). Along with this goes a bit of cleaning up and enhancing in the configuration values. What was `correct_orig' is now `correct_original' and what was `correct' is now `correct_accept', hopefully making this cleaner and more name-spacish. Also, `_approximate' now first tries to use the keys `approximate_accept', `approximate_prompt', and so on. If they are not set, the ones with a `correct' in front are used. The `_correct' completer only uses the second ones, which allows you to give different values for correction only and correcting completion. To make this more fun, the `..._accept' keys have a new feature: if they contain both an [nN] and a `!', the correction is only tried if *no* numeric argument is given. E.g. if you have: compconf correct_accept='2n!' approximate_accept=2n and do `M-2 TAB', you will get correcting completion, not only correction (for the difference between the two, try `Srt' in the main directory of the distribution, btw). Note also that there is now a default value for `correct_accept', which should be acceptable because you'll have to set the `completer' key to get correction (but maybe you'll like to suggest a differnt value than `2n'?). There is also a new configuration key `{correct,approximate}_insert'. If this is set to anything starting with `unambig', the code will insert an unambiguous string if there is a sensible one instead of always starting menu-completion (this affects only those of us who don't always use menu-completion, of course). For now `sensible' means just that the unambiguous string is at least as long as the original one. I'll have to play with this some more to know what one may want to configure there. Other smaller changes: - The documentation for the configuration stuff is now in `_main_complete' and the completer functions. - I've put the `_math' function back which was missing in the distribution. - Then I've changed `_tilde', `_math', and `_brace_parameter' to use the `ISUFFIX' parameter to allow in-word completion. Apart from the question for a bettern name for `approximate' here is another question: we could make `compinit' be aware of the completer functions and make it find them automatically (e.g. with a new tag `#completer'). It could then make the code use all completer functions found, for which we would need to make them ordered. This could be done the way Peter suggested it for pattern completions, naming them `_0_complete', `_1_correct', and so on. Personally I think the current way is probably better, but at least I wanted to mention it -- should we...? Or maybe we should at least put them in a separate directory? Anyway, thanks go to Peter and Bart to make me think about `_correct'. Bye Sven P.S.: And finally: I forgot to say that the patch I just send for tricky.c should also solve the problem Andrej reported in 5864. begin 600 patch-example.gz M'XL("%`B]C8"`W!A=&-H+65X86UP;&4`[5U[<]M&DO];^A03D0[%!_B29$7< MXL9)-DGY:N/=K.-+]F2M!)$@A3,),`!H69&9SW[]F!D,@`%$2LY=7=6Z7"() MS/3,=/?T=/?\!ICZLYEPUL*)1#CI?>W&7N_R.G(GWN7*C=REEWB1^"9 MXH>!O<"^XSBEM?=^"`/Q@QN)X5`,^J/^8'3T7`S.SL[VV^WV@Z1SM4^&H^$I MUW[Q0CC#SK%H#SN#OGCQ8E_LBYIX[2,]<;U.Q*V?W(3P&:]@B'YF"_[<_$^3D4?_WFN^]>_G(@ MQJ+U=M,2%Q=_$LF-%^RWA7C)]\9`D[_5H,BF+B\?8)%\"6AFT]K0K0?ZND-7 MO47L?5J*,W]_:E&M11C,+\,5"CPN"M^\FU4J\XY%HTXK-*JJZO&H;ZK38-@Y M!84::)428N4FR/M5Y&U:!_+";.'.XW&C@3\OEVXRN0&%34!;`Y$=(%S5Y??; M6!P4P@F`BY?(:?@31=XD.0"=$)]_GI(^J*NOAS4W6[8)O$5)D6;AC3AQ$^]< MML^]N3@0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