Skip to content

track real paths for items to ensure correct icons for shortened entries#593

Open
NicoloZorzetto wants to merge 1 commit intoemacs-dashboard:masterfrom
NicoloZorzetto:master
Open

track real paths for items to ensure correct icons for shortened entries#593
NicoloZorzetto wants to merge 1 commit intoemacs-dashboard:masterfrom
NicoloZorzetto:master

Conversation

@NicoloZorzetto
Copy link
Contributor

I use dashboard-bookmarks-item-format "%s" so bookmarks to directories always had a general file icon.

By using the real path (dashboard-path) icons can be selected based on the true file or directory.

screenshot-of-old-icon-behavior screenshot-of-new-icon-behavior
Copy link
Contributor

@ricardoricho ricardoricho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea use the real paths for the icons.

Thanks.

(mapc
(lambda (el)
(let ((tag ,@rest))
(let* ((item (progn ,@rest))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need progn? and why tag and item if they are the same?

"Agenda for the coming week:"))
dashboard-agenda-item-icon)
((and (stringp path)
(not (file-remote-p path))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this not, we could rearrange the conditions and check if it's a remote file, then a directory and have the "icon for file" as the default case.

(dashboard-get-shortcut 'recents)
`(lambda (&rest _)
(find-file-existing (dashboard-expand-path-alist ,el dashboard-recentf-alist)))
(find-file-existing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't change, does it?

(find-file-existing (dashboard-expand-path-alist ,el dashboard-recentf-alist)))
(find-file-existing
(dashboard-expand-path-alist ,el dashboard-recentf-alist)))
(let* ((file (dashboard-expand-path-alist el dashboard-recentf-alist))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move the whole let* to a new function, similar to "bookmarks", something like dashboard-recents--propertize-format-item (or similar).

(short-path (dashboard-shorten-path path 'bookmarks)))
(propertize (dashboard-bookmarks--format-name-and-path bookmark short-path)
'dashboard-bookmarks-name bookmark)
(propertize (dashboard-bookmarks--format-name-and-path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are in the bookmarks section, we are building the string that is going to be the tag when we insert the item (this "propertize string"), and here we have the value of the bookmark path.

To have something like:

(concat (dashboard--icon path)
              (propertize (dashboard-bookmarks--format-name-and-path bokmark short-path)) 

The same goes for the recent and projects sections.
This dashboard--icon should handle the "no icons" case and also append a space (" ") at the end of the icon.

@jcs090218 jcs090218 added the bug label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants