aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-07-07 04:56:00 +0000
committerStefan Monnier2007-07-07 04:56:00 +0000
commit0b7750a95dffb8cb8095a5c9ca4e9df1cf7acd54 (patch)
tree99ff331ed74d2d2a49eaaa5291dfd0836c375538
parente90988a097746c0bbef5b690d94da6541699485a (diff)
downloademacs-0b7750a95dffb8cb8095a5c9ca4e9df1cf7acd54.tar.gz
emacs-0b7750a95dffb8cb8095a5c9ca4e9df1cf7acd54.zip
(autoload-find-destination): Understand a new format of autoload block where
the file's time-stamp is replaced by its MD5 checksum. (autoload-generate-file-autoloads): Use MD5 checksum instead of time-stamp for secondary autoloads files. (update-directory-autoloads): Remove duplicate entries. Use time-less-p for time-stamps, as done in autoload-find-destination.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/emacs-lisp/autoload.el68
2 files changed, 57 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4aedca28f86..cb79ea47bb2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12007-07-07 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/autoload.el (autoload-find-destination): Understand a new
4 format of autoload block where the file's time-stamp is replaced by its
5 MD5 checksum.
6 (autoload-generate-file-autoloads): Use MD5 checksum instead of
7 time-stamp for secondary autoloads files.
8 (update-directory-autoloads): Remove duplicate entries.
9 Use time-less-p for time-stamps, as done in autoload-find-destination.
10
12007-07-07 Jay Belanger <jay.p.belanger@gmail.com> 112007-07-07 Jay Belanger <jay.p.belanger@gmail.com>
2 12
3 * calc/calc.el (math-read-number): Replace number by variable. 13 * calc/calc.el (math-read-number): Replace number by variable.
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index e9c05d48c65..30b7c7e1937 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -409,16 +409,33 @@ Return non-nil iff FILE adds no autoloads to OUTFILE
409 (forward-line 1)))))) 409 (forward-line 1))))))
410 410
411 (when output-start 411 (when output-start
412 (with-current-buffer outbuf 412 (let ((secondary-autoloads-file-buf
413 (save-excursion 413 (if (local-variable-p 'generated-autoload-file)
414 ;; Insert the section-header line which lists the file name 414 (current-buffer))))
415 ;; and which functions are in it, etc. 415 (with-current-buffer outbuf
416 (goto-char output-start) 416 (save-excursion
417 (autoload-insert-section-header 417 ;; Insert the section-header line which lists the file name
418 outbuf autoloads-done load-name relfile 418 ;; and which functions are in it, etc.
419 (nth 5 (file-attributes relfile))) 419 (goto-char output-start)
420 (insert ";;; Generated autoloads from " relfile "\n")) 420 (autoload-insert-section-header
421 (insert generate-autoload-section-trailer))) 421 outbuf autoloads-done load-name relfile
422 (if secondary-autoloads-file-buf
423 ;; MD5 checksums are much better because they do not
424 ;; change unless the file changes (so they'll be
425 ;; equal on two different systems and will change
426 ;; less often than time-stamps, thus leading to fewer
427 ;; unneeded changes causing spurious conflicts), but
428 ;; using time-stamps is a very useful optimization,
429 ;; so we use time-stamps for the main autoloads file
430 ;; (loaddefs.el) where we have special ways to
431 ;; circumvent the "random change problem", and MD5
432 ;; checksum in secondary autoload files where we do
433 ;; not need the time-stamp optimization because it is
434 ;; already provided by the primary autoloads file.
435 (md5 secondary-autoloads-file-buf nil nil 'emacs-mule)
436 (nth 5 (file-attributes relfile))))
437 (insert ";;; Generated autoloads from " relfile "\n"))
438 (insert generate-autoload-section-trailer))))
422 (message "Generating autoloads for %s...done" file)) 439 (message "Generating autoloads for %s...done" file))
423 (or visited 440 (or visited
424 ;; We created this buffer, so we should kill it. 441 ;; We created this buffer, so we should kill it.
@@ -454,14 +471,12 @@ Return FILE if there was no autoload cookie in it, else nil."
454FILE is the file name of the current buffer. 471FILE is the file name of the current buffer.
455Returns a buffer whose point is placed at the requested location. 472Returns a buffer whose point is placed at the requested location.
456Returns nil if the file's autoloads are uptodate, otherwise 473Returns nil if the file's autoloads are uptodate, otherwise
457removes any prior now out-of-date autoload entries. 474removes any prior now out-of-date autoload entries."
458The current buffer only matters if it is visiting a file or if it has a buffer-local
459value for some variables such as `generated-autoload-file', so it's OK
460to call it from a dummy buffer if FILE is not currently visited."
461 (catch 'up-to-date 475 (catch 'up-to-date
462 (let ((load-name (autoload-file-load-name file)) 476 (let* ((load-name (autoload-file-load-name file))
463 (existing-buffer (if buffer-file-name (current-buffer))) 477 (buf (current-buffer))
464 (found nil)) 478 (existing-buffer (if buffer-file-name buf))
479 (found nil))
465 (with-current-buffer 480 (with-current-buffer
466 ;; We must read/write the file without any code conversion, 481 ;; We must read/write the file without any code conversion,
467 ;; but still decode EOLs. 482 ;; but still decode EOLs.
@@ -489,8 +504,16 @@ to call it from a dummy buffer if FILE is not currently visited."
489 (file-time (nth 5 (file-attributes file)))) 504 (file-time (nth 5 (file-attributes file))))
490 (if (and (or (null existing-buffer) 505 (if (and (or (null existing-buffer)
491 (not (buffer-modified-p existing-buffer))) 506 (not (buffer-modified-p existing-buffer)))
492 (listp last-time) (= (length last-time) 2) 507 (or
493 (not (time-less-p last-time file-time))) 508 ;; last-time is the time-stamp (specifying
509 ;; the last time we looked at the file) and
510 ;; the file hasn't been changed since.
511 (and (listp last-time) (= (length last-time) 2)
512 (not (time-less-p last-time file-time)))
513 ;; last-time is an MD5 checksum instead.
514 (and (stringp last-time)
515 (equal last-time
516 (md5 buf nil nil 'emacs-mule)))))
494 (throw 'up-to-date nil) 517 (throw 'up-to-date nil)
495 (autoload-remove-section begin) 518 (autoload-remove-section begin)
496 (setq found t)))) 519 (setq found t))))
@@ -569,10 +592,13 @@ directory or directories specified."
569 (push file no-autoloads) 592 (push file no-autoloads)
570 (setq files (delete file files))))))) 593 (setq files (delete file files)))))))
571 ((not (stringp file))) 594 ((not (stringp file)))
572 ((not (file-exists-p file)) 595 ((not (and (file-exists-p file)
596 ;; Remove duplicates as well, just in case.
597 (member file files)))
573 ;; Remove the obsolete section. 598 ;; Remove the obsolete section.
574 (autoload-remove-section (match-beginning 0))) 599 (autoload-remove-section (match-beginning 0)))
575 ((equal (nth 4 form) (nth 5 (file-attributes file))) 600 ((not (time-less-p (nth 4 form)
601 (nth 5 (file-attributes file))))
576 ;; File hasn't changed. 602 ;; File hasn't changed.
577 nil) 603 nil)
578 (t 604 (t