branch: externals/marginalia commit a0810058fb5b029a59a513a4f13c0c2b12e5533f Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
marginalia-annotate-bookmark: Truncate file names (Fix #69) --- marginalia.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/marginalia.el b/marginalia.el index 56cd04a..7f79b5a 100644 --- a/marginalia.el +++ b/marginalia.el @@ -585,11 +585,14 @@ The string is transformed according to `marginalia-bookmark-type-transformers'." (let ((front (alist-get 'front-context-string bm))) (marginalia--fields ((marginalia--bookmark-type bm) :width 10 :face 'marginalia-type) - ((alist-get 'filename bm) :width 40 :face 'marginalia-file-name) + ((alist-get 'filename bm) :truncate 40 :face 'marginalia-file-name) ((if (or (not front) (string= front "")) "" - (concat (replace-regexp-in-string "\n" "\\\\n" front) "…")) - :width 20 :face 'marginalia-documentation))))) + (concat (string-trim + (replace-regexp-in-string + "[ \t]+" " " + (replace-regexp-in-string "\n" "\\\\n" front))) "…")) + :truncate 20 :face 'marginalia-documentation))))) (defun marginalia-annotate-customize-group (cand) "Annotate customization group CAND with its documentation string."