Subject: [PATCH] compdump: only autoload functions in fpath
From: Eric Cook <[email-masked]>
To: [email-masked]
Date: Thu, 26 May 2016 10:17:23 -0400
List-Id: Zsh Workers List <zsh-workers.zsh.org>

When a user uses compdump after helper functions by completers are
defined. compdump will mark those functions for autoloading also.

This was noticed by a user who calls compinit multiple times, atleast once
after .zcompdump was deleted during the session then attempting to use
_vim.

You can reproduce the issue with:
1. vim <tab>
2. rm -f ~/.zcompdump; compinit # compdump executes during this
3. zsh
4. vim <tab>

Since compdump() does have a small mention in zshcompsys(1) about possibly
using it without compinit [1], it should probably be fixed.

[1] which should only be used once.
---
 Completion/compdump | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Completion/compdump b/Completion/compdump
index 068383c..619e39e 100644
--- a/Completion/compdump
+++ b/Completion/compdump
@@ -101,9 +101,9 @@ bindkey |
 print >> $_d_file

-# Autoloads: look for all functions beginning with `_'.
+# Autoloads: look for all functions in fpath beginning with `_'.
 
-_d_als=(${(o)$(typeset +fm '_*')})
+_d_als=($^fpath/(${(o~j.|.)$(typeset +fm '_*')})(N:t))
 
 # print them out:  about five to a line looks neat
 
-- 
2.6.6