emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoloads question


From: Stefan Monnier
Subject: Re: autoloads question
Date: Mon, 12 May 2008 10:28:01 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>>>>> "Emanuele" == Emanuele Giaquinta <address@hidden> writes:

> On Mon, May 12, 2008 at 12:42:09PM +0200, Juanma Barranquero wrote:
>> On Mon, May 12, 2008 at 12:09 PM, Emanuele Giaquinta
>> <address@hidden> wrote:
>> 
>> > -;;;;;;  "widget.el" "window.el" "x-dnd.el") (18472 4851 825214))
>> > +;;;;;;  "widget.el" "window.el" "x-dnd.el") (18472 4853 658506))
>> >
>> > Is it expected?
>> 
>> That is a timestamp.

> Ah I see, thanks.
> It is a bit boring because it causes an unneeded rebuild of emacs.

I use the patch below to avoid the problem,


        Stefan


=== modified file 'lisp/emacs-lisp/autoload.el'
--- lisp/emacs-lisp/autoload.el 2008-05-08 09:38:53 +0000
+++ lisp/emacs-lisp/autoload.el 2008-05-09 20:50:57 +0000
@@ -567,7 +657,8 @@
                                 (directory-files (expand-file-name dir)
                                                  t files-re))
                               dirs)))
-         (done ())
+         (done ())                      ;Files processed; to remove duplicates.
+         (changed nil)                  ;Non-nil if some change occured.
         (this-time (current-time))
          ;; Files with no autoload cookies or whose autoloads go to other
          ;; files because of file-local autoload-generated-file settings.
@@ -611,6 +702,7 @@
                   ;; File hasn't changed.
                   nil)
                  (t
+                   (setq changed t)
                    (autoload-remove-section (match-beginning 0))
                    (if (autoload-generate-file-autoloads
                         file (current-buffer) buffer-file-name)
@@ -620,7 +712,8 @@
       ;; Elements remaining in FILES have no existing autoload sections yet.
       (dolist (file files)
         (if (autoload-generate-file-autoloads file nil buffer-file-name)
-            (push file no-autoloads)))
+            (push file no-autoloads)
+          (setq changed t)))
 
       (when no-autoloads
        ;; Sort them for better readability.
@@ -632,7 +725,12 @@
         (current-buffer) nil nil no-autoloads this-time)
        (insert generate-autoload-section-trailer))
 
-      (save-buffer)
+      ;; Don't modify the file if its content has not been changed, so make
+      ;; dependencies don't trigger unnecessarily.  This fails to update the
+      ;; time-stamp of the `no-autoloads' section, so it may cause redundant
+      ;; scans of files in future invocations. I.e. it's a trade-off.
+      (when changed (save-buffer))
+
       ;; In case autoload entries were added to other files because of
       ;; file-local autoload-generated-file settings.
       (autoload-save-buffers))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]