From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57214: 29.0.50; Incorrect rendering of Emoji (grapheme cluster) in Org heading Date: Sun, 14 Aug 2022 22:12:11 +0300 Message-ID: <83y1vqiqr8.fsf@gnu.org> References: <877d3avf0m.fsf@protesilaos.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40138"; mail-complaints-to="usenet@ciao.gmane.io" Cc: summeremacs@gmail.com, 57214@debbugs.gnu.org To: Protesilaos Stavrou Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 14 21:13:11 2022 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 1oNJ2t-000AEp-GD for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 21:13:11 +0200 Original-Received: from localhost ([::1]:37676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNJ2r-00064z-Uj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 15:13:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNJ2k-00064o-6Q for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 15:13:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNJ2j-0001KB-Rh for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 15:13:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNJ2j-0001Pi-Md for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 15:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Aug 2022 19:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57214 X-GNU-PR-Package: emacs Original-Received: via spool by 57214-submit@debbugs.gnu.org id=B57214.16605043595405 (code B ref 57214); Sun, 14 Aug 2022 19:13:01 +0000 Original-Received: (at 57214) by debbugs.gnu.org; 14 Aug 2022 19:12:39 +0000 Original-Received: from localhost ([127.0.0.1]:39945 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNJ2M-0001P7-S8 for submit@debbugs.gnu.org; Sun, 14 Aug 2022 15:12:39 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40260) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNJ2I-0001Os-I6 for 57214@debbugs.gnu.org; Sun, 14 Aug 2022 15:12:37 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51042) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNJ2C-0001Eo-D1; Sun, 14 Aug 2022 15:12:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=omxkp8FngVQPg85+onubX3JnDA0SgL2TdQtgGErGBV4=; b=dv+d1ZImWEJ+GoHOX/sH BrT1AQFu9GxQTKqNIuSVlnr7daHQ3eYI/a5qtWjjuq5GKLWw3PY5N6NiJBevYn7YSXVfyCcHQB7CB X62fJdoQG4uiA/YmAqiV9uIgEuWbP9VDIM8QfAQVZWY1PDgPBAxGIcRnAd0wl7TSSZWJ2NHt5RZTz Mv4IHYRPdNR/1dWi1FgPGax3mrxwYbm1NHrqMf/hBj1rUUftb8K8IV+WjT6misIN3ZMCDFWnw0AKr bH5b2fx/TBaGXNTzi8lTg7PvzXlQ1IKFEcbB1YlWqTRTSc9lck1gNhPP0t14rQ276Y+4vV/MZE9iz 3/57JQlFmn2Frw==; Original-Received: from [87.69.77.57] (port=2941 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNJ2B-0002jV-R8; Sun, 14 Aug 2022 15:12:28 -0400 In-Reply-To: <877d3avf0m.fsf@protesilaos.com> (message from Protesilaos Stavrou on Sun, 14 Aug 2022 21:47:21 +0300) 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:239698 Archived-At: > Cc: summeremacs@gmail.com > From: Protesilaos Stavrou > 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.