all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Thien-Thi Nguyen <ttn@gnuvola.org>, emacs-devel@gnu.org
Subject: Re: File-specific autoloads
Date: Sat, 07 Jul 2007 00:55:43 -0400	[thread overview]
Message-ID: <jwvmyy8q0ey.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <u1wflcyca.fsf@gnu.org> (Eli Zaretskii's message of "Fri\, 06 Jul 2007 19\:04\:53 +0300")

> 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))))

  parent reply	other threads:[~2007-07-07  4:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-05  0:04 about the byte-opt.el patch Feng Li
2007-07-05 12:54 ` Richard Stallman
2007-07-05 16:19 ` Thien-Thi Nguyen
2007-07-05 17:17   ` Stefan Monnier
2007-07-05 20:46     ` Thien-Thi Nguyen
2007-07-06  9:50       ` Eli Zaretskii
2007-07-06 11:00         ` Thien-Thi Nguyen
2007-07-06 13:03         ` Stefan Monnier
2007-07-06 10:53     ` File-specific autoloads (was: about the byte-opt.el patch) Eli Zaretskii
2007-07-06 14:02       ` File-specific autoloads Thien-Thi Nguyen
2007-07-06 16:04         ` Eli Zaretskii
2007-07-06 18:28           ` Thien-Thi Nguyen
2007-07-07  1:32           ` Stefan Monnier
2007-07-07 10:16             ` Eli Zaretskii
2007-07-07  4:55           ` Stefan Monnier [this message]
2007-07-07 10:43             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmyy8q0ey.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=ttn@gnuvola.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.