Subject: bug#52605: [PATCH] Add isearch-emoji-by-name

From: Daniel Martín <[email-masked]>
Date: Mon, 10 Jan 2022 23:44:46 +0100

Juri Linkov <[email-masked]> writes:

>
> I agree the input method is more general solution than a new isearch command.
>
> #+begin_src emacs-lisp
> ;;; emoji.el --- Quail package for emoji character composition -*- lexical-binding: t -*-
>
> ;; Quail package `emoji' is based on emoji.el package.
> ;; This input method supports the same key sequences as the names
> ;; defined by the `C-x 8 e s' completions in emoji.el.
>
> (quail-define-package
>  "emoji" "UTF-8" "😀" t
>  "Use the same key sequences as in `C-x 8 e s' completions defined in emoji.el."
>  '(("\t" . quail-completion))
>  t nil nil nil nil nil nil nil nil t)
>
> (eval-when-compile
>   (require 'emoji)
>   (emoji--init)
>   (defmacro emoji--define-rules ()
>     `(quail-define-rules
>       ,@(let ((rules nil))
>           (maphash (lambda (from to)
>                      (push (list from (if (stringp to)
>                                           (vector to)
>                                         to))
>                            rules))
>                    emoji--all-bases)
>           rules))))
>
> (emoji--define-rules)
>
> (provide 'emoji)
> ;;; emoji.el ends here
> #+end_src

Thanks for the patch, I'm not super familiar with input methods, but it
seems to work well.  I wish a refined/polished version of this code +
documentation could be part of the main Emacs distribution.  It fits
well in the overall design of Emacs.