From xemacs-m  Sat Mar  1 20:06:14 1997
Received: from mailbox1.ucsd.edu (mailbox1.ucsd.edu [132.239.1.53])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id UAA22957
	for <xemacs-beta@xemacs.org>; Sat, 1 Mar 1997 20:06:13 -0600 (CST)
Received: from sdnp5.ucsd.edu (sdnp5.ucsd.edu [132.239.79.10]) by mailbox1.ucsd.edu (8.8.5/8.6.9) with SMTP id SAA10847; Sat, 1 Mar 1997 18:06:14 -0800 (PST)
Received: by sdnp5.ucsd.edu (SMI-8.6/SMI-SVR4)
	id SAA18035; Sat, 1 Mar 1997 18:08:32 -0800
Sender: dmoore@sdnp5.ucsd.edu
To: Kyle Jones <kyle_jones@wonderworks.com>
Cc: xemacs-beta@xemacs.org
Subject: Re: update-elc question
References: <E0w06AM-0007J9-00@chekov.ctd.comsat.com> 	<m2rai2uluv.fsf@altair.xemacs.org> 	<rvrai2dqj0.fsf@sdnp5.ucsd.edu> 	<199703010426.UAA01531@xemacs.eng.sun.com> 	<m267zcyyy5.fsf@altair.xemacs.org> 	<rv3eufe8pq.fsf@sdnp5.ucsd.edu> 	<m2u3mvjmkz.fsf@altair.xemacs.org> <QQcfav18951.199703012223@crystal.WonderWorks.COM>
X-Face: "oX;zS#-JU$-,WKSzG.1gGE]x^cIg!hW.dq>.f6pzS^A+(k!T|M:}5{_%>Io<>L&{hO7W4cicOQ|>/lZ1G(m%7iaCf,6Qgk0%%Bz7b2-W3jd0m_UG\Y;?]}4s0O-U)uox>P3JN)9cm]O\@,vy2e{`3pb!"pqmRy3peB90*2L
Mail-Copies-To: never
From: David Moore <dmoore@ucsd.edu>
Date: 01 Mar 1997 18:08:31 -0800
In-Reply-To: Kyle Jones's message of Sat, 1 Mar 1997 17:23:30 -0500 (EST)
Message-ID: <rv209zdp0g.fsf@sdnp5.ucsd.edu>
Lines: 56
X-Mailer: Gnus v5.4.8/XEmacs 19.15

Kyle Jones <kyle_jones@wonderworks.com> writes:

> Steven L Baur writes:
>  > David Moore writes:
>  > 
>  > > 	No, and neither is find -newer.  Kyle just asked the same
>  > > question I was thinking, ``Why can't this be done in lisp?''
>  > 
>  > $ cd /where/you/keep/XEmacs/lisp/efs
>  > $ ../../src/xemacs -batch -q -f batch-byte-compile *.el
>  > 
>  > This must be the reason why we only byte compile a handful of files at
>  > a time. :-(
> 
> I think I've missed the point of your comment.

	Hmm, I was thinking of just removing the outdated .elc's, not
trying to do a full recompile everytime.

	Something that just does a recurse down the lisp tree, and if
foo.el is newer than foo.elc, removes foo.elc.

Something like this untested code.

(defun remove-old-elc-1 (dir &optional seen)
  (setq dir (file-name-as-directory dir))
  ;; Only scan this sub-tree if we haven't been here yet.
  (unless (member (file-truename dir) seen)
    (push (file-truename dir) seen)
    ;; We descend recursively
    (let ((dirs (directory-files dir t nil t))
          dir)
      (while (setq dir (pop dirs))
        (when (and (not (member (file-name-nondirectory dir) '("." "..")))
                   (file-directory-p dir))
          (nnml-generate-nov-databases-1 dir seen))))
    ;; Do this directory.
    (let ((files (directory-files dir t ".el$"))
	  file file-c)
      (while (setq file (car files))
	(setq files (cdr files))
	(setq file-c (concat file "c"))
	(when (and (file-exists-p file-c)
		   (file-newer-than-file-p file file-c))
	  (delete-file file-c))))))

(defun remove-old-elc ()
  (remove-old-elc-1 "lisp"))



-- 
David Moore <dmoore@ucsd.edu>       | Computer Systems Lab      __o
UCSD Dept. Computer Science - 0114  | Work: (619) 534-8604    _ \<,_
La Jolla, CA 92093-0114             | Fax:  (619) 534-1445   (_)/ (_)
<URL:http://oj.egbt.org/dmoore/>    | In a cloud bones of steel.

