add use-package statistics and add it to dashboard
This commit is contained in:
@@ -205,6 +205,28 @@
|
|||||||
:load-path "lisp/dashboard"
|
:load-path "lisp/dashboard"
|
||||||
:delight (dashboard-mode "🅓")
|
:delight (dashboard-mode "🅓")
|
||||||
:config
|
:config
|
||||||
|
;; because we use `use-package' include `use-package-statistics' if computed
|
||||||
|
(defun my-dashboard-init-info ()
|
||||||
|
(let ((package-count 0) (time (emacs-init-time)))
|
||||||
|
(when (bound-and-true-p package-alist)
|
||||||
|
(setq package-count (length package-activated-list)))
|
||||||
|
(when (boundp 'straight--profile-cache)
|
||||||
|
(setq package-count (+ (hash-table-size straight--profile-cache) package-count)))
|
||||||
|
;; added case
|
||||||
|
(when use-package-compute-statistics
|
||||||
|
(setq package-count (+ (hash-table-size use-package-statistics) package-count)))
|
||||||
|
(if (zerop package-count)
|
||||||
|
(format "Emacs started in %s" time)
|
||||||
|
(format "%d packages loaded in %s" package-count time))))
|
||||||
|
(setq dashboard-init-info (my-dashboard-init-info))
|
||||||
|
;; overwrite bc/ to recompute `dashboard-init-info' on refresh
|
||||||
|
(defun dashboard-insert-init-info ()
|
||||||
|
"Insert init info when `dashboard-set-init-info' is t."
|
||||||
|
(when dashboard-set-init-info
|
||||||
|
(setq dashboard-init-info (my-dashboard-init-info)) ;; ADDED
|
||||||
|
(dashboard-center-line dashboard-init-info)
|
||||||
|
(insert (propertize dashboard-init-info 'face 'font-lock-comment-face))))
|
||||||
|
"Init info with packages loaded and init time."
|
||||||
(setq dashboard-startup-banner 'logo)
|
(setq dashboard-startup-banner 'logo)
|
||||||
(setq dashboard-set-navigator t)
|
(setq dashboard-set-navigator t)
|
||||||
;; (setq dashboard-navigator-buttons ;; Format: "(icon title help action face prefix suffix)"
|
;; (setq dashboard-navigator-buttons ;; Format: "(icon title help action face prefix suffix)"
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
(require 'use-package) ;; requires bind-key
|
(require 'use-package) ;; requires bind-key
|
||||||
(setq use-package-verbose t)
|
(setq use-package-verbose t)
|
||||||
|
(setq use-package-compute-statistics t)
|
||||||
(use-package delight) ;; used for use-package :delight, see delight-delighted-modes
|
(use-package delight) ;; used for use-package :delight, see delight-delighted-modes
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user