zsh-workers
 help / color / mirror / code / Atom feed
* compinit dumps too many files for autoloading
@ 2004-10-04 11:36 Peter Stephenson
  2004-10-04 16:10 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2004-10-04 11:36 UTC (permalink / raw)
  To: Zsh hackers list

If I am using a complicate completion such as _perforce which defines
its own functions, then run compinit again, all those functions are
marked for autoloading in .zcompdump.  This is problematic because the
functions in question are tested thus in _perforce (_cvs works
similarly):

(( $+functions[_perforce_filetypes] )) ||
_perforce_filetypes() {
 ...
}

When _perforce is loaded, the test sees that the function is already
marked for autoloading and doesn't define it.

It's not very serious since compinit isn't usually run again.  I'm not
sure what the fix is.  However, it's not clear to me compinit should be
marking files for autoload unless it found them by searching $fpath.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


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

* Re: compinit dumps too many files for autoloading
  2004-10-04 11:36 compinit dumps too many files for autoloading Peter Stephenson
@ 2004-10-04 16:10 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2004-10-04 16:10 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Mon, 4 Oct 2004, Peter Stephenson wrote:

> If I am using a complicate completion such as _perforce which defines
> its own functions, then run compinit again, all those functions are
> marked for autoloading in .zcompdump.

The patch below "fixes" it, but that cross-product null-glob causes a 
noticeable delay on my limping old 233MHz home system.

While we're on the subject, does anyone remember why the tilde (~) appears
in the following expansion of fpath in compdump (line 26 in my copy)?

_d_files=( ${^~fpath:/.}/^([^_]*|*~|*.zwc)(N) )

I can't come up with a reason you'd want patterns in fpath globbed there.
Same thing a few lines lower for _d_wfiles.

Here's the patch.  It just occurred to me that this breaks if some .zwc
files contain the function definitions but the original function files
are missing, so I'm not going to commit it just yet.

Index: Completion/compdump
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/compdump,v
retrieving revision 1.5
diff -c -r1.5 compdump
--- Completion/compdump	22 Jun 2004 07:53:03 -0000	1.5
+++ Completion/compdump	4 Oct 2004 15:57:05 -0000
@@ -103,7 +103,9 @@
 
 # Autoloads: look for all functions beginning with `_'.
 
-_d_als=(${(o)$(typeset +fm '_*')})
+_d_als=( $(typeset +fm '_*') )
+_d_als=( ${^fpath}/${^_d_als}(N) )
+_d_als=( ${(ou)_d_als:t} )
 
 # print them out:  about five to a line looks neat
 


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

end of thread, other threads:[~2004-10-04 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-04 11:36 compinit dumps too many files for autoloading Peter Stephenson
2004-10-04 16:10 ` 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).