bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Daniel Martín
Subject: bug#52605: [PATCH] Add isearch-emoji-by-name
Date: Mon, 10 Jan 2022 23:44:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)

Juri Linkov <juri@linkov.net> 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.




reply via email to

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