Re: [PATCH] emoji on TUI emacs

Kai Ma <[email protected]>
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
Eli Zaretskii <[email protected]> writes:

>> From: Kai Ma <[email protected]>
>> Cc: [email protected]
>> Date: Fri, 21 Aug 2026 02:51:29 +0200
>> 
>> Thanks for the review.  I've updated the patches according to the comments.
>
> Thanks.  TL;DR: I installed these changes on the master branch.  Thank
> you for all your work on this important improvement.

Thank you!

> The log messages are now okay, with a single nit: the first (heading)
> line should NOT end in a period, except if it's the _only_ line in the
> log message.  (I've removed them when I installed these patches, but
> please remember this for the future.)

Noted.

>> > The second problem is with the Keycap sequences around line 550 of
>> > emoji-sequences: it seems Emacs is not composing these sequences for
>> > some reason?  Do you see this on your terminal?
>> 
>> Should be fixed now.  It was because I added all codepoints in
>> auto-composition-emoji-tty-eligible-codepoints to 'ch' in emoji-zwj.awk.
>> The problem is that auto-composition-emoji-tty-eligible-codepoints
>> contains initial codepoints of keycap sequences, and then 'ch' generated
>> composition rules like 002A FE0F, which took priority over
>> 002A FE0F 20E3.

I'm informed by a tester that this caused a regression in string-width
calculation: all Emoji compositions must go through
compose-gstring-and-emoji to obtain correct widths.  I have attached a
patch to correct this (adding all eligible codepoints but exclude keycap
sequence initials).  This is entirely my oversight during testing.
Sorry for the extra work this caused.
0001-Fix-Emoji-composition-rules-for-TTY-frames.patch (text/x-diff, 1.1 KB)
From 897ce139ec822023f8c6fcc82c2384c1e9b7bd9f Mon Sep 17 00:00:00 2001
From: Kai Ma <[email protected]>
Date: Sun, 23 Aug 2026 16:05:21 +0200
Subject: [PATCH] Fix Emoji composition rules for TTY frames

* (admin/unidata/emoji-zwj.awk): Add all TTY-eligible Emoji codepoints
to composition rules, but exclude keycap sequence initials.
---
 admin/unidata/emoji-zwj.awk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/admin/unidata/emoji-zwj.awk b/admin/unidata/emoji-zwj.awk
index d383597d169..c64a48b335d 100755
--- a/admin/unidata/emoji-zwj.awk
+++ b/admin/unidata/emoji-zwj.awk
@@ -68,6 +68,7 @@
 
 /^[0-9A-F]+ FE0F *; *emoji style;/ {
     tty_trigger_codepoints[++n_tty_triggers] = $1
+    ch[$1] = $1
 }
 
 END {
@@ -112,6 +113,11 @@ END {
          print "?\\N{U+" tty_trigger_codepoints[trig] "}"
      }
      print "))"
+     # Exclude keycap sequence initials
+     delete ch["0023"]
+     delete ch["002A"]
+     for (i = 0; i <= 9; i ++)
+         delete ch[sprintf("003%d", i)]
 
      # Generate unqualified tail initials.
      print "(setq auto-composition-emoji-unqualified-tail-initials"
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.