diff options
| author | John Wiegley | 2018-03-12 23:35:01 -0700 |
|---|---|---|
| committer | GitHub | 2018-03-12 23:35:01 -0700 |
| commit | 742cf27b0eeff52aa6bbfc85b96fdc3a120ddfa3 (patch) | |
| tree | 5edc600e1bdc9ee7b6cb9898ea41cb948ece9dbf | |
| parent | dd8ef121123741cfe10524820602fa9e00b0c07b (diff) | |
| parent | 69a561b86b4d781de5294964176509b112d7a7bd (diff) | |
| download | emacs-742cf27b0eeff52aa6bbfc85b96fdc3a120ddfa3.tar.gz emacs-742cf27b0eeff52aa6bbfc85b96fdc3a120ddfa3.zip | |
Merge pull request from DamienCassou/fix-report-again
Fix report again after revert
GitHub-reference: https://github.com/jwiegley/use-package/issues/647
| -rw-r--r-- | lisp/use-package/use-package-core.el | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 83630b80785..bd18c972303 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el | |||
| @@ -43,6 +43,12 @@ | |||
| 43 | (require 'cl-lib) | 43 | (require 'cl-lib) |
| 44 | (require 'tabulated-list) | 44 | (require 'tabulated-list) |
| 45 | 45 | ||
| 46 | (if (and (eq emacs-major-version 24) (eq emacs-minor-version 3)) | ||
| 47 | (defsubst hash-table-keys (hash-table) | ||
| 48 | "Return a list of keys in HASH-TABLE." | ||
| 49 | (cl-loop for k being the hash-keys of hash-table collect k)) | ||
| 50 | (require 'subr-x)) | ||
| 51 | |||
| 46 | (eval-when-compile | 52 | (eval-when-compile |
| 47 | (require 'cl) | 53 | (require 'cl) |
| 48 | (require 'regexp-opt)) | 54 | (require 'regexp-opt)) |
| @@ -966,27 +972,27 @@ If RECURSED is non-nil, recurse into sublists." | |||
| 966 | (setq use-package-statistics (make-hash-table))) | 972 | (setq use-package-statistics (make-hash-table))) |
| 967 | 973 | ||
| 968 | (defun use-package-statistics-status (package) | 974 | (defun use-package-statistics-status (package) |
| 969 | "Return loading configuration status of PACKAGE." | 975 | "Return loading configuration status of PACKAGE statistics." |
| 970 | (cond ((gethash :config statistics) "Configured") | 976 | (cond ((gethash :config package) "Configured") |
| 971 | ((gethash :init statistics) "Initialized") | 977 | ((gethash :init package) "Initialized") |
| 972 | ((gethash :preface statistics) "Prefaced") | 978 | ((gethash :preface package) "Prefaced") |
| 973 | ((gethash :use-package statistics) "Declared"))) | 979 | ((gethash :use-package package) "Declared"))) |
| 974 | 980 | ||
| 975 | (defun use-package-statistics-last-event (package) | 981 | (defun use-package-statistics-last-event (package) |
| 976 | "Return the date when package's status last changed. | 982 | "Return the date when PACKAGE's status last changed. |
| 977 | The date is returned as a string." | 983 | The date is returned as a string." |
| 978 | (format-time-string "%Y-%m-%d %a %H:%M" | 984 | (format-time-string "%Y-%m-%d %a %H:%M" |
| 979 | (or (gethash :config statistics) | 985 | (or (gethash :config package) |
| 980 | (gethash :init statistics) | 986 | (gethash :init package) |
| 981 | (gethash :preface statistics) | 987 | (gethash :preface package) |
| 982 | (gethash :use-package statistics)))) | 988 | (gethash :use-package package)))) |
| 983 | 989 | ||
| 984 | (defun use-package-statistics-time (package) | 990 | (defun use-package-statistics-time (package) |
| 985 | "Return the time is took for package to load." | 991 | "Return the time is took for PACKAGE to load." |
| 986 | (+ (float-time (gethash :config-secs statistics 0)) | 992 | (+ (float-time (gethash :config-secs package 0)) |
| 987 | (float-time (gethash :init-secs statistics 0)) | 993 | (float-time (gethash :init-secs package 0)) |
| 988 | (float-time (gethash :preface-secs statistics 0)) | 994 | (float-time (gethash :preface-secs package 0)) |
| 989 | (float-time (gethash :use-package-secs statistics 0)))) | 995 | (float-time (gethash :use-package-secs package 0)))) |
| 990 | 996 | ||
| 991 | (defun use-package-statistics-convert (package) | 997 | (defun use-package-statistics-convert (package) |
| 992 | "Return information about PACKAGE. | 998 | "Return information about PACKAGE. |
| @@ -998,9 +1004,9 @@ The information is formatted in a way suitable for | |||
| 998 | package | 1004 | package |
| 999 | (vector | 1005 | (vector |
| 1000 | (symbol-name package) | 1006 | (symbol-name package) |
| 1001 | (use-package-statistics-status package) | 1007 | (use-package-statistics-status statistics) |
| 1002 | (use-package-statistics-last-event package) | 1008 | (use-package-statistics-last-event statistics) |
| 1003 | (format "%.2f" (use-package-statistics-time package)))))) | 1009 | (format "%.2f" (use-package-statistics-time statistics)))))) |
| 1004 | 1010 | ||
| 1005 | (defun use-package-report () | 1011 | (defun use-package-report () |
| 1006 | "Show current statistics gathered about use-package declarations. | 1012 | "Show current statistics gathered about use-package declarations. |