Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: z(re)compile and deleted files



Andrej Borsenkow wrote:

> Once again - there is currently no easy way to remove defenition of
> deleted function from wordcode file. I'm using zrecompile -p as
> suggested - and just now I deleted _bunzip2, run zrecompile (with small
> wrapper) - and of course, _bunzip2 remained in wordcode file.
> 
> my function is:
> 
> #!/tools/bin/zsh -f
> autoload -U zrecompile
> zrecompile -p -- ~/.zsh.d/std-$ZSH_VERSION.zwc
> /tools/share/zsh/$ZSH_VERSION/functions/*/*(^/)
> 
> and when I run it nothing happens at all.

Uh oh. Yes. Forgot that.

This will make it recompile the zwc file if the number of files in it
is different from the number of files that should go in it.

> BTW completion for zcompile does not list -t option (at least).

Eh? From builtins.yo:

The third form, with the tt(-t) option, examines an existing
compiled file.  Without further arguments, the names of the original
files compiled into it are listed.  The first line of output tells
the version of the shell which compiled the file and how the file
will be used (mapping or reading the file).  With arguments, nothing
is output and the return value is set to zero if em(all) var(name)s
name files contained in the wordcode file, and non-zero if at least
one var(name) is not contained in it.

The itemised list contains only `other options'.

Bye
 Sven `it wasn't me, Bart wrote that ;-)' W.

Index: Functions/Misc/zrecompile
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Misc/zrecompile,v
retrieving revision 1.3
diff -u -r1.3 zrecompile
--- Functions/Misc/zrecompile	2000/04/20 12:45:21	1.3
+++ Functions/Misc/zrecompile	2000/05/02 11:28:09
@@ -53,7 +53,7 @@
 fi
 
 if [[ -n $pats ]]; then
-  local end
+  local end num
 
   while (( $# )); do
     end=$argv[(i)--]
@@ -84,13 +84,18 @@
     (( $#files )) || files=( ${zwc%.zwc} )
 
     if [[ -f $zwc ]]; then
-      re=
-      for file in $files; do
-        if [[ $file -nt $zwc ]]; then
-          re=yes
-	  break
-        fi
-      done
+      num=$(zcompile -t $zwc | wc -l)
+      if [[ num-1 -ne $#files ]]; then
+        re=yes
+      else
+        re=
+        for file in $files; do
+          if [[ $file -nt $zwc ]]; then
+            re=yes
+	    break
+          fi
+        done
+      fi
     else
       re=yes
     fi

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author