From 7b4cc35c514d32862192e4035f20a20ebc48a1c5 Mon Sep 17 00:00:00 2001 From: weebojensen Date: Sun, 5 Jul 2020 12:50:04 +0200 Subject: [PATCH 1/4] Add fix for people using straight.el and package.el in dashboard-init-info --- dashboard-widgets.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index a045ce78..9531ead2 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -152,13 +152,16 @@ Example: (defcustom dashboard-init-info ;; Check if package.el was loaded and if package loading was enabled - (if (bound-and-true-p package-alist) + (if (and (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache)) (bound-and-true-p package-alist)) (format "%d packages loaded in %s" - (length package-activated-list) (emacs-init-time)) - (if (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache)) + (+ (length package-activated-list) (hash-table-size straight--profile-cache)) (emacs-init-time)) + (if (bound-and-true-p package-alist) (format "%d packages loaded in %s" - (hash-table-size straight--profile-cache) (emacs-init-time)) - (format "Emacs started in %s" (emacs-init-time)))) + (length package-activated-list) (emacs-init-time)) + (if (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache)) + (format "%d packages loaded in %s" + (hash-table-size straight--profile-cache) (emacs-init-time)) + (format "Emacs started in %s" (emacs-init-time))))) "Init info with packages loaded and init time." :type 'boolean :group 'dashboard) From f193f081b85a99ebafc035c301ef33a5a957c9c5 Mon Sep 17 00:00:00 2001 From: 2bruh4me Date: Mon, 6 Jul 2020 03:38:51 +0200 Subject: [PATCH 2/4] Fixed unnessecary `and` --- dashboard-widgets.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 9531ead2..d9df8547 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -152,7 +152,7 @@ Example: (defcustom dashboard-init-info ;; Check if package.el was loaded and if package loading was enabled - (if (and (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache)) (bound-and-true-p package-alist)) + (if (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache) (bound-and-true-p package-alist)) (format "%d packages loaded in %s" (+ (length package-activated-list) (hash-table-size straight--profile-cache)) (emacs-init-time)) (if (bound-and-true-p package-alist) From 1754f2c570760c1954343c62b16bf93e137f83f3 Mon Sep 17 00:00:00 2001 From: 2bruh4me <51802665+2bruh4me@users.noreply.github.com> Date: Sun, 15 Nov 2020 21:14:17 +0100 Subject: [PATCH 3/4] Fix too long lines causing lint error --- dashboard-widgets.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 0d2995f6..66c76375 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -159,9 +159,11 @@ Example: (defcustom dashboard-init-info ;; Check if package.el was loaded and if package loading was enabled - (if (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache) (bound-and-true-p package-alist)) + (if (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache) + (bound-and-true-p package-alist)) (format "%d packages loaded in %s" - (+ (length package-activated-list) (hash-table-size straight--profile-cache)) (emacs-init-time)) + (+ (length package-activated-list) (hash-table-size straight--profile-cache)) + (emacs-init-time)) (if (bound-and-true-p package-alist) (format "%d packages loaded in %s" (length package-activated-list) (emacs-init-time)) From f6648d638637d4ee61e18a1d6d0c5e13ea5b0783 Mon Sep 17 00:00:00 2001 From: 2bruh4me <51802665+2bruh4me@users.noreply.github.com> Date: Tue, 24 Nov 2020 23:35:51 +0100 Subject: [PATCH 4/4] Refactor 'dashboard-init-info' --- dashboard-widgets.el | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/dashboard-widgets.el b/dashboard-widgets.el index 66c76375..e2fa84bc 100644 --- a/dashboard-widgets.el +++ b/dashboard-widgets.el @@ -158,19 +158,14 @@ Example: :group 'dashboard) (defcustom dashboard-init-info - ;; Check if package.el was loaded and if package loading was enabled - (if (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache) - (bound-and-true-p package-alist)) - (format "%d packages loaded in %s" - (+ (length package-activated-list) (hash-table-size straight--profile-cache)) - (emacs-init-time)) - (if (bound-and-true-p package-alist) - (format "%d packages loaded in %s" - (length package-activated-list) (emacs-init-time)) - (if (and (boundp 'straight--profile-cache) (hash-table-p straight--profile-cache)) - (format "%d packages loaded in %s" - (hash-table-size straight--profile-cache) (emacs-init-time)) - (format "Emacs started in %s" (emacs-init-time))))) + (let ((package-count 0) (time (emacs-init-time))) + (when (boundp 'straight--profile-cache) + (setq package-count (hash-table-size straight--profile-cache))) + (when (bound-and-true-p package-alist) + (setq package-count (+ (length package-activated-list) package-count))) + (if (null (zerop package-count)) + (format "%d packages loaded in %s" package-count time) + (format "Emacs started in %s" time))) "Init info with packages loaded and init time." :type 'boolean :group 'dashboard)