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#56237: 29.0.50; delete-forward-char fails to delete character Date: Mon, 27 Jun 2022 15:39:46 +0300 Message-ID: <83fsjq8elp.fsf@gnu.org> References: <87v8sn9zo4.fsf@gmail.com> <83zghz8kk3.fsf@gnu.org> <87mtdz9ysx.fsf@gmail.com> <83y1xj8jqb.fsf@gnu.org> <87fsjr9xs6.fsf@gmail.com> <83v8sn8ir9.fsf@gnu.org> <87bkuf9wx4.fsf@gmail.com> <83tu878hen.fsf@gnu.org> <87sfnqoep4.fsf@gmail.com> <87o7yeodxu.fsf@gmail.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="7797"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56237@debbugs.gnu.org To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 27 14:40:16 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 1o5o2K-0001oI-FR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 14:40:16 +0200 Original-Received: from localhost ([::1]:56698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5o2J-0002Hk-6T for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Jun 2022 08:40:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5o27-0002GX-Ep for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 08:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5o27-0006tG-5W for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 08:40:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o5o27-0007xE-1Q for bug-gnu-emacs@gnu.org; Mon, 27 Jun 2022 08:40:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Jun 2022 12:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56237 X-GNU-PR-Package: emacs Original-Received: via spool by 56237-submit@debbugs.gnu.org id=B56237.165633359130548 (code B ref 56237); Mon, 27 Jun 2022 12:40:02 +0000 Original-Received: (at 56237) by debbugs.gnu.org; 27 Jun 2022 12:39:51 +0000 Original-Received: from localhost ([127.0.0.1]:50256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5o1v-0007we-FL for submit@debbugs.gnu.org; Mon, 27 Jun 2022 08:39:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o5o1u-0007wT-CV for 56237@debbugs.gnu.org; Mon, 27 Jun 2022 08:39:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:37048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5o1p-0006lj-1g; Mon, 27 Jun 2022 08:39:45 -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=7yBB4d05+kOqG3cujv53AEP+2Lc6hhYDSjMxztqOVd4=; b=Pwe/UVztoKlXVPJ0RtRU WzsH/zcZtspY4tcFhKxeO+bzc5qy+vwJf5L0deVrGUH4GgDucnMSTq7xvMZNUAdovGvjQcz6wCj8i SnFNSa10m8h2CLurMoHmsORfz03o2jDKn9UPRh3E3Wpy8TcHpE6MFObDnvGVzbIHerqvL+MGuQH/i X5YHrmywxuhk8n5EME6Aa5eh8VREervDrvgg+MLa+8it6OxeziAMvlioNFwZLh7M0TJvkrwQWK7p9 klIWJBaOAtoR45B/qZMPg3B8O1vg8D+3QAb2/CNDe1bPTgOXKcyI3oBJi1kS7BC24oawTE6o4g0g7 eWKAGY0BEPl7GQ==; Original-Received: from [87.69.77.57] (port=4265 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 1o5o1o-0007SY-GQ; Mon, 27 Jun 2022 08:39:44 -0400 In-Reply-To: <87o7yeodxu.fsf@gmail.com> (message from Visuwesh on Mon, 27 Jun 2022 11:17:25 +0530) 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:235447 Archived-At: > From: Visuwesh > Cc: 56237@debbugs.gnu.org > Date: Mon, 27 Jun 2022 11:17:25 +0530 > > > (let* ((composition (find-composition 0 nil "ப்போ" t)) > > (gstring (nth 2 composition)) > > (num-glyphs (lgstring-glyph-len gstring)) > > (i 1) > > (from (lglyph-from (lgstring-glyph gstring 0))) > > (to (lglyph-to (lgstring-glyph gstring 0)))) > > (while (and (< i num-glyphs) > > (= from (lglyph-from (lgstring-glyph gstring i))) > > (= to (lglyph-to (lgstring-glyph gstring i)))) > > (setq i (1+ i))) > > i) > > > > here i is the number of characters we need to delete using delete-char. > > > > [1] For the gstring format, see composition-get-gstring. > > > > But I think we should test this code in cases where a grapheme cluster > > contains more than two codepoints since all the composed characters in > > Tamil are made up of two Unicode codepoints. I can't test it on emojis > > since I don't know of an Emoji font that won't crash potentially Xft and > > has enough coverage. > > > > I got my hopes too high. :( > > This fails for the simple case of ரு (C-u C-x = also fails!) so I guess > we are back to square one. Although ரு is composed from 0BB0 0BC1, the > gstring only has one glyph. Yes, composition of N characters can in general produce M glyphs, where M can be smaller, equal, or greater than N. It's a many-to-many operation, and we cannot rely on getting the same number of glyphs as the number of codepoints we compose. The idea is nevertheless correct (I had the same one), it just needs some fine-tuning. (And "C-x =" tries to solve a different problem: how to match each glyph with a codepoint, and that problem is in general insoluble, so it's a small wonder that it fails.) Please try the latest master, I hope delete-forward-char now behaves better.