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: Sat, 18 Dec 2021 19:55:02 +0100 Message-ID: References: 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="13837"; mail-complaints-to="usenet@ciao.gmane.io" To: 52605@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 18 19:56:22 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 1myesW-0003O8-IR for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Dec 2021 19:56:21 +0100 Original-Received: from localhost ([::1]:58828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1myesV-0008Sn-Et for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Dec 2021 13:56:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myesP-0008Se-LY for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 13:56:13 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1myesE-0002gM-RR for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 13:56:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1myesE-0007tT-KR for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 13:56: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: Sat, 18 Dec 2021 18:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52605 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163985371530288 (code B ref -1); Sat, 18 Dec 2021 18:56:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Dec 2021 18:55:15 +0000 Original-Received: from localhost ([127.0.0.1]:43828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myerT-0007sR-Bs for submit@debbugs.gnu.org; Sat, 18 Dec 2021 13:55:15 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:60470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1myerR-0007sI-HX for submit@debbugs.gnu.org; Sat, 18 Dec 2021 13:55:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1myerR-0008QT-9x for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 13:55:13 -0500 Original-Received: from sonic309-25.consmr.mail.ir2.yahoo.com ([77.238.179.83]:42902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1myerO-000226-4a for bug-gnu-emacs@gnu.org; Sat, 18 Dec 2021 13:55:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1639853707; bh=RkPMyzOmZn5jMPgG2HHnBufwH9+SOfvQo+6LFs3mTxQ=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=TTvbp0tVwEn8GosCyWRJRV/pMMhVgNiJtmOPH7OLOHcHYx+7L7v3FpBP5QBy7N8NS8ayduU+bneuULTxdIf6Hpuc07HH5zwvyYoSQuTdSYyI8N4BJ1Uv1VJOH0W0YEbqYFoa4LJ3vjnTCuXQzr18V3UVEDykSQ8WNWmR50VfN05JeeoV7KKvh1R/mz5369ONKdfqWBsYtMq73zQgvoKHpGuYYlV8mjNx7eVMu17tiM/pOes0MvHBood/dxDpTgpZcMucdx/I7ght2/90iHtIE23lwxU5OBHy/m2TXjsAdSF0SWarDWNq0GIwCVEtwp9i8W4teQwhkHfhGjUgc4bAoQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1639853707; bh=XtlXn0NCcXbt08Bv4rcZLSxkQ2iApTHkzGhWPKq9fRR=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=KehRy2GKUMAMIbkHpXtoS4iKod3qahu9DCzu+Ctdy70px86r+j+omRpTjXATCcdOTRPl1DXsIp4abpSNBhBV0Go2NuS63TOuZoJv8JJ3Qr+EbPBYuiVEEw8xXp8spczOCSPk7X3X/Q2xik3Fv3dvVkjZ/L0YHqEu09h/ANElsn9w21wE+bBR3uhU9/aCswiwZU2xCokugss5F0EuJ2Effi47FpamPdgjHpqWF2gw90lrJg8EQGf1W2RlMgYNXlebkmRURp3yZiuitYF+xe559HQDMAJJiatIxq/rnQDBGtxMQfj4Asve6/mrwYJVgDN6EE0aqwMlcjalKAjJymzUIQ== X-YMail-OSG: EvhX4DkVM1lpt2_h961W_vEFnAy2ZZysI9Y5GJvUtFJ5MF.NVCxMh_siXBHdiH5 B39TeJa1PA7O_lEdpA7E5ZpM_EZa76r_pZH7ALIwSA3_use4CTJka3DTJoC.9Xx3QWyKu1ytQR2j OrJpLqozGmxc_W6kmRbOrfsRaI6f84ctn0Gr0h1W_zbTkcnxgUk0uSuzlStvXDkbKdffSqYTUkEL 43b3HYQV7vch4RRNN6S3AICLI_aT7fvJe5JQIIJ9BxJGfAri6opeBChZGA1cx1nPD0ZIMS1O2UYX Jwj3gUUg4bB48LGYoghacQVfQmLQLWMvsGgNaEXivLf7vkfJIUk2Vn6eDs6.n59MdQ0XfyuTotH. ZQNkRqwJGzOLcgdAk7EKh9Pt4F.hiXOgnBTk44LuaNADYvrZCFRXXRcFl2uEFNJOP28ZNrk5.1nl KQdlxYCmOHPJ7ujhaTgm2hv4huKTe9mdB40PO1U_8RNmSHkflnErO43sBQ414GFfC2AsE7IpxTCZ FD9ffiqs5mXlGEf31_2GPaPTFP2SS93MVH8Pfqe2U8A49h3QLVjGWU8EPUJX3f37UbU7ltLIwOpv 1UHYe94GzZprUWU5Ts.GiPwR6z0Mxwr6UVW2Yq83XU5fe5q1N.PH85DRdb.8BbfnnrCASJBjDM9I a1ocQNadFpjfETV_We2VPOMJel7YWgx.buLIq6DegKV_PNerCuzLrm05tmkOdFfU1xj9brZQpz8W zNCuQCWESGnFMYm97ZrzzDRb4PkpETrIjimZbuQZOoWDDRhIhXLzfSivsl9kSHnPv1wvB8CM7nX1 o6rh68ZD_ZF7poVpm_na9rymPpt5SetT1.Cj7i2NWQ X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ir2.yahoo.com with HTTP; Sat, 18 Dec 2021 18:55:07 +0000 Original-Received: by kubenode504.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 8e4dfa6a8306471f61d888509011f2c3; Sat, 18 Dec 2021 18:55:04 +0000 (UTC) X-Mailer: WebService/1.1.19415 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=77.238.179.83; envelope-from=mardani29@yahoo.es; helo=sonic309-25.consmr.mail.ir2.yahoo.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:222620 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-isearch-emoji-by-name.patch >From a899d6199d27ffefd01b764da9c7f37bb11466f7 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. (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 --=-=-=--