From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#52605: [PATCH] Add isearch-emoji-by-name Date: Sun, 19 Dec 2021 01:48:31 +0100 Message-ID: References: <83lf0hag05.fsf@gnu.org> Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40434"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin) Cc: 52605@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 19 01:49:24 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mykO9-000ADI-NM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 19 Dec 2021 01:49:22 +0100 Original-Received: from localhost ([::1]:45998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mykO8-000390-Gd for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Dec 2021 19:49:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mykNq-00038n-F5 for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 19:49:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32988) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mykNq-0002xH-7G for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 19:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mykNq-0004VE-3E for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 19:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 19 Dec 2021 00:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52605 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52605-submit@debbugs.gnu.org id=B52605.163987492517285 (code B ref 52605); Sun, 19 Dec 2021 00:49:02 +0000 Original-Received: (at 52605) by debbugs.gnu.org; 19 Dec 2021 00:48:45 +0000 Original-Received: from localhost ([127.0.0.1]:44534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mykNZ-0004Uj-3w for submit@debbugs.gnu.org; Sat, 18 Dec 2021 19:48:45 -0500 Original-Received: from sonic312-27.consmr.mail.ir2.yahoo.com ([77.238.178.98]:41115) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mykNX-0004UW-VT for 52605@debbugs.gnu.org; Sat, 18 Dec 2021 19:48:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1639874917; bh=4JXGUx2+fuIF0f2jiEh1SZHgN+7vwrxxvZsW5HkfwcM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=aSrIz+GSWJiasYgj38529u2iFQLHpyvZ69cdm73wTuqsXhqjDFHNxSzB4UfZZuGt8kvRv3uwQMQM6YiBWKnpuMkzPTQVkOdCYIHNQTgYd00XNhVa0Wuj5BPRrNROCIJm08Wiuk5IkYb12fTof/Jrtp4EoXz5a5GWleiT0BUish7bk+ZUFLB1GvI4rz3UY9RspRRMtO3C7JtvfThnya42OyPhLp4y4gX66riWaHLNpKQkZKJgG+W7aghrl9hxTKZ4aFHbqoYJ4KAc3C4rbcF1WAUKEYplIWitJMsd3Z1ygtqUCifNW7Y8yTNzAveMRzBtoHd4B+updFDjFwDjbjT/KQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1639874917; bh=ZJOsH1uNxrgqJt79TClFx378onSd6kiV5elGFyrqLyl=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Zc2pTjMj7KZL/WhEyQhjs7dfgNJX+LVrX+Bo4rCYQRQBl1zqVwKRoNSso+MTpVydN9uz5KJVeBr6WAF2zyUF5IpI2H5QRFwdpJMSTmvthgLAVnX6Fl+9Ui6i+Cjh2cosp7ofz5DpR/UbmGB3qSRjeS9xfNWyxvc69dPqEolsVk+hLjTgvY9Ckz6k8N0PQVaOmZ5k50aRxZ/xG9MjlTYovgUWyTKOtSr6yMtNH7yXsuBol4OxIgnvxqF7uyneuPB1DftPFW8NdU3/mww6htmriCvJfcMCHxdL+54lN2RxdJxf3Slmh6h0ADhXlfMCsLosIhEBQX3xCC4Wl06sRv0J2g== X-YMail-OSG: XlQ3a40VM1lmJxAff4drObQHFoPekGTc9Hp0HqvjRZK6gQsYFOdEDMGfk.L7GNX hGBlFnm4XqK.w2ZSgKpgMucqCHimAtea4yrdw1QHsLbPNEmcXxNYHNAO1sZRTijradDjlKFztN4o l3FaT2JSeIjxq3WiTfiqZc3qw9n6FCS5QjX8TECroGT4Dsi4NHevEEE5VuMohG1ihyAHFLn44oym _B72c14G_t4f3d9L7M36jDGk4kAAhXW8IjXQhT08ym63HMvFhVYhZoMGThvt0Yz4nLZkxFc3wo.b b4FpTFtsHVqhsmFYxB7hsVq96Ec2ftzPHd8jcnrwYza9bm4zLeGhV9RehlMR6GXmB9Yfv30Q6.0R QLC5EawRuPgG4nneJZ30dwrv5enuEd.jfmkvBBkNpTfBIM.VO.a4eNWKx.PDj8RdHZtZfZmqGeMs ciXqt72m3b0I9a0sK383YPpbGgpMP7NsTgtgYV7RNSssV4NLRM3mTOIDQItboVBWn0T_flW8nbqp x48gBsduPgEi8.xr0l7QZs3pAKUUSqAj6r7UNNpFZq25sHJJj7OKPNAKsS8YVJPwlcAC9tmZi7HK Ed2rzBkIPF_5remDMb4tQSs9lwlveJOn6.EUZRP7NuzW1ZsohqVtbI6HtJm.RfBsXso7WwP80psR .mPVdIHUniuL0MIou02ThYCg7G1AGidyzrt6qeA.bKIahspub92rbZuqKbzr2rytiZL4NdIYdvXv UMgKko8nbwuKofSr8C5yN5ORPT6hfDKwH6iA.514qnAi2HTIiVRPf3QuOKCfdlihH2BEOsQtQsLk ZJON0ABu_U2z8QNb.EM53QqWHCwLdFMnXBdRsaa1L4 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ir2.yahoo.com with HTTP; Sun, 19 Dec 2021 00:48:37 +0000 Original-Received: by kubenode507.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID b9d03963d4b6af30b5bcae3c4ec8dd5b; Sun, 19 Dec 2021 00:48:31 +0000 (UTC) In-Reply-To: <83lf0hag05.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Dec 2021 21:07:38 +0200") X-Mailer: WebService/1.1.19415 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222628 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-isearch-emoji-by-name.patch >From bee4f93018a15202769938f112bf76ecc8bfcd53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= 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 --=-=-=--