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

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

[nongnu] elpa/helm f930dff6fe 3/3: Add a comp read handler for all-the-i


From: ELPA Syncer
Subject: [nongnu] elpa/helm f930dff6fe 3/3: Add a comp read handler for all-the-icons-insert
Date: Mon, 19 Jun 2023 07:25:53 -0400 (EDT)

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

    Add a comp read handler for all-the-icons-insert
---
 helm-mode.el | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/helm-mode.el b/helm-mode.el
index 9d24c39051..5f4b88c351 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -59,7 +59,8 @@
     (dired-do-hardlink . helm-read-file-name-handler-1)
     (basic-save-buffer . helm-read-file-name-handler-1)
     (write-file . (default helm-read-file-name-handler-1))
-    (write-region . (default helm-read-file-name-handler-1)))
+    (write-region . (default helm-read-file-name-handler-1))
+    (all-the-icons-insert . helm-mode-all-the-icons-handler))
   "Completing read functions for specific Emacs commands.
 
 By default `helm-mode' use `helm-completing-read-default-handler' to
@@ -1121,6 +1122,19 @@ This handler uses dynamic matching which allows 
honouring `completion-styles'."
          :must-match require-match)
       (setq helm-completion--sorting-done nil))))
 
+(defun helm-mode-all-the-icons-handler (prompt collection test require-match
+                                        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))))
+    (helm-completing-read-default-1 prompt cands test require-match
+                                    init hist default inherit-input-method
+                                    name buffer t nil t 'buffer-substring)))
+
 (defun helm-completing-read-default-find-tag
     (prompt collection test require-match
      init hist default inherit-input-method



reply via email to

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