[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/emoji b2e2caf: Don't have the search bug out on ret
From: |
Lars Ingebrigtsen |
Subject: |
scratch/emoji b2e2caf: Don't have the search bug out on ret |
Date: |
Thu, 28 Oct 2021 10:44:17 -0400 (EDT) |
branch: scratch/emoji
commit b2e2caf90dbe2f16177fa4d6bba2ff96970bcec5
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Don't have the search bug out on ret
---
lisp/play/emoji.el | 65 ++++++++++++++++++++++++++++--------------------------
1 file changed, 34 insertions(+), 31 deletions(-)
diff --git a/lisp/play/emoji.el b/lisp/play/emoji.el
index bbe770d..695d493 100644
--- a/lisp/play/emoji.el
+++ b/lisp/play/emoji.el
@@ -518,37 +518,40 @@ 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
- "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)
- ;; Simple glyph with no derivations.
- (progn
- (emoji--add-recent glyph)
- (insert glyph))
- ;; Choose a derived version.
- (let ((emoji--done-derived (make-hash-table :test #'equal)))
- (setf (gethash glyph emoji--done-derived) t)
- (funcall
- (emoji--define-transient
- (cons "Choose Emoji" (cons glyph derived)))))))))
+ (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)))
+ nil t)))
+ (when (plusp (length name))
+ (let* ((glyph (gethash name names))
+ (derived (gethash glyph emoji--derived)))
+ (if (not derived)
+ ;; Simple glyph with no derivations.
+ (progn
+ (emoji--add-recent glyph)
+ (insert glyph))
+ ;; Choose a derived version.
+ (let ((emoji--done-derived (make-hash-table :test #'equal)))
+ (setf (gethash glyph emoji--done-derived) t)
+ (funcall
+ (emoji--define-transient
+ (cons "Choose Emoji" (cons glyph derived)))))))))))
(provide 'emoji)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scratch/emoji b2e2caf: Don't have the search bug out on ret,
Lars Ingebrigtsen <=