zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Compinit tries a filename once
Date: Wed, 27 Jan 2016 16:43:12 +0000	[thread overview]
Message-ID: <20160127164312.029d0cd0@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAKc7PVCe_QEgBKf8Z7FqLkLfuFLTMV4p-V0dfzsPNOpXUw3YNw@mail.gmail.com>

On Wed, 27 Jan 2016 16:51:47 +0100
Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
> If a fpath-added directory say ~/completions will contain empty file
> "_cp", then this will block stock _cp from loading. I was removing
> ~/.zcompdump. Should this work that way?

If fpath is set up that like that, then autoloading the function will in
any case (later on) find that first _cp, which will do nothing.  So it
makes perfect sense for compinit to stop once it's seen it, too.

This is the standard case I'm talking about --- if your system can be
smarter than that about autoloading, somehow, then in that case (but
only that case) it would presumably make sense to enable compinit to be
smarter, too.  Then it needs to be told what logic you're applying to
the autoload process to know what functions it needs to consider,
e.g. by means of a predicate function.

In case I've garbled that, what I mean is:

- [At initialisation] compinit decides <somehow> what functions to
register as a completion function.

- [The first time completion is started in that context] autoload
decides <somehow> how to load the function.

The points I'm trying to make are (i) <somehow> needs to be the same
in both cases for consistency (ii) in normal operation, the autoload
has a very simple, builtin rule for <somehow>, deep down inside the
shell --- grab the first file you see --- so compinit needs to do the
same (iii) if you want to do better, you need to arrange for some
more programmable form of <somehow> to be shared by the two.

Hope that's semi-clear...

pws


  parent reply	other threads:[~2016-01-27 16:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-27 15:51 Sebastian Gniazdowski
2016-01-27 16:21 ` Sebastian Gniazdowski
2016-01-27 16:43 ` Peter Stephenson [this message]
2016-01-27 23:00   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160127164312.029d0cd0@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).