Skip to content

Commit b156114

Browse files
Improve user options
1 parent f242c13 commit b156114

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

doom-dashboard.el

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@
4747
:type 'boolean
4848
:group 'dashboard)
4949

50+
(defcustom doom-dashboard-shortmenu-functions
51+
`((recents . recentf)
52+
(bookmarks . bookmark-jump)
53+
(projects
54+
. ,(if (eq dashboard-projects-backend 'project-el)
55+
'project-switch-project
56+
'projectile-switch-project))
57+
(agenda . org-agenda))
58+
"Functions to me used by shortmenu widgets.
59+
Possible values for list-type are: `recents', `bookmarks', `projects',
60+
`agenda' ,`registers'."
61+
:type '(alist :key-type symbol :value-type function)
62+
:group 'dashboard)
63+
5064
;;
5165
;; Faces
5266
;;
@@ -76,7 +90,7 @@
7690

7791
(defun doom-dashboard-insert-project-shortmenu (&rest _)
7892
"Insert project shortmenu widget."
79-
(let* ((fn #'project-switch-project)
93+
(let* ((fn (alist-get 'projects doom-dashboard-shortmenu-functions))
8094
(fn-keymap (format "\\[%s]" fn))
8195
(icon-name (alist-get 'projects dashboard-heading-icons))
8296
(icon (nerd-icons-octicon icon-name :face 'dashboard-heading)))
@@ -85,7 +99,8 @@
8599
(widget-create 'item
86100
:tag (format "%-30s" "Open project")
87101
:action (lambda (&rest _)
88-
(call-interactively #'project-switch-project))
102+
(call-interactively
103+
(alist-get 'projects doom-dashboard-shortmenu-functions)))
89104
:mouse-face 'highlight
90105
:button-face 'dashboard-heading
91106
:button-prefix ""
@@ -98,7 +113,7 @@
98113

99114
(defun doom-dashboard-insert-org-agenda-shortmenu (&rest _)
100115
"Insert `org-agenda' shortmenu widget."
101-
(let* ((fn #'org-agenda)
116+
(let* ((fn (alist-get 'agenda doom-dashboard-shortmenu-functions))
102117
(fn-keymap (format "\\[%s]" fn))
103118
(icon-name (alist-get 'agenda dashboard-heading-icons))
104119
(icon (nerd-icons-octicon icon-name :face 'dashboard-heading)))
@@ -107,7 +122,8 @@
107122
(widget-create 'item
108123
:tag (format "%-30s" "Open org-agenda")
109124
:action (lambda (&rest _)
110-
(call-interactively #'org-agenda))
125+
(call-interactively
126+
(alist-get 'agenda doom-dashboard-shortmenu-functions)))
111127
:mouse-face 'highlight
112128
:button-face 'dashboard-heading
113129
:button-prefix ""
@@ -120,7 +136,7 @@
120136

121137
(defun doom-dashboard-insert-bookmark-shortmenu (&rest _)
122138
"Insert bookmark shortmenu widget."
123-
(let* ((fn #'bookmark-jump)
139+
(let* ((fn (alist-get 'bookmarks doom-dashboard-shortmenu-functions))
124140
(fn-keymap (format "\\[%s]" fn))
125141
(icon-name (alist-get 'bookmarks dashboard-heading-icons))
126142
(icon (nerd-icons-octicon icon-name :face 'dashboard-heading)))
@@ -129,7 +145,8 @@
129145
(widget-create 'item
130146
:tag (format "%-30s" "Jump to bookmark")
131147
:action (lambda (&rest _)
132-
(call-interactively #'bookmark-jump))
148+
(call-interactively
149+
(alist-get 'bookmarks doom-dashboard-shortmenu-functions)))
133150
:mouse-face 'highlight
134151
:button-face 'dashboard-heading
135152
:button-prefix ""
@@ -142,7 +159,7 @@
142159

143160
(defun doom-dashboard-insert-recents-shortmenu (&rest _)
144161
"Insert recent files short menu widget."
145-
(let* ((fn #'recentf)
162+
(let* ((fn (alist-get 'recents doom-dashboard-shortmenu-functions))
146163
(fn-keymap (format "\\[%s]" fn))
147164
(icon-name (alist-get 'recents dashboard-heading-icons))
148165
(icon (nerd-icons-octicon icon-name :face 'dashboard-heading)))
@@ -151,7 +168,8 @@
151168
(widget-create 'item
152169
:tag (format "%-30s" "Recently opened files")
153170
:action (lambda (&rest _)
154-
(call-interactively #'recentf))
171+
(call-interactively
172+
(alist-get 'recents doom-dashboard-shortmenu-functions)))
155173
:mouse-face 'highlight
156174
:button-face 'dashboard-heading
157175
:button-prefix ""

0 commit comments

Comments
 (0)