unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* autoloads question
@ 2008-05-12 10:09 Emanuele Giaquinta
  2008-05-12 10:42 ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuele Giaquinta @ 2008-05-12 10:09 UTC (permalink / raw)
  To: emacs-devel

Hi,

On trunk regenerating the autoloads file for the same set of files
always yields a different file, i.e. with

cp loaddefs.el{,.old} && make autoloads && diff -u loaddefs.el{.old,}

I always get a difference like

-;;;;;;  "widget.el" "window.el" "x-dnd.el") (18472 4851 825214))
+;;;;;;  "widget.el" "window.el" "x-dnd.el") (18472 4853 658506))

Is it expected?

Thanks,

Emanuele Giaquinta




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: autoloads question
  2008-05-12 10:09 autoloads question Emanuele Giaquinta
@ 2008-05-12 10:42 ` Juanma Barranquero
  2008-05-12 10:52   ` Emanuele Giaquinta
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2008-05-12 10:42 UTC (permalink / raw)
  To: Emanuele Giaquinta; +Cc: emacs-devel

On Mon, May 12, 2008 at 12:09 PM, Emanuele Giaquinta
<emanuele.giaquinta@gmail.com> 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.

 Juanma




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: autoloads question
  2008-05-12 10:42 ` Juanma Barranquero
@ 2008-05-12 10:52   ` Emanuele Giaquinta
  2008-05-12 14:28     ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuele Giaquinta @ 2008-05-12 10:52 UTC (permalink / raw)
  To: emacs-devel

On Mon, May 12, 2008 at 12:42:09PM +0200, Juanma Barranquero wrote:

> On Mon, May 12, 2008 at 12:09 PM, Emanuele Giaquinta
> <emanuele.giaquinta@gmail.com> 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.

Emanuele




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: autoloads question
  2008-05-12 10:52   ` Emanuele Giaquinta
@ 2008-05-12 14:28     ` Stefan Monnier
  2008-05-12 14:59       ` Emanuele Giaquinta
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2008-05-12 14:28 UTC (permalink / raw)
  To: Emanuele Giaquinta; +Cc: emacs-devel

>>>>> "Emanuele" == Emanuele Giaquinta <emanuele.giaquinta@gmail.com> 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
>> <emanuele.giaquinta@gmail.com> 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))))





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: autoloads question
  2008-05-12 14:28     ` Stefan Monnier
@ 2008-05-12 14:59       ` Emanuele Giaquinta
  2008-05-12 16:58         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuele Giaquinta @ 2008-05-12 14:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Mon, May 12, 2008 at 10:28:01AM -0400, Stefan Monnier wrote:

> >>>>> "Emanuele" == Emanuele Giaquinta <emanuele.giaquinta@gmail.com> 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
> >> <emanuele.giaquinta@gmail.com> 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,

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

Wouldn't it be better to save the file mtime and restore it with
set-file-times if changed is nil?

Emanuele




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: autoloads question
  2008-05-12 14:59       ` Emanuele Giaquinta
@ 2008-05-12 16:58         ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2008-05-12 16:58 UTC (permalink / raw)
  To: Emanuele Giaquinta; +Cc: emacs-devel

> Wouldn't it be better to save the file mtime and restore it with
> set-file-times if changed is nil?

Maybe.  But I don't like playing with `mtime'.


        Stefan




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-12 16:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-12 10:09 autoloads question Emanuele Giaquinta
2008-05-12 10:42 ` Juanma Barranquero
2008-05-12 10:52   ` Emanuele Giaquinta
2008-05-12 14:28     ` Stefan Monnier
2008-05-12 14:59       ` Emanuele Giaquinta
2008-05-12 16:58         ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).