[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia 1a2495203d 15/15: Colorize truncation ellips
From: |
ELPA Syncer |
Subject: |
[elpa] externals/marginalia 1a2495203d 15/15: Colorize truncation ellipsis |
Date: |
Sun, 9 Jan 2022 15:57:54 -0500 (EST) |
branch: externals/marginalia
commit 1a2495203d798e5c69aaac82f39e047de8de5092
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Colorize truncation ellipsis
---
marginalia.el | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index 76b9501b90..ca6bc24b7c 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -345,14 +345,22 @@ for performance profiling of the annotators.")
(defvar marginalia--metadata nil
"Completion metadata from the current completion.")
+(defvar truncate-string-ellipsis)
(defun marginalia--truncate (str width)
"Truncate string STR to WIDTH."
(when (floatp width) (setq width (round (* width marginalia-field-width))))
(when-let (pos (string-match-p "\n" str))
(setq str (substring str 0 pos)))
- (if (< width 0)
- (nreverse (truncate-string-to-width (reverse str) (- width) 0 ?\s t))
- (truncate-string-to-width str width 0 ?\s t)))
+ (let ((truncated (if (< width 0)
+ (nreverse (truncate-string-to-width (reverse str) (-
width) 0 ?\s t))
+ (truncate-string-to-width str width 0 ?\s t))))
+ (when (string-suffix-p truncate-string-ellipsis truncated)
+ (let* ((end (length truncated))
+ (beg (- end 1 (length truncate-string-ellipsis)))
+ (face (get-text-property beg 'face truncated)))
+ (when face
+ (put-text-property beg end 'face face truncated))))
+ truncated))
(cl-defmacro marginalia--field (field &key truncate face width)
"Format FIELD as a string according to some options.
@@ -367,10 +375,12 @@ FACE is the name of the face, with which the field should
be propertized."
(defmacro marginalia--fields (&rest fields)
"Format annotation FIELDS as a string with separators in between."
- `(concat #(" " 1 2 (marginalia--align t))
- ,@(cdr (mapcan (lambda (field)
- (list 'marginalia-separator `(marginalia--field
,@field)))
- fields))))
+ `(concat
+ #(" " 0 1 (marginalia--align t))
+ marginalia-separator
+ ,@(cdr (mapcan (lambda (field)
+ (list 'marginalia-separator `(marginalia--field ,@field)))
+ fields))))
(defun marginalia--documentation (str)
"Format documentation string STR."
@@ -728,8 +738,7 @@ The string is transformed according to
`marginalia-bookmark-type-transformers'."
((marginalia--bookmark-type bm) :width 10 :face 'marginalia-type)
((bookmark-get-filename bm)
:truncate -0.5 :face 'marginalia-file-name)
- ((if (or (not front) (string= front ""))
- ""
+ ((unless (or (not front) (string= front ""))
(concat (string-trim
(replace-regexp-in-string
"[ \t]+" " "
- [elpa] externals/marginalia updated (7782ebdd5c -> 1a2495203d), ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia e13d5ac71b 13/15: marginalia--field: Allow float value for :truncate, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 5a0678d88c 02/15: Deprecate marginalia-separator-threshold, ELPA Syncer, 2022/01/09
- [elpa] externals/marginalia 709ed9b97e 01/15: marginalia--field: Remove support for :format, ELPA Syncer, 2022/01/09
- [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 <=
- [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, 2022/01/09
- [elpa] externals/marginalia fa48dbe318 05/15: Remove unnecessary concat, ELPA Syncer, 2022/01/09