emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/annotate a572602101 094/372: - use 'window-body-width' to


From: ELPA Syncer
Subject: [nongnu] elpa/annotate a572602101 094/372: - use 'window-body-width' to truncate the string with an ellipse in a
Date: Fri, 4 Feb 2022 16:58:21 -0500 (EST)

branch: elpa/annotate
commit a57260210146de01363a28e3f22635500b11cc41
Author: cage <cage-invalid@invalid>
Commit: cage <cage-invalid@invalid>

    - use 'window-body-width' to truncate the  string with an ellipse in a
      summary  window, remove  the  customizable, but  static, max  length
      value.
---
 annotate.el | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/annotate.el b/annotate.el
index be31ad1bde..f5b95bf268 100644
--- a/annotate.el
+++ b/annotate.el
@@ -130,10 +130,11 @@ major mode is a member of this list (space separated 
entries)."
   :type  '(repeat symbol)
   :group 'annotate)
 
-(defcustom annotate-summary-link-max-width  64
-  "Cut the link text in a summary windows to this maximum size (in character)"
-  :type  'number
-  :group 'annotate)
+(defconst annotate-summary-list-prefix "- "
+  "The string used as prefix for each text annotation item in summary window")
+
+(defconst annotate-ellipse-text-marker "..."
+  "The string used when a string is truncated with an ellipse")
 
 (defun annotate-initialize-maybe ()
   "Initialize annotate mode only if buffer's major mode is not in the 
blacklist (see:
@@ -936,11 +937,18 @@ essentially what you get from:
   "Show a summary of all the annotations in a temp buffer"
   (interactive)
   (cl-labels ((ellipsize (text)
+                         (let ((prefix-length  (string-width 
annotate-summary-list-prefix))
+                               (ellipse-length (string-width 
annotate-ellipse-text-marker)))
                          (if (> (string-width text)
-                                annotate-summary-link-max-width)
-                             (concat (subseq text 0 (- 
annotate-summary-link-max-width 3))
-                                     "...")
-                           text)))
+                                (+ (window-body-width)
+                                   prefix-length
+                                   ellipse-length))
+                             (concat (subseq text 0
+                                             (- (window-body-width)
+                                                prefix-length
+                                                ellipse-length))
+                                     annotate-ellipse-text-marker)
+                             text))))
     (with-temp-buffer-window
      "*annotations*" nil nil
      (with-current-buffer "*annotations*"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]