track real paths for items to ensure correct icons for shortened entries#593
track real paths for items to ensure correct icons for shortened entries#593NicoloZorzetto wants to merge 1 commit intoemacs-dashboard:masterfrom
Conversation
ricardoricho
left a comment
There was a problem hiding this comment.
Great idea use the real paths for the icons.
Thanks.
| (mapc | ||
| (lambda (el) | ||
| (let ((tag ,@rest)) | ||
| (let* ((item (progn ,@rest)) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
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.