branch: elpa/helm commit 305f4d3c89c9a17f1a33eb23803a61e0c1123b79 Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Fix all-the-icons-insert handler when called with FAMILY arg This is the case for all the all-the-icons-insert-* functions. --- helm-mode.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/helm-mode.el b/helm-mode.el index 906d67289d..18b711f263 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -1128,10 +1128,15 @@ This handler uses dynamic matching which allows honouring `completion-styles'." "A special `completing-read' handler for `all-the-icons-insert'." (let* ((max-len 0) (cands (cl-loop for (desc . str) in collection + ;; When the FAMILY argument is passed to + ;; `all-the-icons-insert' DESC is the name of icon only + ;; otherwise it is "name [family]" with unpredictable + ;; spaces or tab numbers between name and [family]. for descnp = (substring-no-properties desc) - for sdesc = (when (string-match - "\\(.*\\)[[:blank:]]+\\(\\[.*\\]\\)" descnp) - (match-string 1 descnp)) + for sdesc = (if (string-match + "\\(.*\\)[[:blank:]]+\\(\\[.*\\]\\)" descnp) + (match-string 1 descnp) + descnp) for sdesc2 = (match-string 2 descnp) do (setq max-len (max max-len (string-width sdesc))) collect (cons (concat sdesc " " str " " sdesc2) desc)))