unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52605: [PATCH] Add isearch-emoji-by-name
       [not found] <m135mpyc8p.fsf.ref@yahoo.es>
@ 2021-12-18 18:55 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-18 19:07   ` Eli Zaretskii
  2021-12-19 11:10   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-18 18:55 UTC (permalink / raw)
  To: 52605

[-- Attachment #1: Type: text/plain, Size: 719 bytes --]


This patch adds support for searching a buffer for Emojis without
needing to copy and paste them from another buffer or leaving isearch.
Isearch already provides some methods to search for non-ASCII
characters, so I decided to extend the package to search for Emoji as
well.

With this patch, during an incremental search, if you press 'C-x 8 e
RET', it will ask you for an Emoji character by name and insert it into
the search string.  A prefix argument N will insert N copies of the
character.

If you agree that this feature is sound and makes sense, please review
it and send me feedback or install it for me (I don't have commit
rights).  Perhaps a similar feature is also needed for query and
replace.

Thanks.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-isearch-emoji-by-name.patch --]
[-- Type: text/x-patch, Size: 3588 bytes --]

From a899d6199d27ffefd01b764da9c7f37bb11466f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
Date: Sat, 18 Dec 2021 19:29:50 +0100
Subject: [PATCH] Add isearch-emoji-by-name

* lisp/isearch.el (isearch-emoji-by-name): Add a new command to insert
Emoji characters into incremental search strings.
(isearch-mode-map): Bind it to 'C-x 8 e RET'.
(isearch-menu-bar-map): Add it to the menu bar.
* doc/emacs/search.texi (Special Isearch): Update the documentation to
mention the new command.
* etc/NEWS: And advertise it.
---
 doc/emacs/search.texi |  7 +++++++
 etc/NEWS              |  5 +++++
 lisp/isearch.el       | 19 +++++++++++++++++++
 3 files changed, 31 insertions(+)

diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index fbbb1f6e68..59f6551815 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -443,6 +443,13 @@ Special Isearch
 character into the search string, similar to the usual
 @code{insert-char} command (@pxref{Inserting Text}).
 
+@item
+@findex isearch-emoji-by-name
+@kindex C-x 8 e RET @r{(Incremental Search)}
+Type @kbd{C-x 8 e @key{RET}} (@code{isearch-emoji-by-name}), followed
+by the name of an Emoji.  This adds the specified Emoji into the
+search string.
+
 @item
 @kindex C-^ @r{(Incremental Search)}
 @findex isearch-toggle-input-method
diff --git a/etc/NEWS b/etc/NEWS
index e3665b918a..07f498dab3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -341,6 +341,11 @@ received.
 
 *** New user option 'char-fold-override' omits the default character-folding.
 
++++
+*** New command 'isearch-emoji-by-name'.
+It is bound to 'C-x 8 e RET' during an incremental search and it
+inserts an Emoji character into the search string.
+
 ** New minor mode 'glyphless-display-mode'.
 This allows an easy way to toggle seeing all glyphless characters in
 the current buffer.
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 8815cb4f2d..18ef101fc0 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -668,6 +668,7 @@ isearch-mode-map
     ;; The key translations defined in the C-x 8 prefix should add
     ;; characters to the search string.  See iso-transl.el.
     (define-key map "\C-x8\r" 'isearch-char-by-name)
+    (define-key map "\C-x8e\r" 'isearch-emoji-by-name)
     map)
   "Keymap for `isearch-mode'.")
 
@@ -758,6 +759,8 @@ isearch-menu-bar-map
      :help "Search for literal char"]
     ["Search for char by name" isearch-char-by-name
      :help "Search for character by name"]
+    ["Search for Emoji by name" isearch-emoji-by-name
+     :help "Search for Emoji by name"]
     "---"
     ["Toggle input method" isearch-toggle-input-method
      :help "Toggle input method for search"]
@@ -2747,6 +2750,22 @@ isearch-char-by-name
 					   (mapconcat 'isearch-text-char-description
 						      string ""))))))))
 
+(defun isearch-emoji-by-name (&optional count)
+  "Read an Emoji and add it to the search string.
+With argument, add COUNT copies of the Emoji."
+  (interactive "p")
+  (with-isearch-suspended
+   (let ((emoji (with-temp-buffer
+                  (emoji-search)
+                  (if (and (integerp count) (> count 1))
+                      (apply 'concat (make-list count (buffer-string)))
+                    (buffer-string)))))
+     (when emoji
+       (setq isearch-new-string (concat isearch-string emoji)
+             isearch-new-message (concat isearch-message
+					   (mapconcat 'isearch-text-char-description
+						      emoji "")))))))
+
 (defun isearch-search-and-update ()
   "Do the search and update the display."
   (when (or isearch-success
-- 
2.31.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2021-12-18 18:55 ` bug#52605: [PATCH] Add isearch-emoji-by-name Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-18 19:07   ` Eli Zaretskii
  2021-12-19  0:48     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-19 11:10   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2021-12-18 19:07 UTC (permalink / raw)
  To: Daniel Martín; +Cc: 52605

> Date: Sat, 18 Dec 2021 19:55:02 +0100
> From:  Daniel Martín via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> This patch adds support for searching a buffer for Emojis without
> needing to copy and paste them from another buffer or leaving isearch.
> Isearch already provides some methods to search for non-ASCII
> characters, so I decided to extend the package to search for Emoji as
> well.
> 
> With this patch, during an incremental search, if you press 'C-x 8 e
> RET', it will ask you for an Emoji character by name and insert it into
> the search string.  A prefix argument N will insert N copies of the
> character.

Thanks.

> +@item
> +@findex isearch-emoji-by-name
> +@kindex C-x 8 e RET @r{(Incremental Search)}
> +Type @kbd{C-x 8 e @key{RET}} (@code{isearch-emoji-by-name}), followed
> +by the name of an Emoji.  This adds the specified Emoji into the
> +search string.

This should explain what kind of "emoji names" the feature accepts.
It is entirely unclear from the text.

> +*** New command 'isearch-emoji-by-name'.
> +It is bound to 'C-x 8 e RET' during an incremental search and it
> +inserts an Emoji character into the search string.

Likewise here.  The NEWS entry doesn't even mention that Emoji are
specified by their names.

> +(defun isearch-emoji-by-name (&optional count)
> +  "Read an Emoji and add it to the search string.

  "Read and Emoji name and add it to the search string."

Likewise here, the doc string should clarify what kind of names are
acceptable.  I would also mention that completion is provided while
typing the name.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2021-12-18 19:07   ` Eli Zaretskii
@ 2021-12-19  0:48     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-19  6:53       ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-19  0:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52605

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> +@item
>> +@findex isearch-emoji-by-name
>> +@kindex C-x 8 e RET @r{(Incremental Search)}
>> +Type @kbd{C-x 8 e @key{RET}} (@code{isearch-emoji-by-name}), followed
>> +by the name of an Emoji.  This adds the specified Emoji into the
>> +search string.
>
> This should explain what kind of "emoji names" the feature accepts.
> It is entirely unclear from the text.
>
>> +*** New command 'isearch-emoji-by-name'.
>> +It is bound to 'C-x 8 e RET' during an incremental search and it
>> +inserts an Emoji character into the search string.
>
> Likewise here.  The NEWS entry doesn't even mention that Emoji are
> specified by their names.
>
>> +(defun isearch-emoji-by-name (&optional count)
>> +  "Read an Emoji and add it to the search string.
>
>   "Read and Emoji name and add it to the search string."
>
> Likewise here, the doc string should clarify what kind of names are
> acceptable.  I would also mention that completion is provided while
> typing the name.

If I'm not mistaken, what the new emoji-search command accepts is
technically the CLDR short name of an Emoji.  As the term is a bit
obscure, I've added a few examples to the documentation.  I've also
updated the prompt in emoji-search, so now it explains in parenthesis
what you can type, in a similar way as classic 'C-x 8 RET'.

That is, 'C-x 8 RET' prompts with:

  Insert character (Unicode name or hex):

And now 'C-x 8 e s' prompts with:

  Insert emoji (CLDR short name):

Attached a new patch, I'm not sure if that's what you asked for.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-isearch-emoji-by-name.patch --]
[-- Type: text/x-patch, Size: 4971 bytes --]

From bee4f93018a15202769938f112bf76ecc8bfcd53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
Date: Sat, 18 Dec 2021 19:29:50 +0100
Subject: [PATCH] Add isearch-emoji-by-name

* lisp/isearch.el (isearch-emoji-by-name): Add a new command to insert
Emoji characters into incremental search strings. (Bug#52605)
(isearch-mode-map): Bind it to 'C-x 8 e RET'.
(isearch-menu-bar-map): Add it to the menu bar.
* lisp/international/emoji.el (emoji--choose-emoji): Expand the prompt
to say that the CLDR short name of an Emoji is expected.
* doc/emacs/search.texi (Special Isearch): Update the documentation to
mention the new command.
* etc/NEWS: And advertise it.
---
 doc/emacs/search.texi       |  8 ++++++++
 etc/NEWS                    |  7 +++++++
 lisp/international/emoji.el |  6 ++++--
 lisp/isearch.el             | 21 +++++++++++++++++++++
 4 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index fbbb1f6e68..6c15c33e21 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -443,6 +443,14 @@ Special Isearch
 character into the search string, similar to the usual
 @code{insert-char} command (@pxref{Inserting Text}).
 
+@item
+@findex isearch-emoji-by-name
+@kindex C-x 8 e RET @r{(Incremental Search)}
+Type @kbd{C-x 8 e @key{RET}} (@code{isearch-emoji-by-name}), followed
+by the CLDR short name of an Emoji (for example, @samp{smiling face}
+or @samp{heart with arrow}).  This adds the specified Emoji into the
+search string.
+
 @item
 @kindex C-^ @r{(Incremental Search)}
 @findex isearch-toggle-input-method
diff --git a/etc/NEWS b/etc/NEWS
index e3665b918a..b76de35958 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -341,6 +341,13 @@ received.
 
 *** New user option 'char-fold-override' omits the default character-folding.
 
++++
+*** New command 'isearch-emoji-by-name'.
+It is bound to 'C-x 8 e RET' during an incremental search.  The
+command accepts the CLDR short name of an Emoji (for example, "smiling
+face" or "heart with arrow"), with minibuffer completion, and inserts
+the Emoji character into the search string.
+
 ** New minor mode 'glyphless-display-mode'.
 This allows an easy way to toggle seeing all glyphless characters in
 the current buffer.
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index a4dec973fb..9d87c4febd 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -88,7 +88,9 @@ emoji-recent
 
 ;;;###autoload
 (defun emoji-search ()
-  "Choose and insert an emoji glyph by searching for an emoji name."
+  "Choose and insert an emoji glyph by searching for an emoji name.
+The command accepts CLDR short names like 'smiling face' or
+'heart with arrow' and completion is available."
   (interactive "*")
   (emoji--init)
   (emoji--choose-emoji))
@@ -612,7 +614,7 @@ emoji--choose-emoji
   ;; Use the list of names.
   (let ((name
          (completing-read
-          "Insert emoji: "
+          "Insert emoji (CLDR short name): "
           (lambda (string pred action)
 	    (if (eq action 'metadata)
 		(list 'metadata
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 8815cb4f2d..af4130a75e 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -668,6 +668,7 @@ isearch-mode-map
     ;; The key translations defined in the C-x 8 prefix should add
     ;; characters to the search string.  See iso-transl.el.
     (define-key map "\C-x8\r" 'isearch-char-by-name)
+    (define-key map "\C-x8e\r" 'isearch-emoji-by-name)
     map)
   "Keymap for `isearch-mode'.")
 
@@ -758,6 +759,8 @@ isearch-menu-bar-map
      :help "Search for literal char"]
     ["Search for char by name" isearch-char-by-name
      :help "Search for character by name"]
+    ["Search for Emoji by name" isearch-emoji-by-name
+     :help "Search for Emoji by name"]
     "---"
     ["Toggle input method" isearch-toggle-input-method
      :help "Toggle input method for search"]
@@ -2747,6 +2750,24 @@ isearch-char-by-name
 					   (mapconcat 'isearch-text-char-description
 						      string ""))))))))
 
+(defun isearch-emoji-by-name (&optional count)
+  "Read an Emoji name and add it to the search string.
+The command accepts CLDR short names like 'smiling face' or
+'heart with arrow' and completion is available.  With argument,
+add COUNT copies of the Emoji."
+  (interactive "p")
+  (with-isearch-suspended
+   (let ((emoji (with-temp-buffer
+                  (emoji-search)
+                  (if (and (integerp count) (> count 1))
+                      (apply 'concat (make-list count (buffer-string)))
+                    (buffer-string)))))
+     (when emoji
+       (setq isearch-new-string (concat isearch-string emoji)
+             isearch-new-message (concat isearch-message
+					   (mapconcat 'isearch-text-char-description
+						      emoji "")))))))
+
 (defun isearch-search-and-update ()
   "Do the search and update the display."
   (when (or isearch-success
-- 
2.31.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2021-12-19  0:48     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-19  6:53       ` Eli Zaretskii
  2021-12-19 11:47         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2021-12-19  6:53 UTC (permalink / raw)
  To: Daniel Martín; +Cc: 52605

> From: Daniel Martín <mardani29@yahoo.es>
> Cc: 52605@debbugs.gnu.org
> Date: Sun, 19 Dec 2021 01:48:31 +0100
> 
> > Likewise here, the doc string should clarify what kind of names are
> > acceptable.  I would also mention that completion is provided while
> > typing the name.
> 
> If I'm not mistaken, what the new emoji-search command accepts is
> technically the CLDR short name of an Emoji.  As the term is a bit
> obscure, I've added a few examples to the documentation.

I think examples are good, but they are not enough.  We should point
to the document which defines these names somewhere, I guess in the
manual.  Where did you see that terminology ("CLDR names"), and what
is the definitive document for it?

> And now 'C-x 8 e s' prompts with:
> 
>   Insert emoji (CLDR short name):

Is the "short" part necessary?  It immediately begs the question "how
does that differ from a long name?"

Btw, the same problem exists in doc strings in emoji.el.  I tried to
improve that yesterday, but it sounds like I understood the "name"
part incorrectly, so it will need another round of changes.

Thanks.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2021-12-18 18:55 ` bug#52605: [PATCH] Add isearch-emoji-by-name Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-18 19:07   ` Eli Zaretskii
@ 2021-12-19 11:10   ` Lars Ingebrigtsen
  2022-01-09 21:56     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-19 11:10 UTC (permalink / raw)
  To: Daniel Martín; +Cc: 52605

Daniel Martín <mardani29@yahoo.es> writes:

> With this patch, during an incremental search, if you press 'C-x 8 e
> RET', it will ask you for an Emoji character by name and insert it into
> the search string.  A prefix argument N will insert N copies of the
> character.

Makes sense to me.

Eli Zaretskii <eliz@gnu.org> writes:

> Btw, the same problem exists in doc strings in emoji.el.  I tried to
> improve that yesterday, but it sounds like I understood the "name"
> part incorrectly, so it will need another round of changes.

The names are from Unicode, but are from a separate data source than the
"official" ones, if I understand it correctly.  See
admin/unidata/emoji-test.txt.

And I don't think we need to specify what these names are, and we
certainly don't need to mention CLDR.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2021-12-19  6:53       ` Eli Zaretskii
@ 2021-12-19 11:47         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-12-19 11:47 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 52605

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Daniel Martín <mardani29@yahoo.es>
>> Cc: 52605@debbugs.gnu.org
>> Date: Sun, 19 Dec 2021 01:48:31 +0100
>> 
>> > Likewise here, the doc string should clarify what kind of names are
>> > acceptable.  I would also mention that completion is provided while
>> > typing the name.
>> 
>> If I'm not mistaken, what the new emoji-search command accepts is
>> technically the CLDR short name of an Emoji.  As the term is a bit
>> obscure, I've added a few examples to the documentation.
>
> I think examples are good, but they are not enough.  We should point
> to the document which defines these names somewhere, I guess in the
> manual.  Where did you see that terminology ("CLDR names"), and what
> is the definitive document for it?

I took the term from the Unicode website:
https://unicode.org/emoji/charts/full-emoji-list.html (last column).
Those are the strings that emoji-search autocompletes.

>
> Btw, the same problem exists in doc strings in emoji.el.  I tried to
> improve that yesterday, but it sounds like I understood the "name"
> part incorrectly, so it will need another round of changes.
>

I see your point, but I don't know a better term to refer to an "Emoji
name".  I think people using other platforms with Emoji support, like a
mobile phone, are used to type things like "grinning face" in a text box
and see the corresponding Emoji suggestion to replace the text with,
right in the phone's keyboard.

Linking to https://unicode.org/emoji/charts/full-emoji-list.html from
the docstring (if the information there is considered stable) might be a
good idea.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2021-12-19 11:10   ` Lars Ingebrigtsen
@ 2022-01-09 21:56     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-10  8:07       ` Juri Linkov
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-09 21:56 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52605

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Daniel Martín <mardani29@yahoo.es> writes:
>
>> With this patch, during an incremental search, if you press 'C-x 8 e
>> RET', it will ask you for an Emoji character by name and insert it into
>> the search string.  A prefix argument N will insert N copies of the
>> character.
>
> Makes sense to me.
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
>> Btw, the same problem exists in doc strings in emoji.el.  I tried to
>> improve that yesterday, but it sounds like I understood the "name"
>> part incorrectly, so it will need another round of changes.
>
> The names are from Unicode, but are from a separate data source than the
> "official" ones, if I understand it correctly.  See
> admin/unidata/emoji-test.txt.
>
> And I don't think we need to specify what these names are, and we
> certainly don't need to mention CLDR.

How should I update my patch? It's not clear to me if there is a
decision about how to change the wording of the Emoji prompts.

Also, I forgot to ask in my original message: Is there a plan to add an
Emoji input method to Emacs? If so, the input method could be used
during an isearch and this patch won't be necessary, right? Another
benefit of the input method is that it will work in other situations as
well, like in a query-replace.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2022-01-09 21:56     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-10  8:07       ` Juri Linkov
  2022-01-10 22:44         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Juri Linkov @ 2022-01-10  8:07 UTC (permalink / raw)
  To: 52605; +Cc: larsi, mardani29

> Also, I forgot to ask in my original message: Is there a plan to add an
> Emoji input method to Emacs? If so, the input method could be used
> during an isearch and this patch won't be necessary, right? Another
> benefit of the input method is that it will work in other situations as
> well, like in a query-replace.

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





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2022-01-10  8:07       ` Juri Linkov
@ 2022-01-10 22:44         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-01-12  6:02           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-10 22:44 UTC (permalink / raw)
  To: Juri Linkov; +Cc: larsi, 52605

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2022-01-10 22:44         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-12  6:02           ` Lars Ingebrigtsen
  2022-01-12 17:50             ` Juri Linkov
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-12  6:02 UTC (permalink / raw)
  To: Daniel Martín; +Cc: 52605, Juri Linkov

Daniel Martín <mardani29@yahoo.es> writes:

> 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.

Using an input method works fine, but I don't think it's something most
people would find convenient to use.  (My guess is that most people
outside Asian locales don't use the input method machinery at all.)

So I think we should add both Juri's and Daniel's patches here.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2022-01-12  6:02           ` Lars Ingebrigtsen
@ 2022-01-12 17:50             ` Juri Linkov
  2022-01-13  6:05               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Juri Linkov @ 2022-01-12 17:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 52605, Daniel Martín

>> 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.
>
> Using an input method works fine, but I don't think it's something most
> people would find convenient to use.  (My guess is that most people
> outside Asian locales don't use the input method machinery at all.)
>
> So I think we should add both Juri's and Daniel's patches here.

So I pushed both patches.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#52605: [PATCH] Add isearch-emoji-by-name
  2022-01-12 17:50             ` Juri Linkov
@ 2022-01-13  6:05               ` Lars Ingebrigtsen
  0 siblings, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-13  6:05 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 52605, Daniel Martín

Juri Linkov <juri@linkov.net> writes:

>> So I think we should add both Juri's and Daniel's patches here.
>
> So I pushed both patches.

Thanks; seems to work well, so I'm closing this bug report, then.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-01-13  6:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m135mpyc8p.fsf.ref@yahoo.es>
2021-12-18 18:55 ` bug#52605: [PATCH] Add isearch-emoji-by-name Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-18 19:07   ` Eli Zaretskii
2021-12-19  0:48     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-19  6:53       ` Eli Zaretskii
2021-12-19 11:47         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-19 11:10   ` Lars Ingebrigtsen
2022-01-09 21:56     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-10  8:07       ` Juri Linkov
2022-01-10 22:44         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-12  6:02           ` Lars Ingebrigtsen
2022-01-12 17:50             ` Juri Linkov
2022-01-13  6:05               ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).