emacs-diffs
[Top][All Lists]
Advanced

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

scratch/emoji f3610ee: Display glyphs in the search command when TAB-ing


From: Lars Ingebrigtsen
Subject: scratch/emoji f3610ee: Display glyphs in the search command when TAB-ing
Date: Thu, 28 Oct 2021 10:31:04 -0400 (EDT)

branch: scratch/emoji
commit f3610ee8227024d86de00b26d8e26e6de78bbc49
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Display glyphs in the search command when TAB-ing
---
 lisp/play/emoji.el | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/lisp/play/emoji.el b/lisp/play/emoji.el
index 18f2a5b..bbe770d 100644
--- a/lisp/play/emoji.el
+++ b/lisp/play/emoji.el
@@ -518,7 +518,24 @@ We prefer the earliest unique letter."
         (when-let ((name (emoji--name char)))
           (setf (gethash (downcase name) names) char))))
     ;; Use the list of names.
-    (let* ((name (completing-read "Emoji: " names nil t))
+    (let* ((name
+            (completing-read
+             "Insert emoji: "
+             (lambda (string pred action)
+              (if (eq action 'metadata)
+                  (list 'metadata
+                        (cons
+                          'affixation-function
+                          ;; Add the glyphs to the start of the
+                          ;; displayed strings when TAB-ing.
+                          (lambda (strings)
+                            (mapcar
+                             (lambda (name)
+                               (list name
+                                     (concat (or (gethash name names) " ") 
"\t")
+                                     ""))
+                             strings))))
+                (complete-with-action action names string pred)))))
            (glyph (gethash name names))
            (derived (gethash glyph emoji--derived)))
       (if (not derived)



reply via email to

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