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

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

[nongnu] elpa/helm ba71560238 2/2: Truncate long buffer names


From: ELPA Syncer
Subject: [nongnu] elpa/helm ba71560238 2/2: Truncate long buffer names
Date: Sat, 26 Aug 2023 00:59:33 -0400 (EDT)

branch: elpa/helm
commit ba715602380efe758e3d1714106fc9e65ec8e793
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Truncate long buffer names
---
 helm-mode.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/helm-mode.el b/helm-mode.el
index 9d47705099..f6bda10ff8 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -1042,8 +1042,8 @@ should be specified as a string and the category as a 
symbol.")
 (defvar helm-completing-read--buffer-lgst-mode nil)
 (defun helm-completing-read-buffer-affixation (completions)
   (let ((len-mode (or helm-completing-read--buffer-lgst-mode
-                      (cl-loop for bname in completions
-                               maximize (with-current-buffer bname
+                      (cl-loop for bn in completions
+                               maximize (with-current-buffer bn
                                           (length (symbol-name 
major-mode)))))))
     (lambda (comp)
       (let* ((buf (get-buffer comp))
@@ -1060,9 +1060,12 @@ should be specified as a string and the category as a 
symbol.")
                      (propertize
                       (symbol-name major-mode) 'face 'font-lock-warning-face)))
              (size (helm-buffer-size buf))
-             (len (helm-in-buffer-get-longest-candidate))
+             (max-len helm-buffer-max-length)
+             (bname (truncate-string-to-width
+                     comp helm-buffer-max-length nil nil
+                     helm-buffers-end-truncated-string))
              (suffix (format "%s%s%s%s%s(in %s)"
-                             (make-string (1+ (- len (length comp))) ? )
+                             (make-string (1+ (- max-len (length bname))) ? )
                              (propertize size
                                          'face 'helm-buffer-size)
                              (make-string (- 7 (length size)) ? )
@@ -1077,7 +1080,7 @@ should be specified as a string and the category as a 
symbol.")
                                   (abbreviate-file-name default-directory))
                                 'face 'font-lock-doc-face)))))
         (list (propertize
-               comp 'face (if fname
+               bname 'face (if fname
                               'font-lock-builtin-face
                             'font-lock-doc-face))
               (propertize " " 'display prefix)



reply via email to

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