Improve reproducibility of generated loaddefs file.
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads): Make the return value the modtime of the input file (if no autoloads). (update-directory-autoloads): In the "no autoloads" section, use "most recent modtime" rather than "current time". ; http://lists.gnu.org/archive/html/emacs-devel/2015-06/msg00688.html
This commit is contained in:
parent
0dfea4562e
commit
5200c2baef
1 changed files with 141 additions and 134 deletions
|
@ -522,8 +522,8 @@ If OUTFILE is non-nil and FILE specifies a `generated-autoload-file'
|
|||
different from OUTFILE, then OUTBUF is ignored.
|
||||
|
||||
Return non-nil if and only if FILE adds no autoloads to OUTFILE
|
||||
\(or OUTBUF if OUTFILE is nil)."
|
||||
(catch 'done
|
||||
\(or OUTBUF if OUTFILE is nil). The actual return value is
|
||||
FILE's modification time."
|
||||
(let (load-name
|
||||
(print-length nil)
|
||||
(print-level nil)
|
||||
|
@ -534,6 +534,8 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
|
|||
(absfile (expand-file-name file))
|
||||
;; nil until we found a cookie.
|
||||
output-start)
|
||||
(when
|
||||
(catch 'done
|
||||
(with-current-buffer (or visited
|
||||
;; It is faster to avoid visiting the file.
|
||||
(autoload-find-file file))
|
||||
|
@ -631,7 +633,8 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
|
|||
(or (not output-start)
|
||||
;; If the entries were added to some other buffer, then the file
|
||||
;; doesn't add entries to OUTFILE.
|
||||
otherbuf))))
|
||||
otherbuf))
|
||||
(nth 5 (file-attributes absfile)))))
|
||||
|
||||
(defun autoload-save-buffers ()
|
||||
(while autoload-modified-buffers
|
||||
|
@ -757,7 +760,7 @@ write its autoloads into the specified file instead."
|
|||
t files-re))
|
||||
dirs)))
|
||||
(done ())
|
||||
(this-time (current-time))
|
||||
(last-time)
|
||||
;; Files with no autoload cookies or whose autoloads go to other
|
||||
;; files because of file-local autoload-generated-file settings.
|
||||
(no-autoloads nil)
|
||||
|
@ -782,14 +785,14 @@ write its autoloads into the specified file instead."
|
|||
;; There shouldn't be more than one such entry.
|
||||
;; Remove the obsolete section.
|
||||
(autoload-remove-section (match-beginning 0))
|
||||
(let ((last-time (nth 4 form)))
|
||||
(setq last-time (nth 4 form))
|
||||
(dolist (file file)
|
||||
(let ((file-time (nth 5 (file-attributes file))))
|
||||
(when (and file-time
|
||||
(not (time-less-p last-time file-time)))
|
||||
;; file unchanged
|
||||
(push file no-autoloads)
|
||||
(setq files (delete file files)))))))
|
||||
(setq files (delete file files))))))
|
||||
((not (stringp file)))
|
||||
((or (not (file-exists-p file))
|
||||
;; Remove duplicates as well, just in case.
|
||||
|
@ -811,14 +814,18 @@ write its autoloads into the specified file instead."
|
|||
(push file done)
|
||||
(setq files (delete file files)))))
|
||||
;; Elements remaining in FILES have no existing autoload sections yet.
|
||||
(let ((no-autoloads-time (or last-time '(0 0 0 0))) file-time)
|
||||
(dolist (file files)
|
||||
(cond
|
||||
((member (expand-file-name file) autoload-excludes) nil)
|
||||
;; Passing nil as second argument forces
|
||||
;; autoload-generate-file-autoloads to look for the right
|
||||
;; spot where to insert each autoloads section.
|
||||
((autoload-generate-file-autoloads file nil buffer-file-name)
|
||||
(push file no-autoloads))))
|
||||
((setq file-time
|
||||
(autoload-generate-file-autoloads file nil buffer-file-name))
|
||||
(push file no-autoloads)
|
||||
(if (time-less-p no-autoloads-time file-time)
|
||||
(setq no-autoloads-time file-time)))))
|
||||
|
||||
(when no-autoloads
|
||||
;; Sort them for better readability.
|
||||
|
@ -827,8 +834,8 @@ write its autoloads into the specified file instead."
|
|||
(goto-char (point-max))
|
||||
(search-backward "\f" nil t)
|
||||
(autoload-insert-section-header
|
||||
(current-buffer) nil nil no-autoloads this-time)
|
||||
(insert generate-autoload-section-trailer))
|
||||
(current-buffer) nil nil no-autoloads no-autoloads-time)
|
||||
(insert generate-autoload-section-trailer)))
|
||||
|
||||
(let ((version-control 'never))
|
||||
(save-buffer))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue