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

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

[nongnu] elpa/helm 0d85fde7a3 1/2: Prettify helm-mode-all-the-icons-hand


From: ELPA Syncer
Subject: [nongnu] elpa/helm 0d85fde7a3 1/2: Prettify helm-mode-all-the-icons-handler
Date: Mon, 19 Jun 2023 16:02:22 -0400 (EDT)

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

    Prettify helm-mode-all-the-icons-handler
    
    Align everything properly.
---
 helm-mode.el | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/helm-mode.el b/helm-mode.el
index 5f4b88c351..906d67289d 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -1126,11 +1126,23 @@ This handler uses dynamic matching which allows 
honouring `completion-styles'."
                                         init hist default inherit-input-method
                                         name buffer)
   "A special `completing-read' handler for `all-the-icons-insert'."
-  (let ((cands (cl-loop for (desc . str) in collection
-                        collect (cons (concat str
-                                              " "
-                                              (substring-no-properties desc))
-                                      desc))))
+  (let* ((max-len 0)
+         (cands (cl-loop for (desc . str) in collection
+                         for descnp = (substring-no-properties desc)
+                         for sdesc = (when (string-match
+                                            
"\\(.*\\)[[:blank:]]+\\(\\[.*\\]\\)" descnp)
+                                       (match-string 1 descnp))
+                         for sdesc2 = (match-string 2 descnp)
+                         do (setq max-len (max max-len (string-width sdesc)))
+                         collect (cons (concat sdesc " " str " " sdesc2) 
desc)))
+         (fn (lambda ()
+               (with-helm-buffer
+                 (save-excursion
+                   (goto-char (point-min))
+                   (helm-skip-header-and-separator-line 'next)
+                   (while (re-search-forward "^[[:alnum:]_-]+" nil t)
+                     (insert (make-string (- max-len (current-column)) ? 
)))))))
+         (helm-after-update-hook (append helm-after-update-hook `(,fn))))
     (helm-completing-read-default-1 prompt cands test require-match
                                     init hist default inherit-input-method
                                     name buffer t nil t 'buffer-substring)))



reply via email to

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