From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#58070: [PATCH] Add tamil99 input method Date: Tue, 27 Sep 2022 13:22:02 +0530 Message-ID: <87leq5dzkt.fsf@gmail.com> References: <20220925100020.13229-1-arunisaac@systemreboot.net> <20220925100244.13482-1-arunisaac@systemreboot.net> <87h70vsmyd.fsf@gmail.com> <87ill9ony7.fsf@systemreboot.net> <83sfkdjpyf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8978"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Arun Isaac , 58070@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 27 10:39:39 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 1od67v-00026X-7J for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Sep 2022 10:39:39 +0200 Original-Received: from localhost ([::1]:51720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1od67u-0006HA-0g for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Sep 2022 04:39:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1od5Oo-000805-Tq for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 03:53:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53314) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1od5Oo-0004ob-Kb for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 03:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1od5Oo-0001Jz-3C for bug-gnu-emacs@gnu.org; Tue, 27 Sep 2022 03:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Sep 2022 07:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58070 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58070-submit@debbugs.gnu.org id=B58070.16642651345023 (code B ref 58070); Tue, 27 Sep 2022 07:53:02 +0000 Original-Received: (at 58070) by debbugs.gnu.org; 27 Sep 2022 07:52:14 +0000 Original-Received: from localhost ([127.0.0.1]:52392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1od5O1-0001Ix-GG for submit@debbugs.gnu.org; Tue, 27 Sep 2022 03:52:14 -0400 Original-Received: from mail-pj1-f65.google.com ([209.85.216.65]:52215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1od5Nz-0001Ij-To for 58070@debbugs.gnu.org; Tue, 27 Sep 2022 03:52:12 -0400 Original-Received: by mail-pj1-f65.google.com with SMTP id u12so362471pjj.1 for <58070@debbugs.gnu.org>; Tue, 27 Sep 2022 00:52:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=UexgjXL6cTtKLiC3xQ/CvMmjbBS57JixMQ3oLepwIlM=; b=aoOhB0eqkhvoPg/LGlrRHKdSubkCjTMmFJuSprQPU+YoYrZ3nYY5IMWQRsSwRIxHs/ cHmkSPp6b+q8e90wYBkhOn9bcvyC/MaFIytKz3A2LT4QfzUxNCXxr/XwpUS/IwMNpwNg gYild6rik4KLI00F2XX0blr5qqmvccMtpYasXQ6nasuf/E6yIzhx0bckU3cqLNhALLNW YboTjdR3OanZMXdugurGXjtJItslS5QjuGRsmDl36R+b73e0swI19Nqx6AKxm4lTOwvT Euh9DM1foLeOaE2+BSlRK78OWrUn52h8742j0T/EbwLqIRluF3aY0KFPnq7ha2iyMD/0 jjRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date; bh=UexgjXL6cTtKLiC3xQ/CvMmjbBS57JixMQ3oLepwIlM=; b=BNpW4LlCH8t3RaXQr7HKwvakOFqsKmQ/huWyVmXCJX6GUP4TA0Lx5sl27WTI7Do/Hb 4KAkYKTh5jH9+BLFkqOklY4wT7Xo7xP4cfqX5ScwLv2Q8chYkeKj31yvyzqYzAWAk4oQ IlUSih6gEXsU1UuUzBqG3v7UByICAbovDvPfonkFCWx3xasDMzgbRDXByF/vaAD/QJbl 6Pldx3kGZRsSXje3LtUsRrCfTkz4wgDpyf6LZkd+1bHNQUvcDdrBb787ie3vrKKUCH6w g39VGQyGJxrb+3zGLM6UdCMS8P/yiieZb+fHW5YNcxA7ELUCsbmo9lZe2uXoQhSZ846n ZMSw== X-Gm-Message-State: ACrzQf0asthv44sffMCV4YqsISxcbBciBuk3wiYQTPSS8tT65JaSb171 4NvYXWeKbZiS1xWpgs9Os8s= X-Google-Smtp-Source: AMsMyM5Fkpul22h607lUsXnkaMjO+eZPpufICGajcCh+L2Utcg2147vHqp4IaNKXysCzBIeK5ko1CA== X-Received: by 2002:a17:902:d482:b0:178:1585:40b6 with SMTP id c2-20020a170902d48200b00178158540b6mr26362535plg.134.1664265125834; Tue, 27 Sep 2022 00:52:05 -0700 (PDT) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id d9-20020a621d09000000b005484d133127sm904016pfd.129.2022.09.27.00.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 00:52:05 -0700 (PDT) In-Reply-To: <83sfkdjpyf.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 27 Sep 2022 09:23:20 +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:243701 Archived-At: [=E0=AE=9A=E0=AF=86=E0=AE=B5=E0=AF=8D=E0=AE=B5=E0=AE=BE=E0=AE=AF=E0=AF=8D = =E0=AE=9A=E0=AF=86=E0=AE=AA=E0=AF=8D=E0=AE=9F=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0= =AE=B0=E0=AF=8D 27, 2022] Eli Zaretskii wrote: Some bits about tamil99 layout first: Tamil99 layout has two parts: the physical keyboard layout akin to QWERTY, Dvorak, workman, etc. and the special "rules" which are supposed to combine vowels and consonants, and ease typing certain character sequences. Tamil has vowels, consonants, and vowel-consonant pairs. When you combine a consonant and a vowel sign, you get a vowel-consonant pair. Tamil99's special "rules" comes into the picture here: these rules tell you how to write these vowel-consonant pairs as the layout itself does not have keys to type all the possible vowel-consonant pairs. E.g., h maps to the consonant =E0=AE=95, d maps to the vowel =E0=AE=89.= When you type h d, you get =E0=AE=95=E0=AF=81. This is basically what the rules= say. I will explain how our implementations differ below. >> I agree. Your imperative approach does have this advantage. But, it >> comes at the price of having to inspect the buffer at (point). The >> declarative approach does not need to inspect the buffer at all since it >> merely composes sequential keystrokes and doesn't know anything about >> what's already on the buffer. I personally think buffer inspection is a >> lot of code complexity for a simple input method like tamil99, but >> perhaps Eli should take a call on this. > > I don't think I understand what you are talking about (I'm not an > expert on Quail).=20=20 Arun's implementation precalculates the key sequences that produce vowel-consonant pairs and adds them as separate Quail rules, kind of what happens in the itrans IMs. So in the quail-map, you have rules like "h" =3D =E0=AE=95, "d" =3D =E0=AE=89, "hd" =3D =E0=AE=95=E0=AF=81 whic= h works great until you run into a situation like Eric described in emacs-devel here: https://yhetil.org/emacs= -devel/87a66ori6g.fsf@gmail.com/T/#m5b261c1a7bb06c7c074fdcdb746fb53ab7af1aa1 I'm sure that situation is familiar to many who use Quail IMs regularly, which is why I decided to make my IM consider the character before point to decide what codepoint Quail should insert in the buffer. In my implementation, the quail-map only has "h" =3D =E0=AE=95, "d" =3D =E0=AE=89= . I use the UPDATE-TRANSLATION-FUNCTION to see what the character before point is and change what Quail should insert: if the user types 'd' and the character before point is a '=E0=AE=95', then I make Quail insert =E0=AF=81= (instead of =E0=AE=89) to get =E0=AE=95=E0=AF=81. This lets you insert vowel-consonant= pairs out-of-order which is akin to what Eric wants. > Does this complexity slow down the input noticeably? This I cannot tell since I am not a fast enough typist. Each keystroke looks up two to three alists of differing sizes on each input. If it leads to a noticeable slowdown, then we can replace the alists with a hashtable instead. > Does it make the code much harder to understand, even if you put > enough comments there to explain what's going on? If not, then I > don't think the added complexity should be a problem, and you should > decide based on other aspects. I tried to comment almost everything I do for the future maintainers, and use the same language as the keyboard layout's spec does (linked in the file's Commentary). > >> Let me explain with a latin example for the benefit of non-Tamil >> readers. Suppose we had: >>=20 >> [...] > > [...] > > Emacs 29 also has the composition-break-at-point variable, which you > could set non-nil, in which case will also work by > codepoints. So perhaps the out-of-sequence vowel insertion would be > possible without further complications if composition-break-at-point > is non-nil? Unfortunately, composition-break-at-point is not enough here since the layout does not have keys to insert the *vowel signs* (the grave accent in Arun's example), only *vowels*.