From a99ea4b7616025cf78c2f6bf69bc8e5cafb730b7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 12 Aug 2022 09:49:35 +0300 Subject: ; Fix documentation of 'loaddefs-generate' (bug#57144) * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Doc fix. --- lisp/emacs-lisp/loaddefs-gen.el | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lisp/emacs-lisp/loaddefs-gen.el') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 3b329357ad9..0c9bc4832b4 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -519,15 +519,21 @@ binds `generated-autoload-file' as a file-local variable, write its autoloads into the specified file instead. The function does NOT recursively descend into subdirectories of the -directory or directories specified. +directory or directories specified by DIRS. -If EXTRA-DATA, include this string at the start of the generated -file. This will also force generation of OUTPUT-FILE even if -there are no autoloads to put into the file. +Optional argument EXCLUDED-FILES, if non-nil, should be a list of +files, such as preloaded files, whose autoloads should not be written +to OUTPUT-FILE. -If INCLUDE-PACKAGE-VERSION, include package version data. +If EXTRA-DATA is non-nil, it should be a string; include that string +at the beginning of the generated file. This will also force the +generation of OUTPUT-FILE even if there are no autoloads to put into +that file. -If GENERATE-FULL, don't update, but regenerate all the loaddefs files." +If INCLUDE-PACKAGE-VERSION is non-nil, include package version data. + +If GENERATE-FULL is non-nil, regenerate all the loaddefs files anew, +instead of just updating them with the new/changed autoloads." (let* ((files-re (let ((tmp nil)) (dolist (suf (get-load-suffixes)) ;; We don't use module-file-suffix below because -- cgit v1.2.1 From 316d3111a3666237caf86808d53765c8c77a3f53 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 12 Aug 2022 20:22:26 +0200 Subject: Don't update loaddefs.el timestamps uselessly in loaddefs-generate * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Don't re-write the loaddefs.el file when there's no reason to. --- lisp/emacs-lisp/loaddefs-gen.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lisp/emacs-lisp/loaddefs-gen.el') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 0c9bc4832b4..6cb5d00782f 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -589,7 +589,8 @@ instead of just updating them with the new/changed autoloads." ;; We have some data, so generate the loaddef files. First ;; group per output file. (dolist (fdefs (seq-group-by #'car defs)) - (let ((loaddefs-file (car fdefs))) + (let ((loaddefs-file (car fdefs)) + hash) (with-temp-buffer (if (and updating (file-exists-p loaddefs-file)) (insert-file-contents loaddefs-file) @@ -599,6 +600,7 @@ instead of just updating them with the new/changed autoloads." (when extra-data (insert extra-data) (ensure-empty-lines 1))) + (setq hash (buffer-hash)) ;; Then group by source file (and sort alphabetically). (dolist (section (sort (seq-group-by #'cadr (cdr fdefs)) (lambda (e1 e2) @@ -635,9 +637,11 @@ instead of just updating them with the new/changed autoloads." (loaddefs-generate--print-form def)) (unless (bolp) (insert "\n"))))) - (write-region (point-min) (point-max) loaddefs-file nil 'silent) - (byte-compile-info (file-relative-name loaddefs-file lisp-directory) - t "GEN"))))))) + ;; Only write the file if we actually made a change. + (unless (equal (buffer-hash) hash) + (write-region (point-min) (point-max) loaddefs-file nil 'silent) + (byte-compile-info + (file-relative-name loaddefs-file lisp-directory) t "GEN")))))))) (defun loaddefs-generate--print-form (def) "Print DEF in a format that makes sense for version control." -- cgit v1.2.1 From 2bbb007e166764726079d6b32c2478b26c58270b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sat, 13 Aug 2022 14:07:41 +0200 Subject: Allow EXCLUDED-FILES in loaddefs-generate to be relative * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Allow the excluded files to be relative (bug#57144). --- lisp/emacs-lisp/loaddefs-gen.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lisp/emacs-lisp/loaddefs-gen.el') diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 6cb5d00782f..31e1514193f 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -551,6 +551,11 @@ instead of just updating them with the new/changed autoloads." (updating (and (file-exists-p output-file) (not generate-full))) (defs nil)) + ;; Allow the excluded files to be relative. + (setq excluded-files + (mapcar (lambda (file) (expand-file-name file dir)) + excluded-files)) + ;; Collect all the autoload data. (let ((progress (make-progress-reporter (byte-compile-info -- cgit v1.2.1