From e9299297f9cc1aafda62deb8af7957dc8d56dc04 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Wed, 13 Oct 2021 18:24:39 +0200 Subject: [PATCH] (fix)completion: annotation fixes (#1904) * (fix)Formatter: Ensure that strings are always padded up to the field width * (feat)Colorize tags by default with org-tag face --- org-roam-node.el | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/org-roam-node.el b/org-roam-node.el index 4670caa..ffeb77a 100644 --- a/org-roam-node.el +++ b/org-roam-node.el @@ -37,7 +37,7 @@ ;;; Options ;;;; Completing-read (defcustom org-roam-node-display-template - "${title:*} ${tags:10}" + (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)) "Configures display formatting for Org-roam node. Patterns of form \"${field-name:length}\" are interpolated based on the current node. @@ -532,11 +532,7 @@ Uses `org-roam-node-display-template' to format the entry." (- width tmpl-width)) ((>= (string-to-number field-width) 0) (string-to-number field-width)))) - ;; Setting the display (which would be padded out to the field length) for an - ;; empty string results in an empty string and misalignment for candidates that - ;; don't have some field. This uses the actual display string, made of spaces - ;; when the field-value is "" so that we actually take up space. - (unless (or (not field-width) (equal field-value "")) + (when field-width (let* ((truncated (truncate-string-to-width field-value field-width 0 ?\s)) (tlen (length truncated)) (len (length field-value)))