* Re: How to complete backquote, etc. using compsys? [not found] ` <3B8B6600.54A33D8E@yahoo.co.uk> @ 2001-08-28 15:50 ` Bart Schaefer 2001-08-29 17:31 ` Oliver Kiddle 0 siblings, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2001-08-28 15:50 UTC (permalink / raw) To: zsh-workers [Redirected to -workers] On Aug 28, 10:36am, Oliver Kiddle wrote: } Subject: Re: How to complete backquote, etc. using compsys? } } Bart Schaefer wrote: } > } > On Aug 23, 10:49am, Oliver Kiddle wrote: } > } } > } No, you didn't miss an option. The new completion system just doesn't } > } complete the backquote. [...] At the moment, I don't think the shell } > } code can tell if it is in $( .. ) } > } > Yes, it can tell that it's in $(...) or `...`. } } compstate[quote] and compstate[quoting] indicate if it is in `...` but } how can it tell it's in $(...)? Hmm, at the moment perhaps it doesn't, but it could look at $LBUFFER to find out. } The level of nesting would also be useful. It should be easy to add a special parameter that gives the same info as the %_ prompt expansion. I tried ${(%):-%_} but (not surprisingly) the parser stack isn't "live" during the execution of the completion function. } [...] it would be useful to have the backquote as a removable } suffix because it is quicker to press space than backquote. The problem is that you end up with too many layers of autoremovable suffixes. When completing a path name within backticks, you can't get both the trailing / on a directory name and the trailing backtick. } Also, without multios the closing } bracket of $(<...) should always be completed. It would have to be an autoremovable suffix, too; `echo $(<file wc)' is a silly example of why. -- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to complete backquote, etc. using compsys? 2001-08-28 15:50 ` How to complete backquote, etc. using compsys? Bart Schaefer @ 2001-08-29 17:31 ` Oliver Kiddle 2001-08-29 17:52 ` Bart Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Oliver Kiddle @ 2001-08-29 17:31 UTC (permalink / raw) To: zsh-workers Bart Schaefer wrote: > > } how can it tell it's in $(...)? > > Hmm, at the moment perhaps it doesn't, but it could look at $LBUFFER to > find out. Parsing $LBUFFER correctly to avoid any quoted $( and matching the closing brackets wouldn't be easy. No doubt, the C code already has this information. As you tried, it won't give it to us with %_ but it'd be better in somewhere like compstate anyway. > The problem is that you end up with too many layers of autoremovable > suffixes. When completing a path name within backticks, you can't > get both the trailing / on a directory name and the trailing backtick. Multiple layers of autoremovable suffixes is clearly one of the things that needs some thought. Possibly all should be added but they would each have separate lists of characters which would result in their removal. Then if a suffix is auto-removed, subsequent suffixes also need removing. When adding matches for completion, it is common (such as with directories in _files or `http://' in _urls that the match only makes up a part of what the function completes (such as `http://' which is clearly only a partical url). So _urls does not add any suffixes it was passed with -S and anything like backquotes should also not be added. The opposite is also simple where a function completes something which can only be the final portion and so any suffixes are added. Auto-removable suffixes are a nice way of handling things which can be final or partial and it can vary as to which is the best assumption hence the need for a better system for defining what it'll do. > } Also, without multios the closing > } bracket of $(<...) should always be completed. > > It would have to be an autoremovable suffix, too; `echo $(<file wc)' is > a silly example of why. I never knew you could do that. Still, ')' as an autoremovable suffix would be better behaviour than the current situation. Oliver _____________________________________________________________________ This message has been checked for all known viruses by the MessageLabs Virus Scanning Service. For further information visit http://www.messagelabs.com/stats.asp ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to complete backquote, etc. using compsys? 2001-08-29 17:31 ` Oliver Kiddle @ 2001-08-29 17:52 ` Bart Schaefer 2001-08-29 21:06 ` Zefram 0 siblings, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2001-08-29 17:52 UTC (permalink / raw) To: zsh-workers On Aug 29, 6:31pm, Oliver Kiddle wrote: } } > } Also, without multios the closing } > } bracket of $(<...) should always be completed. } > } > It would have to be an autoremovable suffix, too; `echo $(<file wc)' is } > a silly example of why. } } I never knew you could do that. Still, ')' as an autoremovable suffix } would be better behaviour than the current situation. The question in this case (and in other cases of multiple suffix layers) is exactly when you remove them. E.g. with a file suffix like '/', it gets removed if you immediately press enter, but in the above case it should not get removed. Also with $(...) or `...`, pressing space after the autoremovable suffix is ambiguous -- more arguments to the command, or the next thing after it? -- whereas with a pathname '/' a space almost always means that you're done with that file name. -- 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to complete backquote, etc. using compsys? 2001-08-29 17:52 ` Bart Schaefer @ 2001-08-29 21:06 ` Zefram 2001-08-30 0:07 ` Bart Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Zefram @ 2001-08-29 21:06 UTC (permalink / raw) To: Bart Schaefer; +Cc: zsh-workers Bart Schaefer wrote: >The question in this case (and in other cases of multiple suffix layers) >is exactly when you remove them. E.g. with a file suffix like '/', it >gets removed if you immediately press enter, but in the above case it >should not get removed. The rule we've used so far is to remove as little as was reasonable to give a special character its customary special meaning. So, for example, after auto-adding "}/" after a parameter name, ":" or "}" would result in removing both characters, "/" or " " would remove just "/", and alphabetic characters wouldn't remove anything. >should not get removed. Also with $(...) or `...`, pressing space after >the autoremovable suffix is ambiguous -- more arguments to the command, >or the next thing after it? This is indeed ambiguous. It raises the question of why we're auto-adding the ")" or "`". To be consistent with our previous practice for removable suffixes, we shouldn't be adding the suffix if it leads to such ambiguity. However, once we've got the suffix there, " " shouldn't be removing it -- it is perfectly reasonable to insert a real space immediately after a closing "`" or ")". We should only be removing the closing character if the next character typed is one that only makes sense as an addition to the command inside the substitution. -zefram ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How to complete backquote, etc. using compsys? 2001-08-29 21:06 ` Zefram @ 2001-08-30 0:07 ` Bart Schaefer 0 siblings, 0 replies; 5+ messages in thread From: Bart Schaefer @ 2001-08-30 0:07 UTC (permalink / raw) To: Zefram; +Cc: zsh-workers On Aug 29, 10:06pm, Zefram wrote: > > >Also with $(...) or `...`, pressing space after > >the autoremovable suffix is ambiguous -- more arguments to the command, > >or the next thing after it? > > This is indeed ambiguous. It raises the question of why we're auto-adding > the ")" or "`". We ARE NOT auto-adding them, but a user complained and *wants* us to add them. The discussion is whether/when/how that's a reasonable thing to do. (The old completion code in 3.0.x apparently adds the closing backtick; the new compsys code in 4.0.x does not.) ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-08-30 0:08 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20010821204255.64C6417403@puel.sfc.wide.ad.jp> [not found] ` <3B84D18C.19BA712@yahoo.co.uk> [not found] ` <1010823180146.ZM25810@candle.brasslantern.com> [not found] ` <3B8B6600.54A33D8E@yahoo.co.uk> 2001-08-28 15:50 ` How to complete backquote, etc. using compsys? Bart Schaefer 2001-08-29 17:31 ` Oliver Kiddle 2001-08-29 17:52 ` Bart Schaefer 2001-08-29 21:06 ` Zefram 2001-08-30 0:07 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).