From: Eli Zaretskii <eliz@gnu.org>
To: Protesilaos Stavrou <info@protesilaos.com>
Cc: summeremacs@gmail.com, 57214@debbugs.gnu.org
Subject: bug#57214: 29.0.50; Incorrect rendering of Emoji (grapheme cluster) in Org heading
Date: Sun, 14 Aug 2022 22:12:11 +0300 [thread overview]
Message-ID: <83y1vqiqr8.fsf@gnu.org> (raw)
In-Reply-To: <877d3avf0m.fsf@protesilaos.com> (message from Protesilaos Stavrou on Sun, 14 Aug 2022 21:47:21 +0300)
> Cc: summeremacs@gmail.com
> From: Protesilaos Stavrou <info@protesilaos.com>
> Date: Sun, 14 Aug 2022 21:47:21 +0300
>
> I have encountered a bug where grapheme clusters are not rendered
> properly when used inside of a folded heading in Org.
>
> Steps to reproduce with 'emacs -Q':
>
> 1. Evaluate:
>
> (setq org-pretty-entties t
> org-ellipsis " ☀️")
>
> 2. Either visit an existing Org file or use the attached sample.
>
> 3. Fold a heading in Org by pressing TAB with point somewhere on the
> heading.
>
> 4. Notice the incorrectly rendered sun emoji at the end of the folded
> heading.
>
> If I change 'org-ellipsis' to a single character emoji, such as the
> generic smile, the problem no longer occurs:
This is a limitation of how the ellipsis display is designed and
implemented in Emacs: we display the ellipsis via the buffer's
display-table, and character compositions aren't applied to glyphs
that come from the display-table. You can clearly see this from how
org.el prepares the display-table:
(when (and (stringp org-ellipsis) (not (equal "" org-ellipsis)))
(unless org-display-table
(setq org-display-table (make-display-table)))
(set-display-table-slot
org-display-table 4
(vconcat (mapcar (lambda (c) (make-glyph-code c 'org-ellipsis))
org-ellipsis)))
(setq buffer-display-table org-display-table))
As you see, the code puts each individual glyph of the Emoji sequence,
marked with its face, into a vector. When the display engine uses the
glyphs from the display-table, it doesn't interpret them in any way.
So the only way this can work is if the font used for Emoji has a
precomposed glyph for the sequence you want, and that precomposed
glyph has a character code you could use instead of the string.
next prev parent reply other threads:[~2022-08-14 19:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-14 18:47 bug#57214: 29.0.50; Incorrect rendering of Emoji (grapheme cluster) in Org heading Protesilaos Stavrou
2022-08-14 19:12 ` Eli Zaretskii [this message]
2022-08-15 7:37 ` Protesilaos Stavrou
2022-08-15 11:43 ` Eli Zaretskii
2022-08-15 14:12 ` Protesilaos Stavrou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83y1vqiqr8.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=57214@debbugs.gnu.org \
--cc=info@protesilaos.com \
--cc=summeremacs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.