fix(doom-dashboard): :key param & keymap precedence
- Fixes the :key property in +doom-dashboard-menu-sections, which formerly threw an error. - When looking up commands in +doom-dashboard-menu-sections, the dashboard will now prioritize keys in +doom-dashboard-mode-map. Close: #6194 Co-authored-by: Gerry Agbobada <gagbo@users.noreply.github.com>
This commit is contained in:
parent
b77699c38f
commit
b5093a5e93
1 changed files with 24 additions and 12 deletions
|
@ -459,7 +459,7 @@ What it is set to is controlled by `+doom-dashboard-pwd-policy'."
|
|||
(all-the-icons-default-adjust -0.02))
|
||||
(insert "\n")
|
||||
(dolist (section +doom-dashboard-menu-sections)
|
||||
(cl-destructuring-bind (label &key icon action when face) section
|
||||
(cl-destructuring-bind (label &key icon action when face key) section
|
||||
(when (and (fboundp action)
|
||||
(or (null when)
|
||||
(eval when t)))
|
||||
|
@ -483,7 +483,18 @@ What it is set to is controlled by `+doom-dashboard-pwd-policy'."
|
|||
(propertize (symbol-name action) 'face 'doom-dashboard-menu-desc)))
|
||||
(format "%-37s" (buffer-string)))
|
||||
;; Lookup command keys dynamically
|
||||
(or (when-let (key (where-is-internal action nil t))
|
||||
(propertize
|
||||
(or key
|
||||
(when-let*
|
||||
((keymaps
|
||||
(delq
|
||||
nil (list (when (bound-and-true-p evil-local-mode)
|
||||
(evil-get-auxiliary-keymap +doom-dashboard-mode-map 'normal))
|
||||
+doom-dashboard-mode-map)))
|
||||
(key
|
||||
(or (when keymaps
|
||||
(where-is-internal action keymaps t))
|
||||
(where-is-internal action nil t))))
|
||||
(with-temp-buffer
|
||||
(save-excursion (insert (key-description key)))
|
||||
(while (re-search-forward "<\\([^>]+\\)>" nil t)
|
||||
|
@ -492,8 +503,9 @@ What it is set to is controlled by `+doom-dashboard-pwd-policy'."
|
|||
(upcase (if (< (length str) 3)
|
||||
str
|
||||
(substring str 0 3))))))
|
||||
(propertize (buffer-string) 'face 'doom-dashboard-menu-desc)))
|
||||
""))))
|
||||
(buffer-string)))
|
||||
"")
|
||||
'face 'doom-dashboard-menu-desc))))
|
||||
(if (display-graphic-p)
|
||||
"\n\n"
|
||||
"\n")))))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue