zsh-users
 help / color / mirror / code / Atom feed
* Where do these completions come from?
@ 2021-10-15 18:40 Dominik Vogt
  2021-10-15 18:46 ` Roman Perepelitsa
  0 siblings, 1 reply; 9+ messages in thread
From: Dominik Vogt @ 2021-10-15 18:40 UTC (permalink / raw)
  To: Zsh Users

I accidentally hit "d<tab>" and a list of things got displayed
(menu completion), including

  dis_aliases
  dis_builtins
  dis_functions
  dis_functions_source
  dis_galiases
  dis_patchars

"which" doesn't know where these come from; no functions, aliases
or executables.

Questions:

 * Why are these things completed (by expand-or-complete)?
 * How can non-executable strings be excluded from expansion.
 * Where does this stuff come from?  (Only of minor interest)

(zsh-5.7.1).

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


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

* Re: Where do these completions come from?
  2021-10-15 18:40 Where do these completions come from? Dominik Vogt
@ 2021-10-15 18:46 ` Roman Perepelitsa
  2021-10-15 18:56   ` Dominik Vogt
  0 siblings, 1 reply; 9+ messages in thread
From: Roman Perepelitsa @ 2021-10-15 18:46 UTC (permalink / raw)
  To: dominik.vogt, Zsh Users

On Fri, Oct 15, 2021 at 8:43 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> I accidentally hit "d<tab>" and a list of things got displayed
> (menu completion), including
>
>   dis_aliases
>   dis_builtins
>   dis_functions
>   dis_functions_source
>   dis_galiases
>   dis_patchars

These are parameters. They come from the zsh/parameter module. See
`man zshmodules`.

Roman.


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

* Re: Where do these completions come from?
  2021-10-15 18:46 ` Roman Perepelitsa
@ 2021-10-15 18:56   ` Dominik Vogt
  2021-10-15 19:13     ` Roman Perepelitsa
  0 siblings, 1 reply; 9+ messages in thread
From: Dominik Vogt @ 2021-10-15 18:56 UTC (permalink / raw)
  To: Zsh Users

On Fri, Oct 15, 2021 at 08:46:27PM +0200, Roman Perepelitsa wrote:
> On Fri, Oct 15, 2021 at 8:43 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> >
> > I accidentally hit "d<tab>" and a list of things got displayed
> > (menu completion), including
> >
> >   dis_aliases
> >   dis_builtins
> >   dis_functions
> >   dis_functions_source
> >   dis_galiases
> >   dis_patchars
>
> These are parameters. They come from the zsh/parameter module. See
> `man zshmodules`.

Okay, understood.  But why is it useful to expand hashtable names
in command position?

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


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

* Re: Where do these completions come from?
  2021-10-15 18:56   ` Dominik Vogt
@ 2021-10-15 19:13     ` Roman Perepelitsa
  2021-10-15 20:10       ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Roman Perepelitsa @ 2021-10-15 19:13 UTC (permalink / raw)
  To: dominik.vogt, Zsh Users

On Fri, Oct 15, 2021 at 8:59 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> On Fri, Oct 15, 2021 at 08:46:27PM +0200, Roman Perepelitsa wrote:
> > On Fri, Oct 15, 2021 at 8:43 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> > >
> > > I accidentally hit "d<tab>" and a list of things got displayed
> > > (menu completion), including
> > >
> > >   dis_aliases
> > >   dis_builtins
> > >   dis_functions
> > >   dis_functions_source
> > >   dis_galiases
> > >   dis_patchars
> >
> > These are parameters. They come from the zsh/parameter module. See
> > `man zshmodules`.
>
> Okay, understood.  But why is it useful to expand hashtable names
> in command position?

I don't think it's useful. You can disable it:

  zstyle ':completion:*:complete:-command-:*:*' tag-order \
      'commands functions' -

I don't know why the default is what it is. I don't expect zsh
defaults to make sense. Why is interactive_comments disabled in
interactive shells? Why does prompt show hostname but not the current
directory? It's all for historical reasons, I guess. I do appreciate
that my shell doesn't break when I upgrade to a newer version of zsh,
so backward compatibility is a valid justification for all this.

Roman.


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

* Re: Where do these completions come from?
  2021-10-15 19:13     ` Roman Perepelitsa
@ 2021-10-15 20:10       ` Bart Schaefer
  2021-10-15 20:26         ` Dominik Vogt
  0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2021-10-15 20:10 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: dominik.vogt, Zsh Users

On Fri, Oct 15, 2021 at 12:13 PM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> > Okay, understood.  But why is it useful to expand hashtable names
> > in command position?
>
> I don't think it's useful.

It's not "expanding" hashtable names, it's completing parameter names
because you might want to assign to them.  Having

% PA<tab>
% PATH=

would be a better example.  You don't get the "=" when there are
multiple possibilities.

> I don't know why the default is what it is. I don't expect zsh
> defaults to make sense. Why is interactive_comments disabled in
> interactive shells?

Because csh didn't have interactive comments, and zsh was designed to
help college students using BSD unixen migrate from default csh to a
bourne-like shell.

> Why does prompt show hostname but not the current
> directory?

There originally wasn't a prompt escape for directory, IIRC ... and
we're back to historical usage where users were on time-shared
machinery and might need to know.

> It's all for historical reasons, I guess.

Yep, in a lot of cases dating back to how universities in the USA in
the 1990s tended to configure their servers/users.


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

* Re: Where do these completions come from?
  2021-10-15 20:10       ` Bart Schaefer
@ 2021-10-15 20:26         ` Dominik Vogt
  2021-10-16 18:59           ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Dominik Vogt @ 2021-10-15 20:26 UTC (permalink / raw)
  To: Zsh Users

On Fri, Oct 15, 2021 at 01:10:27PM -0700, Bart Schaefer wrote:
> On Fri, Oct 15, 2021 at 12:13 PM Roman Perepelitsa
> <roman.perepelitsa@gmail.com> wrote:
> >
> > > Okay, understood.  But why is it useful to expand hashtable names
> > > in command position?
> >
> > I don't think it's useful.
>
> It's not "expanding" hashtable names, it's completing parameter names
> because you might want to assign to them.  Having
>
> % PA<tab>
> % PATH=
>
> would be a better example.  You don't get the "=" when there are
> multiple possibilities.

Hm, it *is* somewhat confusing to be offered zsh internal
parameter names that come from a module that was loaded as a
dependency of zsh/complist (which is the olny module I use).

Is there a way to tell zsh only to complete parameter names that
are actually in the environment and not zsh internal ones?

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


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

* Re: Where do these completions come from?
  2021-10-15 20:26         ` Dominik Vogt
@ 2021-10-16 18:59           ` Bart Schaefer
  2021-10-16 21:30             ` Dominik Vogt
  0 siblings, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2021-10-16 18:59 UTC (permalink / raw)
  To: dominik.vogt, Zsh Users

On Fri, Oct 15, 2021 at 1:29 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> Is there a way to tell zsh only to complete parameter names that
> are actually in the environment and not zsh internal ones?

It ought to be possible with the tag-order style and examination of
the keys/values in the $parameters special hash, but I don't have time
to work out the details just now.


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

* Re: Where do these completions come from?
  2021-10-16 18:59           ` Bart Schaefer
@ 2021-10-16 21:30             ` Dominik Vogt
  2021-10-17 19:00               ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Dominik Vogt @ 2021-10-16 21:30 UTC (permalink / raw)
  To: Zsh Users

On Sat, Oct 16, 2021 at 11:59:34AM -0700, Bart Schaefer wrote:
> On Fri, Oct 15, 2021 at 1:29 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> >
> > Is there a way to tell zsh only to complete parameter names that
> > are actually in the environment and not zsh internal ones?
>
> It ought to be possible with the tag-order style and examination of
> the keys/values in the $parameters special hash, but I don't have time
> to work out the details just now.

'k.  Please don't waste time on this, it's not important.

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt


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

* Re: Where do these completions come from?
  2021-10-16 21:30             ` Dominik Vogt
@ 2021-10-17 19:00               ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2021-10-17 19:00 UTC (permalink / raw)
  To: dominik.vogt, Zsh Users

On Sat, Oct 16, 2021 at 2:33 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
>
> On Sat, Oct 16, 2021 at 11:59:34AM -0700, Bart Schaefer wrote:
> > On Fri, Oct 15, 2021 at 1:29 PM Dominik Vogt <dominik.vogt@gmx.de> wrote:
> > >
> > > Is there a way to tell zsh only to complete parameter names that
> > > are actually in the environment and not zsh internal ones?
> >
> > It ought to be possible with the tag-order style and examination of
> > the keys/values in the $parameters special hash
>
> 'k.  Please don't waste time on this, it's not important.

Actually the tag-order part is the hard bit and probably overkill
anyway.  This should be enough:

zstyle -e :completion::complete:-command-::parameters \
  ignored-patterns 'reply=(${(k)parameters[(R)*(hidden|undefined)*])'


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

end of thread, other threads:[~2021-10-17 19:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 18:40 Where do these completions come from? Dominik Vogt
2021-10-15 18:46 ` Roman Perepelitsa
2021-10-15 18:56   ` Dominik Vogt
2021-10-15 19:13     ` Roman Perepelitsa
2021-10-15 20:10       ` Bart Schaefer
2021-10-15 20:26         ` Dominik Vogt
2021-10-16 18:59           ` Bart Schaefer
2021-10-16 21:30             ` Dominik Vogt
2021-10-17 19:00               ` 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).