zsh-workers
 help / color / mirror / code / Atom feed
* _file in _zmodload: why option -/ ?
@ 2013-10-26  9:25 Jun T.
  2013-10-26 21:37 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Jun T. @ 2013-10-26  9:25 UTC (permalink / raw)
  To: zsh-workers

In Completion/Zsh/Command/_zmodload, line 65,

      _files -W module_path -/g '*.(dll|s[ol]|bundle)(:r)' && ret=0

Why the option -/ is necessary here?
I guess just -g 'pattern' is enough.

I noticed this because 'gmodload <TAB>' completes only directory and no
module files if I use the following style (by Bart Schaefer, see 31638),

zstyle -e ':completion::*' file-patterns \
	'[[ $funcstack[1] = _files && $type = */* ]] && reply=("*(/)")'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _file in _zmodload: why option -/ ?
  2013-10-26  9:25 _file in _zmodload: why option -/ ? Jun T.
@ 2013-10-26 21:37 ` Bart Schaefer
  2013-10-27 16:10   ` Jun T.
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2013-10-26 21:37 UTC (permalink / raw)
  To: zsh-workers

On Oct 26,  6:25pm, Jun T. wrote:
}
} In Completion/Zsh/Command/_zmodload, line 65,
} 
}       _files -W module_path -/g '*.(dll|s[ol]|bundle)(:r)' && ret=0
} 
} Why the option -/ is necessary here?

I'm not entirely sure, but its effect on _files is to cause symlinks
that point to directories to be followed, so I presume it's to force
symlinks in directories that contain modules to be offered alongside
the modules that happen to be in the same directory.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _file in _zmodload: why option -/ ?
  2013-10-26 21:37 ` Bart Schaefer
@ 2013-10-27 16:10   ` Jun T.
  2013-10-27 22:54     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Jun T. @ 2013-10-27 16:10 UTC (permalink / raw)
  To: zsh-workers

2013/10/27 06:37、Bart Schaefer <schaefer@brasslantern.com> wrote:
> I'm not entirely sure, but its effect on _files is to cause symlinks
> that point to directories to be followed, so I presume it's to force
> symlinks in directories that contain modules to be offered alongside
> the modules that happen to be in the same directory.

In _files, there are lines of code (lines 66-69 and 79-82) which seem to be
commented out in 2001; see seq:15995
http://www.zsh.org/mla/workers/2001/msg02656.html
With this old code, if -/ is omitted, then both directories and symlinks to
directories would not be offered.

With the present code, however, I *guess* -/ can be omitted.
But there may be styles and options which could interfere with the option -/
and it may be safer to leave the option as is....

So I tried to modify my zstyle as, for example,

zstyle -e ':completion::*' file-patterns \
  '[[ $funcstack[1] = _files && $type =~ "^[^g]*/[^g]*$" ]] && reply=("*(-/)")'

which seems to solve my problem.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _file in _zmodload: why option -/ ?
  2013-10-27 16:10   ` Jun T.
@ 2013-10-27 22:54     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2013-10-27 22:54 UTC (permalink / raw)
  To: zsh-workers

On Oct 28,  1:10am, Jun T. wrote:
} Subject: Re: _file in _zmodload: why option -/ ?
}
} 2013/10/27 06:370x3001Bart Schaefer <schaefer@brasslantern.com> wrote:
} > I'm not entirely sure, but its effect on _files is to cause symlinks
} > that point to directories to be followed, so I presume it's to force
} > symlinks in directories that contain modules to be offered alongside
} > the modules that happen to be in the same directory.
} 
} In _files, there are lines of code (lines 66-69 and 79-82) which seem to be
} commented out in 2001; see seq:15995
} http://www.zsh.org/mla/workers/2001/msg02656.html
} With this old code, if -/ is omitted, then both directories and symlinks to
} directories would not be offered.

Right.  On closer inspection, the -/ is needed only when one of the styles
file-patterns or list-dirs-first is used; -/ is redundant in the default
case because that test is commented out.

} So I tried to modify my zstyle as, for example,
} 
} zstyle -e ':completion::*' file-patterns \
}   '[[ $funcstack[1] = _files && $type =~ "^[^g]*/[^g]*$" ]] && reply=("*(-/)")'
} 
} which seems to solve my problem.

Of course, you only have this problem because you disagree with the
conclusion reached in workers/15995.  There probably ought to be yet
another zstyle that controls the default use of directories.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-27 22:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-26  9:25 _file in _zmodload: why option -/ ? Jun T.
2013-10-26 21:37 ` Bart Schaefer
2013-10-27 16:10   ` Jun T.
2013-10-27 22:54     ` 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).