[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia ebc6edc2f7 14/15: Perfect the file annotatio
From: |
ELPA Syncer |
Subject: |
[elpa] externals/marginalia ebc6edc2f7 14/15: Perfect the file annotation alignment |
Date: |
Sun, 9 Jan 2022 15:57:54 -0500 (EST) |
branch: externals/marginalia
commit ebc6edc2f7404dcb4ac6f3e0dbb2371d03da33de
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Perfect the file annotation alignment
Now that the file annotations are usually out of sight for me thanks to
`vertico-unobtrusive-mode` it is the perfect timing to fine tune them and
repair
the messed up alignment! ;)
---
marginalia.el | 40 ++++++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index 029bc9ded3..76b9501b90 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -821,14 +821,27 @@ component of a full file path."
(file-attributes (substitute-in-file-name
(marginalia--full-candidate cand))
'integer)))
- (marginalia--fields
- ((marginalia--file-owner attrs)
- :width 12 :face 'marginalia-file-owner)
- ((marginalia--file-modes attrs))
- ((file-size-human-readable (file-attribute-size attrs))
- :face 'marginalia-size :width -7)
- ((marginalia--time (file-attribute-modification-time attrs))
- :face 'marginalia-date :width -12))))
+ ;; HACK: Format differently accordingly to alignment, since the file owner
+ ;; is usually not displayed. Otherwise we will see an excessive amount of
+ ;; whitespace in front of the file permissions. Furthermore the alignment
+ ;; in `consult-buffer' will look ugly. TODO: Find a better solution!
+ (if (eq marginalia-align 'right)
+ (marginalia--fields
+ ;; File owner at the left
+ ((marginalia--file-owner attrs) :face 'marginalia-file-owner)
+ ((marginalia--file-modes attrs))
+ ((file-size-human-readable (file-attribute-size attrs))
+ :face 'marginalia-size :width -7)
+ ((marginalia--time (file-attribute-modification-time attrs))
+ :face 'marginalia-date :width -12))
+ (marginalia--fields
+ ((marginalia--file-modes attrs))
+ ((file-size-human-readable (file-attribute-size attrs))
+ :face 'marginalia-size :width -7)
+ ((marginalia--time (file-attribute-modification-time attrs))
+ :face 'marginalia-date :width -12)
+ ;; File owner at the right
+ ((marginalia--file-owner attrs) :face 'marginalia-file-owner)))))
(defun marginalia-annotate-file (cand)
"Annotate file CAND with its size, modification time and other attributes.
@@ -844,12 +857,11 @@ These annotations are skipped for remote paths."
"Return file owner given ATTRS."
(let ((uid (file-attribute-user-id attrs))
(gid (file-attribute-group-id attrs)))
- (if (or (/= (user-uid) uid) (/= (group-gid) gid))
- (format "%s:%s"
- (or (user-login-name uid) uid)
- ;; group-name was introduced on Emacs 27
- (or (and (fboundp 'group-name) (group-name gid)) gid))
- "")))
+ (when (or (/= (user-uid) uid) (/= (group-gid) gid))
+ (format "%s:%s"
+ (or (user-login-name uid) uid)
+ ;; group-name was introduced on Emacs 27
+ (or (and (fboundp 'group-name) (group-name gid)) gid)))))
(defun marginalia--file-modes (attrs)
"Return fontified file modes given the ATTRS."
- [elpa] externals/marginalia 5f6ba12ff5 04/15: Deprecate and remove most of the current alignment implementation, (continued)
- [elpa] externals/marginalia 5f6ba12ff5 04/15: Deprecate and remove most of the current alignment implementation, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia b5ea8e5ce8 09/15: Indentation, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 4391877773 12/15: Rename marginalia-truncate-width to marginalia-field-width, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 1a2495203d 15/15: Colorize truncation ellipsis, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 55c5d3f1b3 03/15: Define the annotation-function in terms of the affixation-function, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia a35476942f 11/15: Hack in better alignment support, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 87e03d7d39 06/15: Inline marginalia--context, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 0bca060531 07/15: Minor simplification, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia a21f59a077 10/15: Extract marginalia--affixate, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 80a03d480f 08/15: Simplification, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia ebc6edc2f7 14/15: Perfect the file annotation alignment,
ELPA Syncer <=
- [elpa] externals/marginalia fa48dbe318 05/15: Remove unnecessary concat, ELPA Syncer, 2022/01/09