mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-27 07:37:33 +00:00
Report progress during custom-make-dependencies instead of file count
* lisp/cus-dep.el (custom-make-dependencies): Rewrite to use reporter to report progress instead of how many files we've processed. * lisp/emacs-lisp/byte-run.el (byte-compile-info-string): New function. (byte-compile-info-message): Use it.
This commit is contained in:
parent
29ea0803d7
commit
6a02ca0b8c
4
etc/NEWS
4
etc/NEWS
@ -1701,6 +1701,10 @@ valid event type.
|
||||
** The new macro `with-suppressed-warnings' can be used to suppress
|
||||
specific byte-compile warnings.
|
||||
|
||||
---
|
||||
** The new function `byte-compile-info-message' can be used to output
|
||||
informational messages that look pleasing during the Emacs build.
|
||||
|
||||
+++
|
||||
** The 'append' arg of 'add-hook' is generalized to a finer notion of 'depth'
|
||||
This makes it possible to control the ordering of functions more precisely,
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
(require 'widget)
|
||||
(require 'cus-face)
|
||||
(require 'cl-lib)
|
||||
|
||||
(defvar generated-custom-dependencies-file "cus-load.el"
|
||||
"Output file for `custom-make-dependencies'.")
|
||||
@ -53,25 +54,31 @@ ldefs-boot\\|cus-load\\|finder-inf\\|esh-groups\\|subdirs\\)\\.el$\\)"
|
||||
(defun custom-make-dependencies ()
|
||||
"Batch function to extract custom dependencies from .el files.
|
||||
Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
|
||||
(let ((enable-local-eval nil)
|
||||
(let* ((enable-local-eval nil)
|
||||
(enable-local-variables :safe)
|
||||
(file-count 0)
|
||||
subdir)
|
||||
(with-temp-buffer
|
||||
;; Use up command-line-args-left else Emacs can try to open
|
||||
;; the args as directories after we are done.
|
||||
(while (setq subdir (pop command-line-args-left))
|
||||
(let ((files (directory-files subdir nil "\\`[^=.].*\\.el\\'"))
|
||||
(default-directory
|
||||
(file-name-as-directory (expand-file-name subdir)))
|
||||
(preloaded (concat "\\`\\(\\./+\\)?"
|
||||
(regexp-opt preloaded-file-list t)
|
||||
"\\.el\\'")))
|
||||
(dolist (file files)
|
||||
(setq file-count (1+ file-count))
|
||||
(when (zerop (mod file-count 100))
|
||||
(byte-compile-info-message "Scanned %s files for custom"
|
||||
file-count))
|
||||
"\\.el\\'"))
|
||||
(file-count 0)
|
||||
(files
|
||||
;; Use up command-line-args-left else Emacs can try to open
|
||||
;; the args as directories after we are done.
|
||||
(cl-loop for subdir = (pop command-line-args-left)
|
||||
while subdir
|
||||
append (mapcar (lambda (f)
|
||||
(cons subdir f))
|
||||
(directory-files subdir nil
|
||||
"\\`[^=.].*\\.el\\'"))))
|
||||
(progress (make-progress-reporter
|
||||
(byte-compile-info-string "Scanning files for custom")
|
||||
0 (length files) nil 10)))
|
||||
(with-temp-buffer
|
||||
(dolist (elem files)
|
||||
(let* ((subdir (car elem))
|
||||
(file (cdr elem))
|
||||
(default-directory
|
||||
(directory-file-name (expand-file-name subdir))))
|
||||
(progress-reporter-update progress (setq file-count (1+ file-count)))
|
||||
(unless (or (string-match custom-dependencies-no-scan-regexp file)
|
||||
(string-match preloaded (format "%s/%s" subdir file))
|
||||
(not (file-exists-p file)))
|
||||
@ -118,7 +125,8 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
|
||||
(if (equal type "custom")
|
||||
"variable"
|
||||
type)))))))))))
|
||||
(error nil)))))))))
|
||||
(error nil)))))))
|
||||
(progress-reporter-done progress))
|
||||
(byte-compile-info-message "Generating %s..."
|
||||
generated-custom-dependencies-file)
|
||||
(set-buffer (find-file-noselect generated-custom-dependencies-file))
|
||||
|
@ -540,9 +540,13 @@ Otherwise, return nil. For internal use only."
|
||||
(mapconcat (lambda (char) (format "`?\\%c'" char))
|
||||
sorted ", ")))))
|
||||
|
||||
(defun byte-compile-info-string (&rest args)
|
||||
"Format ARGS in a way that looks pleasing in the compilation output."
|
||||
(format " %-9s%s" "INFO" (apply #'format args)))
|
||||
|
||||
(defun byte-compile-info-message (&rest args)
|
||||
"Message format ARGS in a way that looks pleasing in the compilation output."
|
||||
(message " %-9s%s" "INFO" (apply #'format args)))
|
||||
(message "%s" (apply #'byte-compile-info-string args)))
|
||||
|
||||
|
||||
;; I nuked this because it's not a good idea for users to think of using it.
|
||||
|
Loading…
Reference in New Issue
Block a user