|
47 | 47 | :type 'boolean |
48 | 48 | :group 'dashboard) |
49 | 49 |
|
| 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 | + |
50 | 64 | ;; |
51 | 65 | ;; Faces |
52 | 66 | ;; |
|
76 | 90 |
|
77 | 91 | (defun doom-dashboard-insert-project-shortmenu (&rest _) |
78 | 92 | "Insert project shortmenu widget." |
79 | | - (let* ((fn #'project-switch-project) |
| 93 | + (let* ((fn (alist-get 'projects doom-dashboard-shortmenu-functions)) |
80 | 94 | (fn-keymap (format "\\[%s]" fn)) |
81 | 95 | (icon-name (alist-get 'projects dashboard-heading-icons)) |
82 | 96 | (icon (nerd-icons-octicon icon-name :face 'dashboard-heading))) |
|
85 | 99 | (widget-create 'item |
86 | 100 | :tag (format "%-30s" "Open project") |
87 | 101 | :action (lambda (&rest _) |
88 | | - (call-interactively #'project-switch-project)) |
| 102 | + (call-interactively |
| 103 | + (alist-get 'projects doom-dashboard-shortmenu-functions))) |
89 | 104 | :mouse-face 'highlight |
90 | 105 | :button-face 'dashboard-heading |
91 | 106 | :button-prefix "" |
|
98 | 113 |
|
99 | 114 | (defun doom-dashboard-insert-org-agenda-shortmenu (&rest _) |
100 | 115 | "Insert `org-agenda' shortmenu widget." |
101 | | - (let* ((fn #'org-agenda) |
| 116 | + (let* ((fn (alist-get 'agenda doom-dashboard-shortmenu-functions)) |
102 | 117 | (fn-keymap (format "\\[%s]" fn)) |
103 | 118 | (icon-name (alist-get 'agenda dashboard-heading-icons)) |
104 | 119 | (icon (nerd-icons-octicon icon-name :face 'dashboard-heading))) |
|
107 | 122 | (widget-create 'item |
108 | 123 | :tag (format "%-30s" "Open org-agenda") |
109 | 124 | :action (lambda (&rest _) |
110 | | - (call-interactively #'org-agenda)) |
| 125 | + (call-interactively |
| 126 | + (alist-get 'agenda doom-dashboard-shortmenu-functions))) |
111 | 127 | :mouse-face 'highlight |
112 | 128 | :button-face 'dashboard-heading |
113 | 129 | :button-prefix "" |
|
120 | 136 |
|
121 | 137 | (defun doom-dashboard-insert-bookmark-shortmenu (&rest _) |
122 | 138 | "Insert bookmark shortmenu widget." |
123 | | - (let* ((fn #'bookmark-jump) |
| 139 | + (let* ((fn (alist-get 'bookmarks doom-dashboard-shortmenu-functions)) |
124 | 140 | (fn-keymap (format "\\[%s]" fn)) |
125 | 141 | (icon-name (alist-get 'bookmarks dashboard-heading-icons)) |
126 | 142 | (icon (nerd-icons-octicon icon-name :face 'dashboard-heading))) |
|
129 | 145 | (widget-create 'item |
130 | 146 | :tag (format "%-30s" "Jump to bookmark") |
131 | 147 | :action (lambda (&rest _) |
132 | | - (call-interactively #'bookmark-jump)) |
| 148 | + (call-interactively |
| 149 | + (alist-get 'bookmarks doom-dashboard-shortmenu-functions))) |
133 | 150 | :mouse-face 'highlight |
134 | 151 | :button-face 'dashboard-heading |
135 | 152 | :button-prefix "" |
|
142 | 159 |
|
143 | 160 | (defun doom-dashboard-insert-recents-shortmenu (&rest _) |
144 | 161 | "Insert recent files short menu widget." |
145 | | - (let* ((fn #'recentf) |
| 162 | + (let* ((fn (alist-get 'recents doom-dashboard-shortmenu-functions)) |
146 | 163 | (fn-keymap (format "\\[%s]" fn)) |
147 | 164 | (icon-name (alist-get 'recents dashboard-heading-icons)) |
148 | 165 | (icon (nerd-icons-octicon icon-name :face 'dashboard-heading))) |
|
151 | 168 | (widget-create 'item |
152 | 169 | :tag (format "%-30s" "Recently opened files") |
153 | 170 | :action (lambda (&rest _) |
154 | | - (call-interactively #'recentf)) |
| 171 | + (call-interactively |
| 172 | + (alist-get 'recents doom-dashboard-shortmenu-functions))) |
155 | 173 | :mouse-face 'highlight |
156 | 174 | :button-face 'dashboard-heading |
157 | 175 | :button-prefix "" |
|
0 commit comments