From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.bugs Subject: bug#60740: [PATCH 0/2] emoji changes Date: Thu, 2 Feb 2023 00:09:16 +0100 Message-ID: <20230201230918.550-1-jonas@bernoul.li> References: <83leli3nly.fsf@gnu.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="427"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org To: 60740@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 02 00:10:16 2023 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 1pNMF6-000AXN-8x for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Feb 2023 00:10:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNMEu-0003aj-W3; Wed, 01 Feb 2023 18:10:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pNMEs-0003Zy-UT for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 18:10:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNMEs-0007Ei-Lf for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 18:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pNMEs-0005qN-Eb for bug-gnu-emacs@gnu.org; Wed, 01 Feb 2023 18:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jonas Bernoulli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Feb 2023 23:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60740 X-GNU-PR-Package: emacs Original-Received: via spool by 60740-submit@debbugs.gnu.org id=B60740.167529297022386 (code B ref 60740); Wed, 01 Feb 2023 23:10:02 +0000 Original-Received: (at 60740) by debbugs.gnu.org; 1 Feb 2023 23:09:30 +0000 Original-Received: from localhost ([127.0.0.1]:60095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNMEL-0005p0-Q3 for submit@debbugs.gnu.org; Wed, 01 Feb 2023 18:09:30 -0500 Original-Received: from mail.hostpark.net ([212.243.197.30]:37396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNMEG-0005oo-SM for 60740@debbugs.gnu.org; Wed, 01 Feb 2023 18:09:28 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 602F61625C; Thu, 2 Feb 2023 00:09:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=sel2011a; t=1675292962; bh=82VmT6mWaSNNxCS znlOXpE39x/QO7mmoP9wLMyLLadM=; b=pgtgC6C5kKoNY22lH5gWTe2UbFo1OOw uSwU1Q0LGpV4iUAtO7/i/FaAtOKMnQ0OT8wWZEoGDgGPCVs71h6lSs/Lh2Kaigsy 6rcifRMvHApT7rUMwohsyqaTLSMd7s+nxci56gt99zW1VV6RR8F0VTrPC/8L7LRP dDY5JCbpKZjs= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id YLRNWaIsvshq; Thu, 2 Feb 2023 00:09:22 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 1401E16255; Thu, 2 Feb 2023 00:09:22 +0100 (CET) X-Mailer: git-send-email 2.39.1 In-Reply-To: <83leli3nly.fsf@gnu.org> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254611 Archived-At: * The first commit changes `isearch-emoji-by-name' to not use transient. If there are derivations then `completing-read' is instead used to let the user chose one. I think we should stick to that. What I mention next, seems way to risky at this time and I also do not think it would be worth it. Selecting a derivation using `completing-read' isn't bad at all. (The problem with using a transient command inside `with-isearch-suspended' is that expects to be able to call a function, which uses `recursive-edit' in some way. Once that returns, the macro resumes isearch. But transient does not do that and it returns immediately after the transient prefix command returns. That happens before the user selects a derivation by invoking one of the suffix commands. So isearch resumes before the user has made any choice. One way around that might be to call `recursive-edit' in `isearch-emoji-by-name' before calling the code that might then use transient. But that would also have to automatically invoke a command inside that recursive edit. I couldn't find a way to do that. I timer might work, but that seems hacky. Another approach could be to break up `with-isearch-suspended' up into two functions, one that suspends and another that resumes. The suspend function could maybe also responsible for returning the resume function as a closure. The macro could use these two functions and existing callers could continue to use that. But `isearch-emoji-by-name' would only call the suspend function and would have to somehow pass the resume function to transient, so that it could call it when the time has come.) * The second commit changes emoji.el to use transient.el the way I intended it to be used. (I *think* transient already had support for "dynamic" transient commands, when emoji.el was created, but some of the convenience features certainly were missing still.) The new implementation changes the remaining entry points to be defined using `define-transient-prefix' but still without adding any suffix commands to them up front. Previously no *prefix* command was defined up front. Instead code very similar to what can be found in `define-transient-prefix' was used to turn certain nodes inside the tree of emoji into (sub-)prefix commands. These prefix commands were then invoked using `funcall', which is not how that is supposed to work; I am surprised that worked at all, but I guess that just means that emoji doesn't use any of transient's features that depend on `this-command' "being correct". The new implementation adds a single, named suffix command, `emoji-insert-glyph'. Now every suffix of a transient prefix is either that command or a "recursive" call to the prefix itself, with its scope narrowed to only part of the original tree of emoji. That is a big improvement over the old implementation, which had to define a new command for each and every emoji, and a new command for every grouping of emoji. Lars, previously a hash-table was used to track the emoji, that should not be derived any further. I changed that to a list, because I am yet to encounter a situation where more than one element has to be tracked. Are there even any derivations of derivations? If so, please point me to an example. If there are any, then the first commit would have to be adjusted to account for that. Otherwise, I think that is ready. I would still like to test the second commit a bit more, before applying it. Cheers, Jonas