* path completion and directories @ 2001-10-05 6:03 Borsenkow Andrej 2001-10-08 15:51 ` Oliver Kiddle 0 siblings, 1 reply; 6+ messages in thread From: Borsenkow Andrej @ 2001-10-05 6:03 UTC (permalink / raw) To: ZSH Workers Mailing List Yesterday I was irritated again that rpm completion does not descend directories if it finds any *.rpm file. Before I had this issue with gunzip as well. I know I can configure it. My point is it should be default. Current behavior looks counter-intuitive to me. Actually I have a feeling it was differently before. -andrej ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: path completion and directories 2001-10-05 6:03 path completion and directories Borsenkow Andrej @ 2001-10-08 15:51 ` Oliver Kiddle 2001-10-09 9:05 ` Sven Wischnowsky 0 siblings, 1 reply; 6+ messages in thread From: Oliver Kiddle @ 2001-10-08 15:51 UTC (permalink / raw) To: ZSH Workers Mailing List On Friday, Borsenkow Andrej wrote: > > Yesterday I was irritated again that rpm completion does not descend > directories if it finds any *.rpm file. Before I had this issue with > gunzip as well. > > I know I can configure it. My point is it should be default. Current > behavior looks counter-intuitive to me. Actually I have a feeling it was > differently before. It is certainly the most sensible behaviour so I agree that making it default would be better. How do we go about making styles like tag-order and file-patterns default though while making them easy to disable? Didn't we used to have a bunch of styles set by default from compinit? I still have `zstyle -d' in my .zshrc which was there to remove them. 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] 6+ messages in thread
* Re: path completion and directories 2001-10-08 15:51 ` Oliver Kiddle @ 2001-10-09 9:05 ` Sven Wischnowsky 2001-10-09 9:22 ` Peter Stephenson 0 siblings, 1 reply; 6+ messages in thread From: Sven Wischnowsky @ 2001-10-09 9:05 UTC (permalink / raw) To: zsh-workers Oliver Kiddle wrote: > On Friday, Borsenkow Andrej wrote: > > > > Yesterday I was irritated again that rpm completion does not descend > > directories if it finds any *.rpm file. Before I had this issue with > > gunzip as well. > > > > I know I can configure it. My point is it should be default. Current > > behavior looks counter-intuitive to me. Actually I have a feeling it was > > differently before. > > It is certainly the most sensible behaviour so I agree that making it > default would be better. Aha. What do others think? Leave it? Change it? No opinion? It shouldn't be too hard to change (the changes in the manual and Peter's guide would be larger than in the code, I think). > How do we go about making styles like tag-order and file-patterns > default though while making them easy to disable? > > Didn't we used to have a bunch of styles set by default from compinit? I > still have `zstyle -d' in my .zshrc which was there to remove them. Yes we had. Very ugly. Nowadays the defaults are coded into the places where the styles are looked up, one way or another (e.g. by using -t or -T or by doing `zstyle -s ... foo || foo=...'). Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: path completion and directories 2001-10-09 9:05 ` Sven Wischnowsky @ 2001-10-09 9:22 ` Peter Stephenson 2001-10-09 12:44 ` Sven Wischnowsky 0 siblings, 1 reply; 6+ messages in thread From: Peter Stephenson @ 2001-10-09 9:22 UTC (permalink / raw) To: zsh-workers Sven Wischnowsky wrote: > Oliver Kiddle wrote: > > On Friday, Borsenkow Andrej wrote: > > > > > > Yesterday I was irritated again that rpm completion does not descend > > > directories if it finds any *.rpm file. Before I had this issue with > > > gunzip as well. > > > > > > I know I can configure it. My point is it should be default. Current > > > behavior looks counter-intuitive to me. Actually I have a feeling it was > > > differently before. > > > > It is certainly the most sensible behaviour so I agree that making it > > default would be better. > > Aha. What do others think? Leave it? Change it? No opinion? I tend to think mixing in directories should be the default. It can be a little confusing otherwise if you aren't familiar with the system. By the way, you do know about the _next_tags widget? If you bind it, you can use that key for swapping between files and directories. I don't know if it will still allow you switch to globbed files, then directories if the default changes, but that would be useful. -- Peter Stephenson <pws@csr.com> Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ********************************************************************** ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: path completion and directories 2001-10-09 9:22 ` Peter Stephenson @ 2001-10-09 12:44 ` Sven Wischnowsky 2001-10-09 13:01 ` Peter Stephenson 0 siblings, 1 reply; 6+ messages in thread From: Sven Wischnowsky @ 2001-10-09 12:44 UTC (permalink / raw) To: zsh-workers Peter Stephenson wrote: > ... > > I tend to think mixing in directories should be the default. It can be a > little confusing otherwise if you aren't familiar with the system. Ok, then, here's the patch. > By the way, you do know about the _next_tags widget? If you bind it, you > can use that key for swapping between files and directories. I don't know > if it will still allow you switch to globbed files, then directories if the > default changes, but that would be useful. This is easy to achieve, so easy that I've prepared it in the patch (see the lines starting with `###'). This is still commented out because I'm not sure about the order in which pattern (-combinations) should be tried. The two things that look sensible to me are: globbed and dirs all only globbed only dirs Or maybe: globbed and dirs only globbed only dirs all So which order do you prefer? (Not only Peter is asked and not only the two versions above are on offer, of course.) Bye Sven Index: Completion/Unix/Type/_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_files,v retrieving revision 1.4 diff -u -r1.4 _files --- Completion/Unix/Type/_files 2001/07/13 08:09:52 1.4 +++ Completion/Unix/Type/_files 2001/10/09 12:41:30 @@ -37,12 +37,25 @@ done else if [[ "$type" = *g* ]]; then - if [[ "$type" = */* ]]; then - pats=( " ${glob//:/\\:}:globbed-files *(-/):directories" '*:all-files ' ) - else - pats=( " ${glob//:/\\:}:globbed-files " - '*(-/):directories ' '*:all-files ' ) - fi + + # People prefer to have directories shown on first try as default. + # Even if the calling function didn't use -/. + # + # if [[ "$type" = */* ]]; then + + pats=( " ${glob//:/\\:}:globbed-files *(-/):directories" '*:all-files ' + + ### We could allow _next_tags to offer only globbed-files or directories + ### by adding: + ### " ${glob//:/\\:}:only-globbed-files " ' *(-/):only-directories ' + + ) + + # else + # pats=( " ${glob//:/\\:}:globbed-files " + # '*(-/):directories ' '*:all-files ' ) + # fi + elif [[ "$type" = */* ]]; then pats=( '*(-/):directories ' '*:all-files ' ) else @@ -53,15 +66,16 @@ tried=() for def in "$pats[@]"; do eval "def=( ${${def:gs/\\:/\\\\\\\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )" + + tmp="${(@M)def#*[^\\]:}" + (( $tried[(I)${(q)tmp}] )) && continue + tried=( "$tried[@]" "$tmp" ) + for sdef in "$def[@]"; do tag="${${sdef#*[^\\]:}%%:*}" pat="${${sdef%%:${tag}*}//\\:/:}" - (( $tried[(I)${(q)pat}] )) && continue - - tried=( "$tried[@]" "$pat" ) - if [[ "$sdef" = *:${tag}:* ]]; then descr="${(Q)sdef#*:${tag}:}" else @@ -86,7 +100,13 @@ done (( ret )) || break done + + ### For that _next_tags change mentioned above we would have to + ### comment out the following line. (Or not, depending on the order + ### of the patterns.) + [[ "$pat" = '*' ]] && return ret + done (( ret )) || return 0 done Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.135 diff -u -r1.135 compsys.yo --- Doc/Zsh/compsys.yo 2001/10/05 11:18:37 1.135 +++ Doc/Zsh/compsys.yo 2001/10/09 12:41:31 @@ -1111,10 +1111,12 @@ item(tt(file-patterns))( In most places where filenames are completed, the function tt(_files) is used which can be configured with this style. If the style is -unset, tt(_files) offers, one after another, up to three tags: +unset, tt(_files) offers, up to three tags: `tt(globbed-files)', `tt(directories)' and `tt(all-files)', depending on the types of files -expected by the caller of tt(_files). +expected by the caller of tt(_files). The first two +(`tt(globbed-files)' and `tt(directories)') are normally offered +together to make it easier to complete files in sub-directories. If the tt(file-patterns) style is set, the default tags are not used. Instead, the value of the style says which tags and which @@ -1149,15 +1151,15 @@ example(zstyle ':completion:*:*:rm:*' file-patterns \ '*.o:object-files' '%p:all-files') -Another interesting example is to change the default behaviour that -makes completion first offer files matching the patterns given by the -calling function, then directories and then all files. Many people -prefer to get both the files matching the given patterns and the -directories in the first try and all files at the second try. To -achieve this, one could do: +Another interesting example is to change the default behaviour in a +way that makes completion first offer files matching the patterns +given by the calling function, then directories and then all files. +Some people prefer this over getting both the files matching the given +patterns and the directories in the first try and all files at the +second try. To achieve this, one could do: example(zstyle ':completion:*' file-patterns \ - '%p:globbed-files *(-/):directories' '*:all-files') + '%p:globbed-files' '*(-/):directories' '*:all-files') This works even for contexts in which all files would be completed, because tt(_files) will not try a pattern more than once and it stops -- Sven Wischnowsky wischnow@informatik.hu-berlin.de ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: path completion and directories 2001-10-09 12:44 ` Sven Wischnowsky @ 2001-10-09 13:01 ` Peter Stephenson 0 siblings, 0 replies; 6+ messages in thread From: Peter Stephenson @ 2001-10-09 13:01 UTC (permalink / raw) To: Zsh hackers list Sven Wischnowsky wrote: > The two things that look sensible to me are: > > globbed and dirs > all > only globbed > only dirs > > Or maybe: > > globbed and dirs > only globbed > only dirs > all I suppose the first is probably more useful. The times when you want to narrow your search window are less than the ones when you want to widen it. I suspect the number of people using this feature is likely to be small, though. As far as I can see, _next_tags is about the only use of this, since the globbed files and directories have in both cases already been tested when we get to all files, so the difference is invisible for producing the initial completion list. -- Peter Stephenson <pws@csr.com> Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ********************************************************************** ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2001-10-09 13:02 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-10-05 6:03 path completion and directories Borsenkow Andrej 2001-10-08 15:51 ` Oliver Kiddle 2001-10-09 9:05 ` Sven Wischnowsky 2001-10-09 9:22 ` Peter Stephenson 2001-10-09 12:44 ` Sven Wischnowsky 2001-10-09 13:01 ` Peter Stephenson
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).