From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: File-specific autoloads Date: Sat, 07 Jul 2007 00:55:43 -0400 Message-ID: References: <87hcoilt68.fsf@ambire.localdomain> <87zm29eijw.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1183784163 5597 80.91.229.12 (7 Jul 2007 04:56:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 7 Jul 2007 04:56:03 +0000 (UTC) Cc: Thien-Thi Nguyen , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 07 06:56:01 2007 connect(): Connection refused Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I72Kq-0002gv-A2 for ged-emacs-devel@m.gmane.org; Sat, 07 Jul 2007 06:55:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I72Kp-0005EW-ET for ged-emacs-devel@m.gmane.org; Sat, 07 Jul 2007 00:55:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I72Kk-0005ER-RN for emacs-devel@gnu.org; Sat, 07 Jul 2007 00:55:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I72Ki-0005EF-5K for emacs-devel@gnu.org; Sat, 07 Jul 2007 00:55:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I72Kh-0005EC-WA for emacs-devel@gnu.org; Sat, 07 Jul 2007 00:55:48 -0400 Original-Received: from tomts5.bellnexxia.net ([209.226.175.25] helo=tomts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I72Kg-00061e-7m; Sat, 07 Jul 2007 00:55:46 -0400 Original-Received: from ceviche.home ([74.12.208.200]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070707045544.ERMB25465.tomts5-srv.bellnexxia.net@ceviche.home>; Sat, 7 Jul 2007 00:55:44 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 13B58B411F; Sat, 7 Jul 2007 00:55:43 -0400 (EDT) In-Reply-To: (Eli Zaretskii's message of "Fri\, 06 Jul 2007 19\:04\:53 +0300") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:74425 Archived-At: > So I think this change in its current incarnation is for the worse. > Maybe if the autoloads were written into files that are not in CVS I'd > be happier. I believe the patch below which I've just installed will fix those problems by using MD5 checkums rather than file time-stamps in ps-print.el's autoloads. Stefan --- autoload.el 26 jun 2007 15:44:58 -0400 1.126 +++ autoload.el 07 jui 2007 00:48:13 -0400 @@ -409,6 +409,9 @@ (forward-line 1)))))) (when output-start + (let ((secondary-autoloads-file-buf + (if (local-variable-p 'generated-autoload-file) + (current-buffer)))) (with-current-buffer outbuf (save-excursion ;; Insert the section-header line which lists the file name @@ -416,9 +419,23 @@ (goto-char output-start) (autoload-insert-section-header outbuf autoloads-done load-name relfile - (nth 5 (file-attributes relfile))) + (if secondary-autoloads-file-buf + ;; MD5 checksums are much better because they do not + ;; change unless the file changes (so they'll be + ;; equal on two different systems and will change + ;; less often than time-stamps, thus leading to fewer + ;; unneeded changes causing spurious conflicts), but + ;; using time-stamps is a very useful optimization, + ;; so we use time-stamps for the main autoloads file + ;; (loaddefs.el) where we have special ways to + ;; circumvent the "random change problem", and MD5 + ;; checksum in secondary autoload files where we do + ;; not need the time-stamp optimization because it is + ;; already provided by the primary autoloads file. + (md5 secondary-autoloads-file-buf nil nil 'emacs-mule) + (nth 5 (file-attributes relfile)))) (insert ";;; Generated autoloads from " relfile "\n")) - (insert generate-autoload-section-trailer))) + (insert generate-autoload-section-trailer)))) (message "Generating autoloads for %s...done" file)) (or visited ;; We created this buffer, so we should kill it. @@ -454,13 +471,11 @@ FILE is the file name of the current buffer. Returns a buffer whose point is placed at the requested location. Returns nil if the file's autoloads are uptodate, otherwise -removes any prior now out-of-date autoload entries. -The current buffer only matters if it is visiting a file or if it has a buffer-local -value for some variables such as `generated-autoload-file', so it's OK -to call it from a dummy buffer if FILE is not currently visited." +removes any prior now out-of-date autoload entries." (catch 'up-to-date - (let ((load-name (autoload-file-load-name file)) - (existing-buffer (if buffer-file-name (current-buffer))) + (let* ((load-name (autoload-file-load-name file)) + (buf (current-buffer)) + (existing-buffer (if buffer-file-name buf)) (found nil)) (with-current-buffer ;; We must read/write the file without any code conversion, @@ -489,8 +504,16 @@ (file-time (nth 5 (file-attributes file)))) (if (and (or (null existing-buffer) (not (buffer-modified-p existing-buffer))) - (listp last-time) (= (length last-time) 2) + (or + ;; last-time is the time-stamp (specifying + ;; the last time we looked at the file) and + ;; the file hasn't been changed since. + (and (listp last-time) (= (length last-time) 2) (not (time-less-p last-time file-time))) + ;; last-time is an MD5 checksum instead. + (and (stringp last-time) + (equal last-time + (md5 buf nil nil 'emacs-mule))))) (throw 'up-to-date nil) (autoload-remove-section begin) (setq found t))))