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#56323: 29.0.50; Add new customisable phonetic Tamil input method Date: Thu, 30 Jun 2022 17:43:21 +0530 Message-ID: <87pmiqe4da.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7028"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: 56323@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 30 14:14:14 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 1o6t3l-0001a9-GF for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Jun 2022 14:14:13 +0200 Original-Received: from localhost ([::1]:41598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6t3j-0001Cx-8P for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Jun 2022 08:14:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6t3b-0001Au-5e for bug-gnu-emacs@gnu.org; Thu, 30 Jun 2022 08:14:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39482) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6t3a-0003uV-TW for bug-gnu-emacs@gnu.org; Thu, 30 Jun 2022 08:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6t3a-0002r7-Lb for bug-gnu-emacs@gnu.org; Thu, 30 Jun 2022 08:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Jun 2022 12:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56323 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165659122410938 (code B ref -1); Thu, 30 Jun 2022 12:14:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Jun 2022 12:13:44 +0000 Original-Received: from localhost ([127.0.0.1]:33377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6t3H-0002qG-5N for submit@debbugs.gnu.org; Thu, 30 Jun 2022 08:13:44 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:48774) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6t3D-0002q4-O8 for submit@debbugs.gnu.org; Thu, 30 Jun 2022 08:13:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6t3D-0000xP-Jw for bug-gnu-emacs@gnu.org; Thu, 30 Jun 2022 08:13:39 -0400 Original-Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:46860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6t38-0003oi-D4 for bug-gnu-emacs@gnu.org; Thu, 30 Jun 2022 08:13:39 -0400 Original-Received: by mail-pg1-x543.google.com with SMTP id s27so411466pga.13 for ; Thu, 30 Jun 2022 05:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:user-agent:mime-version; bh=yAs6oH7gAeQGikg7bQecsLvTf1kUspZ3P/FgqQ4MKtU=; b=mayeMV5j5pbRufJAdjqfCTdzt87Ela2d2to8rbniq/Pw+QrwReWb4DSJ+bJ9Q/QD4J fxTS0FKaeRPIkscdxplWvxSjAQzmlewzsxsjP3SM2rPZUQpFg0JHe+JDXFzpWApiRBmO gceUT56meb/NUqInYNrgmITlp1xlGBO29qSRHHWSkJbJSgEwKKTwPdnbzfxqUH0xu+IO sMHvZG36cuUfzNxJgNgy5mGrWrHYvpIHY4YOg0Yl3W5uXkQF+S59WgxNzBfrJyKR7X9b E1xY5u0BPJdWlVoO3q7hAEyoutoqpVyUHyIjihkTsmaHJyhaa85bar/99eyqHFBXQpj5 T7XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version; bh=yAs6oH7gAeQGikg7bQecsLvTf1kUspZ3P/FgqQ4MKtU=; b=ACjzPWXPTlgeLzDBB2DrJpBu9gkqzH8kwhmLpcYvfBDdZhwNqe8E6VoGuhmkz1MD8G V/8nZoUGzGjRJ1C+tqkF34Ss/X7AaNWCHQ+sQEfSpjCYDohzFnngS8hwuBSbkJxapPv0 /k+FVJZYfo5WWUkVv0rLRVo3UWaJo5hz+c1qn0DmVQ/NPMLNkCf2bb6/TRZDZsDRi6ST YNgnBabJTQCjMgTt2F7lsXErbJSSv7LWBNYomX8VuOtFUSVcFkUckZUhCRt2MWz6pQLv QZlDfzgdZPTU5pyaVTDSK/wxlMtVsO2g06fmG7RbmOPbihDGi8olzwwDtJo5HfOX2ySh d0aQ== X-Gm-Message-State: AJIora/Bt8LxK063ILXAD45fdcdR6IKzMaaRTOR/jI40Qi0EkO1E215j 0FaSjd/LaBsW70o7XLm0Iqw1OUhzl3M= X-Google-Smtp-Source: AGRyM1sKhALQXwBO4+Cceb5oB8t+JKotXto5oOmSohULhA3N1AhNgQUYOCK+XMpP8CkLwDtC17yPyQ== X-Received: by 2002:a62:644c:0:b0:525:1420:ed5f with SMTP id y73-20020a62644c000000b005251420ed5fmr15549514pfb.22.1656591212231; Thu, 30 Jun 2022 05:13:32 -0700 (PDT) Original-Received: from localhost ([49.204.135.0]) by smtp.gmail.com with ESMTPSA id q2-20020a170902f34200b0016a2a8c7e8fsm13256116ple.143.2022.06.30.05.13.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 05:13:31 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=visuweshm@gmail.com; helo=mail-pg1-x543.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:235723 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Tags: patch The attached patchset adds a new customisable phonetic Tamil input method. I tried to reuse as much of the existing itrans input method code since it greatly simplifies the creation of an Indic input method (see `indian-make-hash'). The first patch fixes a fallout from bug#50143 asking to add TAMIL OM =E0= =AF=90 to the itrans table, and this means that one can insert the TAMIL OM character using the tamil-itrans input methods as well. I'd prefer it if this patch can be pushed quickly. The second patch actually adds the new phonetic input method. I will leave the rationale for making it a _customisable_ input method in footnote [1]. To reuse the existing code that calculates the various tables for the tamil-itrans IM, I turned the code in defvars to defuns. However, the definition of the almighty quail-tamil-itrans-syllable-table is still huge since I needed to do a whole lot to convert the indian-tml-base-table to a format that will accepted by the new defun `quail-tamil-itrans-compute-syllable-table'. The current quail rules is inspired by the one in https://github.com/rnchzn/tamil-phonetic/raw/main/tamil-phonetic.el and the comments in https://emacsnotes.wordpress.com/2022/03/07/tamil-phonetic-input-method-in-= emacs-emacs-%E0%AE%87%E0%AE%B2%E0%AF%8D-%E0%AE%A4%E0%AE%AE%E0%AE%BF%E0%AE%B= 4%E0%AF%8D-%E0%AE%83%E0%AE%AA%E0%AF%8A%E0%AE%A9%E0%AF%86%E0%AE%9F%E0%AE%BF%= E0%AE%95%E0%AF%8D/. Avid readers might notice that I went for a nil SIMPLE argument despite my recent complaint in emacs-devel. The reason for that is because we need a way to end the ongoing translation (C-SPC). E.g., if one decides to transliterate =E0=AE=B2=E0=AF=8D as "l" and =E0=AE=B3=E0=AF=8D as "ll", = then to type =E0=AE=B2=E0=AF=8D=E0=AE=B2 the key sequence will be l C-SPC la without the C-SPC, "lla" would be translated to =E0=AE=B3. The better way forward would be to present _both_ =E0=AE=B2=E0=AF=8D=E0=AE=B2 and =E0=AE= =B3=E0=AF=8D for the sequence "lla" but I have no idea how to do it. Any pointers would be _highly_ appreciated. I plan to modify indian--puthash-char to have one to many translations i.e., "l" would translate to both =E0=AE=B2=E0=AF=8D and =E0=AE=B3=E0=AF=8D= and then the user could decide which one to insert. This combined with the DETERMINISTIC argument to quail-define-package would make it an attractive option, I think. But I'm leaving it out right now since I want the current patch to be reviewed first. I think adding an optional NAME argument to tamil--update-quail-rules might be more flexible since then a user could let bind the relevant defcustoms to define other Tamil input methods without hassle (like the tamil99 layout, which I plan to get to at Some Point=E2=84=A2). WDYT? The code for tamil--update-quail-rules is sort of convoluted because of the conversion mentioned above. tamil--make-trans-table is also kind of complicated because, 1. I couldn't make the tamil-vowel-translation (and consonant, and misc) alist have a character key since the Customize interface shows those characters as numbers!! I really do not want to dig into the Customize UI code, sorry. :( 2. indian-tml-base-table has the character =E0=AE=95 in it but the defc= ustom tamil-consonant-translation has the character =E0=AE=95=E0=AF=8D in = it because the latter makes more sense to a native speaker and also because of (1) above. More explanation as to why in footnote [2]. There are some FIXMEs spattered in the code but I will get to it in a later revision. I also don't have a :set function for the defcustoms since I'm not sure if something along the following is the only way to automagically recalculate the quail rules: (defun tamil--set-variable (sym val) (set-default sym val) (when (and (boundp 'tamil-vowel-translation) (boundp 'tamil-consonant-translation) (boundp 'tamil-misc-translation) (boundp 'tamil-native-digits)) (tamil--update-quail-rules))) Comments on this, and general code review would be much appreciated. I don't think I have missed anything and if you want me to add more comments on some of the stuff, please do tell. Thanks. If Tamil speakers are reading this bug report, shout at me if you want something else and if you have other general comments. Or if I made an embarrassing typo somewhere. Thanks! --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-Fix-fallout-from-bug-50143.patch Content-Transfer-Encoding: quoted-printable >From 8789592426031a2608ef74c22719ed826be0353c Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Thu, 30 Jun 2022 16:49:31 +0530 Subject: [PATCH 1/2] Fix fallout from bug#50143 * lisp/language/ind-util.el (indian-tml-base-table) (indian-tml-base-digits-table): Add TAMIL OM sign to the table (bug#50143), and add more Sanskrit consonants. --- lisp/language/ind-util.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el index 60ada03fa2..c725134a30 100644 --- a/lisp/language/ind-util.el +++ b/lisp/language/ind-util.el @@ -269,9 +269,9 @@ indian-tml-base-table ?=E0=AE=AF ?=E0=AE=B0 ?=E0=AE=B1 ?=E0=AE=B2 ?=E0=AE=B3 ?=E0=AE=B4 ?= =E0=AE=B5 ;; SEMIVOWELS nil ?=E0=AE=B7 ?=E0=AE=B8 ?=E0=AE=B9 ;; SIBILANTS nil nil nil nil nil nil nil nil ;; NUKTAS - "=E0=AE=9C=E0=AF=8D=E0=AE=9E" "=E0=AE=95=E0=AF=8D=E0=AE=B7") + "=E0=AE=9C=E0=AF=8D=E0=AE=9E" "=E0=AE=95=E0=AF=8D=E0=AE=B7" "=E0=AE= =95=E0=AF=8D=E2=80=8C=E0=AE=B7" ?=E0=AE=B6) (;; Misc Symbols - nil ?=E0=AE=82 ?=E0=AE=83 nil ?=E0=AF=8D nil nil) + nil ?=E0=AE=82 ?=E0=AE=83 nil ?=E0=AF=8D ?=E0=AF=90 nil) (;; Digits nil nil nil nil nil nil nil nil nil nil) (;; Inscript-extra (4) (#, $, ^, *, ]) @@ -292,9 +292,9 @@ indian-tml-base-digits-table ?=E0=AE=AF ?=E0=AE=B0 ?=E0=AE=B1 ?=E0=AE=B2 ?=E0=AE=B3 ?=E0=AE=B4 ?= =E0=AE=B5 ;; SEMIVOWELS nil ?=E0=AE=B7 ?=E0=AE=B8 ?=E0=AE=B9 ;; SIBILANTS nil nil nil nil nil nil nil nil ;; NUKTAS - "=E0=AE=9C=E0=AF=8D=E0=AE=9E" "=E0=AE=95=E0=AF=8D=E0=AE=B7") + "=E0=AE=9C=E0=AF=8D=E0=AE=9E" "=E0=AE=95=E0=AF=8D=E0=AE=B7" "=E0=AE= =95=E0=AF=8D=E2=80=8C=E0=AE=B7" ?=E0=AE=B6) (;; Misc Symbols - nil ?=E0=AE=82 ?=E0=AE=83 nil ?=E0=AF=8D nil nil) + nil ?=E0=AE=82 ?=E0=AE=83 nil ?=E0=AF=8D ?=E0=AF=90 nil) (;; Digits ?=E0=AF=A6 ?=E0=AF=A7 ?=E0=AF=A8 ?=E0=AF=A9 ?=E0=AF=AA ?=E0=AF=AB ?= =E0=AF=AC ?=E0=AF=AD ?=E0=AF=AE ?=E0=AF=AF) (;; Inscript-extra (4) (#, $, ^, *, ]) --=20 2.35.1 --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0002-Add-new-customizable-phonetic-Tamil-input-method.patch Content-Transfer-Encoding: quoted-printable >From 7ddd045ff337b100b30bc27db38b490877c3e1ea Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Thu, 30 Jun 2022 17:01:07 +0530 Subject: [PATCH 2/2] Add new customizable phonetic Tamil input method * lisp/leim/quail/indian.el (quail-tamil-itrans-compute-syllable-table): New function extracted from.. (quail-tamil-itrans-syllable-table): ... here. Use above function. (quail-tamil-itrans-compute-signs-table): Add new argument VARIOUS. (quail-tamil-itrans-various-signs-and-digits-table) (quail-tamil-itrans-various-signs-table): Adjust function call, and add TAMIL OM sign translation. (tamil): New phonetic Tamil input method. (tamil-vowel-translation, tamil-consonant-translation) (tamil-misc-translation, tamil-native-digits): New defcustoms to change the translation rules of the input method. (tamil-uyir-translation, tamil-mei-translation): Aliases to new defcustom for better discoverability. (tamil--syllable-table, tamil--signs-table, tamil--hashtables) (tamil--vowel-signs): Internal variables used by the Tamil input method. (tamil--make-trans-table): Function to produce an itrans compatible translation table. (tamil--update-quail-rules): Function to update the translation rules for the Tamil input method. * lisp/language/indian.el ("Tamil"): Change the default input method of the Tamil language environment to the phonetic input method. --- lisp/language/indian.el | 2 +- lisp/leim/quail/indian.el | 276 +++++++++++++++++++++++++++++--------- 2 files changed, 211 insertions(+), 67 deletions(-) diff --git a/lisp/language/indian.el b/lisp/language/indian.el index 2887d410ad..91ad818533 100644 --- a/lisp/language/indian.el +++ b/lisp/language/indian.el @@ -109,7 +109,7 @@ 'devanagari "Tamil" '((charset unicode) (coding-system utf-8) (coding-priority utf-8) - (input-method . "tamil-itrans") + (input-method . "tamil") (sample-text . "Tamil (=E0=AE=A4=E0=AE=AE=E0=AE=BF=E0=AE=B4=E0= =AF=8D) =E0=AE=B5=E0=AE=A3=E0=AE=95=E0=AF=8D=E0=AE=95=E0=AE=AE=E0=AF=8D") (documentation . "\ South Indian Language Tamil is supported in this language environment.")) diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el index 8fffcc3511..120a446b44 100644 --- a/lisp/leim/quail/indian.el +++ b/lisp/leim/quail/indian.el @@ -127,47 +127,18 @@ "\\''" indian-mlm-itrans-v5-hash "malayalam-itrans" "Malayalam" "MlmIT" "Malayalam transliteration by ITRANS method.") =20 -(defvar quail-tamil-itrans-syllable-table - (let ((vowels - '(("=E0=AE=85" nil "a") - ("=E0=AE=86" "=E0=AE=BE" "A") - ("=E0=AE=87" "=E0=AE=BF" "i") - ("=E0=AE=88" "=E0=AF=80" "I") - ("=E0=AE=89" "=E0=AF=81" "u") - ("=E0=AE=8A" "=E0=AF=82" "U") - ("=E0=AE=8E" "=E0=AF=86" "e") - ("=E0=AE=8F" "=E0=AF=87" "E") - ("=E0=AE=90" "=E0=AF=88" "ai") - ("=E0=AE=92" "=E0=AF=8A" "o") - ("=E0=AE=93" "=E0=AF=8B" "O") - ("=E0=AE=94" "=E0=AF=8C" "au"))) - (consonants - '(("=E0=AE=95" "k") ; U+0B95 - ("=E0=AE=99" "N^") ; U+0B99 - ("=E0=AE=9A" "ch") ; U+0B9A - ("=E0=AE=9E" "JN") ; U+0B9E - ("=E0=AE=9F" "T") ; U+0B9F - ("=E0=AE=A3" "N") ; U+0BA3 - ("=E0=AE=A4" "t") ; U+0BA4 - ("=E0=AE=A8" "n") ; U+0BA8 - ("=E0=AE=AA" "p") ; U+0BAA - ("=E0=AE=AE" "m") ; U+0BAE - ("=E0=AE=AF" "y") ; U+0BAF - ("=E0=AE=B0" "r") ; U+0BB0 - ("=E0=AE=B2" "l") ; U+0BB2 - ("=E0=AE=B5" "v") ; U+0BB5 - ("=E0=AE=B4" "z") ; U+0BB4 - ("=E0=AE=B3" "L") ; U+0BB3 - ("=E0=AE=B1" "rh") ; U+0BB1 - ("=E0=AE=A9" "nh") ; U+0BA9 - ("=E0=AE=9C" "j") ; U+0B9C - ("=E0=AE=B6" nil) ; U+0BB6 - ("=E0=AE=B7" "Sh") ; U+0BB7 - ("=E0=AE=B8" "s") ; U+0BB8 - ("=E0=AE=B9" "h") ; U+0BB9 - ("=E0=AE=95=E0=AF=8D=E0=AE=B7" "x" ) ; U+0B95 - )) - (virama #x0BCD) +;; FIXME: This only accepts a single translation for vowels. Ideally, +;; we want it to support mutliple translation just like consonants. +(defun quail-tamil-itrans-compute-syllable-table (vowels consonants) + "Return the syllable table for the input method as a string. +VOWELS is a list of (VOWEL SIGN TRANS) where VOWEL is a string or +character representing the Tamil vowel character, SIGN is the +vowel sign corresponding to VOWEL or nil for none, and TRANS is +the input sequence to insert VOWEL. +CONSONANTS is a list of (CONSONANT TRANS...) where CONSONANT is +the Tamil consonant character, and TRANS is one or more strings +that describe how to insert CONSONANT." + (let ((virama #x0BCD) clm) (with-temp-buffer (insert "\n") @@ -197,21 +168,42 @@ quail-tamil-itrans-syllable-table (insert (propertize "\t" 'display (list 'space :align-to clm)) (car c) (or (nth 1 v) "")) (setq clm (+ clm 6))) - (insert "\n" (or (nth 1 c) "") - (propertize "\t" 'display '(space :align-to 4)) - "|") - (setq clm 6) - - (dolist (v vowels) - (apply #'insert (propertize "\t" 'display (list 'space :align-to clm)) - (if (nth 1 c) (list (nth 1 c) (nth 2 v)) (list ""))) - (setq clm (+ clm 6)))) + (dolist (ct (cdr c)) + (insert "\n" (or ct "") + (propertize "\t" 'display '(space :align-to 4)) + "|") + (setq clm 6) + (dolist (v vowels) + (apply #'insert (propertize "\t" 'display (list 'space :align-to clm)) + (if ct (list ct (nth 2 v)) (list ""))) + (setq clm (+ clm 6))))) (insert "\n") (insert "----+") (insert-char ?- 74) (insert "\n") (buffer-string)))) =20 +(defvar quail-tamil-itrans-syllable-table + (quail-tamil-itrans-compute-syllable-table + (let ((vowels (car indian-tml-base-table)) + trans v ret) + (dotimes (i (length vowels)) + (when (setq v (nth i vowels)) + (setq trans (nth i (car indian-itrans-v5-table-for-tamil))) + (push (append v (list (if (listp trans) (car trans) trans))) + ret))) + (setq ret (nreverse ret)) + ret) + (let ((consonants (cadr indian-tml-base-table)) + trans c ret) + (dotimes (i (length consonants)) + (when (setq c (nth i consonants)) + (setq trans (nth i (cadr indian-itrans-v5-table-for-tamil))) + (push (cons c (if (listp trans) trans (list trans))) + ret))) + (setq ret (nreverse ret)) + ret))) + (defvar quail-tamil-itrans-numerics-and-symbols-table (let ((numerics '((?=E0=AF=B0 "=E0=AE=AA=E0=AE=A4=E0=AF=8D=E0=AE=A4=E0= =AF=81") (?=E0=AF=B1 "=E0=AE=A8=E0=AF=82=E0=AE=B1=E0=AF=81") (?=E0=AF=B2 "= =E0=AE=86=E0=AE=AF=E0=AE=BF=E0=AE=B0=E0=AE=AE=E0=AF=8D"))) (symbols '((?=E0=AF=B3 "=E0=AE=A8=E0=AE=BE=E0=AE=B3=E0=AF=8D") (?=E0=AF= =B4 "=E0=AE=AE=E0=AE=BE=E0=AE=A4=E0=AE=AE=E0=AF=8D") (?=E0=AF=B5 "=E0=AE=B5= =E0=AE=B0=E0=AF=81=E0=AE=9F=E0=AE=AE=E0=AF=8D") @@ -244,25 +236,28 @@ quail-tamil-itrans-numerics-and-symbols-table (insert "\n") (buffer-string)))) =20 -(defun quail-tamil-itrans-compute-signs-table (digitp) +(defun quail-tamil-itrans-compute-signs-table (digitp various) "Compute the signs table for the tamil-itrans input method. -If DIGITP is non-nil, include the digits translation as well." - (let ((various '((?=E0=AE=83 . "H") ("=E0=AE=B8=E0=AF=8D=E0=AE=B0=E0=AF= =80" . "srii") (?=E0=AF=90))) - (digits "=E0=AF=A6=E0=AF=A7=E0=AF=A8=E0=AF=A9=E0=AF=AA=E0=AF=AB=E0=AF=AC= =E0=AF=AD=E0=AF=AE=E0=AF=AF") +If DIGITP is non-nil, include the digits translation as well. +If VARIOUS is non-nil, then it should a list of (CHAR . TRANS) +where CHAR is the character/string to translate and TRANS is +CHAR's translation." + (let ((digits "=E0=AF=A6=E0=AF=A7=E0=AF=A8=E0=AF=A9=E0=AF=AA=E0=AF=AB=E0= =AF=AC=E0=AF=AD=E0=AF=AE=E0=AF=AF") (width 6) clm) (with-temp-buffer - (insert "\n" (make-string 18 ?-) "+") - (when digitp (insert (make-string 60 ?-))) + (insert "\n" (make-string 18 ?-)) + (when digitp + (insert "+" (make-string 60 ?-))) (insert "\n") (insert (propertize "\t" 'display '(space :align-to 5)) "various" - (propertize "\t" 'display '(space :align-to 18)) "|") + (propertize "\t" 'display '(space :align-to 18))) (when digitp (insert - (propertize "\t" 'display '(space :align-to 45)) "digits")) - (insert "\n" (make-string 18 ?-) "+") + "|" (propertize "\t" 'display '(space :align-to 45)) "digits")) + (insert "\n" (make-string 18 ?-)) (when digitp - (insert (make-string 60 ?-))) + (insert "+" (make-string 60 ?-))) (insert "\n") (setq clm 0) =20 @@ -270,7 +265,8 @@ quail-tamil-itrans-compute-signs-table (insert (propertize "\t" 'display (list 'space :align-to clm)) (car (nth i various))) (setq clm (+ clm width))) - (insert (propertize "\t" 'display '(space :align-to 18)) "|") + (when digitp + (insert (propertize "\t" 'display '(space :align-to 18)) "|")) (setq clm 20) (when digitp (dotimes (i 10) @@ -283,23 +279,26 @@ quail-tamil-itrans-compute-signs-table (insert (propertize "\t" 'display (list 'space :align-to clm)) (or (cdr (nth i various)) "")) (setq clm (+ clm width))) - (insert (propertize "\t" 'display '(space :align-to 18)) "|") + (when digitp + (insert (propertize "\t" 'display '(space :align-to 18)) "|")) (setq clm 20) (when digitp (dotimes (i 10) (insert (propertize "\t" 'display (list 'space :align-to clm)) (format "%d" i)) (setq clm (+ clm width)))) - (insert "\n" (make-string 18 ?-) "+") + (insert "\n" (make-string 18 ?-)) (when digitp - (insert (make-string 60 ?-) "\n")) + (insert "+" (make-string 60 ?-) "\n")) (buffer-string)))) =20 (defvar quail-tamil-itrans-various-signs-and-digits-table - (quail-tamil-itrans-compute-signs-table t)) + (quail-tamil-itrans-compute-signs-table + t '((?=E0=AE=83 . "H") ("=E0=AE=B8=E0=AF=8D=E0=AE=B0=E0=AF=80" . "srii"= ) (?=E0=AF=90 . "OM")))) =20 (defvar quail-tamil-itrans-various-signs-table - (quail-tamil-itrans-compute-signs-table nil)) + (quail-tamil-itrans-compute-signs-table + nil '((?=E0=AE=83 . "H") ("=E0=AE=B8=E0=AF=8D=E0=AE=B0=E0=AF=80" . "sri= i") (?=E0=AF=90 . "OM")))) =20 (if nil (quail-define-package "tamil-itrans" "Tamil" "TmlIT" t "Tamil ITRANS")) @@ -347,6 +346,151 @@ quail-tamil-itrans-various-signs-table =20 Full key sequences are listed below:") =20 +;;; +;;; Tamil phonetic input method +;;; + +(defvaralias 'tamil-uyir-translation 'tamil-vowel-translation) +(defcustom tamil-vowel-translation + '(("=E0=AE=85" "a") ("=E0=AE=86" "aa") ("=E0=AE=87" "i") ("=E0=AE=88" "i= i") + ("=E0=AE=89" "u") ("=E0=AE=8A" "uu") ("=E0=AE=8E" "e") ("=E0=AE=8F" "e= e") + ("=E0=AE=90" "ai") ("=E0=AE=92" "o") ("=E0=AE=93" "oo") ("=E0=AE=94" "= au" "ow")) + "List of input sequences to translate to Tamil vowels. +Each element should be (VOWEL . TRANSLATIONS) where VOWEL is the +Tamil vowel character (=E0=AE=89=E0=AE=AF=E0=AE=BF=E0=AE=B0=E0=AF=86=E0=AE= =B4=E0=AF=81=E0=AE=A4=E0=AF=8D=E0=AE=A4=E0=AF=81) and TRANSLATIONS is the +list of input sequences to translate to that vowel." + :group 'leim + :type '(alist :key string :value-type (repeat string)) + :options (delq nil + (mapcar (lambda (x) (and (consp x) (string (car x)))) + (car indian-tml-base-table)))) + +(defvaralias 'tamil-mei-translation 'tamil-consonant-translation) +(defcustom tamil-consonant-translation + '(("=E0=AE=95=E0=AF=8D" "k" "g") ("=E0=AE=99=E0=AF=8D" "ng") ("=E0=AE=9A= =E0=AF=8D" "ch" "s") ("=E0=AE=9E=E0=AF=8D" "nj") ("=E0=AE=9F=E0=AF=8D" "t" = "d") + ("=E0=AE=A3=E0=AF=8D" "N") ("=E0=AE=A4=E0=AF=8D" "th" "dh") ("=E0=AE= =A8=E0=AF=8D" "nh") ("=E0=AE=AA=E0=AF=8D" "p" "b") ("=E0=AE=AE=E0=AF=8D" "m= ") + ("=E0=AE=AF=E0=AF=8D" "y") ("=E0=AE=B0=E0=AF=8D" "r") ("=E0=AE=B2=E0= =AF=8D" "l") ("=E0=AE=B5=E0=AF=8D" "v") ("=E0=AE=B4=E0=AF=8D" "z" "zh") + ("=E0=AE=B3=E0=AF=8D" "L") ("=E0=AE=B1=E0=AF=8D" "rh") ("=E0=AE=A9=E0= =AF=8D" "n") + ;; Sanskrit. + ("=E0=AE=9C=E0=AF=8D" "j") ("=E0=AE=B8=E0=AF=8D" "S") ("=E0=AE=95=E0= =AF=8D=E0=AE=B7=E0=AF=8D" "ksH") ("=E0=AE=B7=E0=AF=8D" "sh") ("=E0=AE=B9=E0= =AF=8D" "h") + ("=E0=AE=95=E0=AF=8D=E2=80=8C=E0=AE=B7=E0=AF=8D" "ksh") ("=E0=AE=B6=E0= =AF=8D" "Z")) + "List of input sequences to translate to Tamil consonants. +Each element should be (VOWEL . TRANSLATIONS) where VOWEL is the +Tamil consonant character (=E0=AE=AE=E0=AF=86=E0=AE=AF=E0=AF=8D =E0=AE=8E= =E0=AE=B4=E0=AF=81=E0=AE=A4=E0=AF=8D=E0=AE=A4=E0=AF=81) and TRANSLATIONS is= a list +of input sequences to translate to that consonant." + :group 'leim + :type '(alist :key string :value-type (repeat string)) + :options (delq nil + (mapcar (lambda (x) (if (stringp x) + (concat x "=E0=AF=8D") + ;; #x0BCD =3D pulli/virama. + (and x (string x #x0BCD)))) + (cadr indian-tml-base-table)))) + +(defcustom tamil-misc-translation + ;; =E0=AE=83 is not a vowel or a consonant. + '(("=E0=AE=83" "F" "q") + ("=E0=AF=90" "OM")) + "List of input sequences to translate to various Tamil characters. +Each should element should be (CHARACTER . TRANSLATIONS) where +CHARACTER may be any string and TRANSLATIONS is a list of input +sequences to translate to that CHARACTER." + :group 'leim + :type '(alist :key string :value-type (repeat string))) + +(defcustom tamil-native-digits nil + "When non-nil, use Tamil native digits instead of Arabic ones." + :group 'leim + :type 'boolean) + +(defvar tamil--syllable-table nil) +(defvar tamil--signs-table nil) +(defvar tamil--hashtables nil) +(defvar tamil--vowel-signs + '(("=E0=AE=85" . nil) ("=E0=AE=86" . ?=E0=AE=BE) ("=E0=AE=87" . ?=E0=AE= =BF) ("=E0=AE=88" . ?=E0=AF=80) + ("=E0=AE=89" . ?=E0=AF=81) ("=E0=AE=8A" . ?=E0=AF=82) ("=E0=AE=8E" . ?= =E0=AF=86) ("=E0=AE=8F" . ?=E0=AF=87) + ("=E0=AE=90" . ?=E0=AF=88) ("=E0=AE=93" . ?=E0=AF=8B) ("=E0=AE=92" . ?= =E0=AF=8A) ("=E0=AE=94" . ?=E0=AF=8C))) + +(defun tamil--make-trans-table () + `((;; Vowels. + ,@(mapcar + (lambda (v) (assoc-default (and v (string (car v))) tamil-vowel-tr= anslation)) + (car indian-tml-base-table))) + (;; Consonants. + ,@(mapcar + (lambda (c) + (when c + (assoc-default (if (stringp c) + (concat c "=E0=AF=8D") + ;; #x0BCD =3D pulli/virama. + (string c #x0BCD)) + tamil-consonant-translation))) + (nth 1 indian-tml-base-table))) + ;; Misc symbols. We will ignore the base table here. + ())) + +(defun tamil--update-quail-rules () + (let ((quail-current-package (assoc "tamil" quail-package-alist)) + (hts (indian-make-hash (if tamil-native-digits + indian-tml-base-digits-table + indian-tml-base-table) + (tamil--make-trans-table)))) + ;; Do the misc characters here. + (indian--puthash-m (mapcar #'car tamil-misc-translation) + (mapcar #'cdr tamil-misc-translation) + hts) + (setq tamil--hashtables hts + tamil--syllable-table + (quail-tamil-itrans-compute-syllable-table + (mapcar (lambda (v) (list (car v) (assoc-default (car v) tamil-= -vowel-signs) + (cadr v))) + tamil-vowel-translation) + (mapcar (lambda (c) (cons (substring (car c) 0 -1) (cdr c))) + tamil-consonant-translation)) + tamil--signs-table + ;; FIXME: This should also show how to input =E0=AE=B8=E0=AF=8D= =E0=AE=B0=E0=AF=80 (default: Srii). + (quail-tamil-itrans-compute-signs-table + tamil-native-digits + (mapcar (lambda (m) (cons (car m) (cadr m))) tamil-misc-transla= tion))) + ;; (nth 2 ...) =3D quail-map. + (setf (nth 2 quail-current-package) '(nil)) + (maphash (lambda (k v) + (quail-defrule k (if (length=3D v 1) + (string-to-char v) + (vector v)))) + (cdr hts)))) + +(quail-define-package + "tamil" "Tamil" "=E0=AE=B4" t + "Customisable Tamil phonetic input method. +To change the translation of vowels (=E0=AE=89=E0=AE=AF=E0=AE=BF=E0=AE=B0= =E0=AF=86=E0=AE=A4=E0=AF=8D=E0=AE=A4=E0=AF=81=E0=AE=95=E0=AF=8D=E0=AE=95=E0= =AE=B3=E0=AF=8D), customize `tamil-vowel-translation'. +To change the translation of consonants (=E0=AE=AE=E0=AF=86=E0=AE=AF=E0=AF= =8D =E0=AE=8E=E0=AE=B4=E0=AF=81=E0=AE=A4=E0=AF=8D=E0=AE=A4=E0=AF=81=E0=AE= =95=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D), customize + `tamil-consonant-translation'. +To input miscellaneous characters (including =E0=AE=83), customize + `tamil-misc-translation'. +To use native Tamil digits, customize `tamil-native-digits'. + +To end the current translation process, say \\\\= [quail-select-current] (defined in +`quail-translation-keymap'). This is useful when there's a + conflict between two possible translation. + +The current input scheme is: + +### Basic syllables (=E0=AE=89=E0=AE=AF=E0=AE=BF=E0=AE=B0=E0=AF=8D=E0=AE= =AE=E0=AF=86=E0=AE=AF=E0=AF=8D =E0=AE=8E=E0=AE=B4=E0=AF=81=E0=AE=A4=E0=AF= =8D=E0=AE=A4=E0=AF=81=E0=AE=95=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D) ### +\\=3D\\ + +### Miscellaneous #### +\\=3D\\ + +The following characters have NO input sequence associated with +them by default. Their descriptions are included for easy +reference. +\\=3D\\ + +Full key sequences are listed below:" + nil nil nil nil nil nil t) +(tamil--update-quail-rules) + ;;; ;;; Input by Inscript ;;; --=20 2.35.1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --- Footnotes: 1. The itrans input method is absolutely horrible for Tamil since unlike the other Indic languages, it doesn't have a lot of consonants HOWEVER, the consonant sound _changes_ depending on where it ends up. So ideally, the Tamil input method show allow multiple _ways_ to insert a single character. As an example, consider the following words =E0=AE=A4=E0=AF=81=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=BF=E0=AE=95=E0= =AF=8D=E0=AE=95=E0=AF=88 - thumbikai (tusk) =E0=AE=AA=E0=AE=9F=E0=AE=AE=E0=AF=8D - padam (= photograph/image) The consonant of interest is "=E0=AE=AA". The letter "=E0=AE=AA=E0=AE= =BF" is pronounced in the first word as "bi" as in "bicycle" however, the letter "=E0=AE=AA" = is pronounced as "pa" as in "party". This is just one of many examples. There are also pairs of very similar sounding consonants and when transliterated (when you type in "Tanglish" for example), all the characters in the pair use the same letter. E.g., such a pair is the =E0=AE=B2/=E0=AE=B3 family; when one causally chats in "Tanglish", = we just type "lXX" as the transliteration for that family. Obviously, when one is typing in _Tamil_, he/she needs to distinguish between these two characters. Leaving the choice of input sequence to transliterate these characters to the writer is much better. For more, please read the wordpress article I linked, thanks. 2. Opting to not go for character key in tamil-consonant-translation because of the Customize interface is only part of the reason. Having the key be TAMIL LETTER XXX + TAMIL SIGN VIRAMA is much more intuitive for the native speaker. Take =E0=AE=AA=E0=AF=81 for example, = the way you break it down into consonant and vowel is =E0=AE=AA=E0=AF=8D + =E0=AE=89 =3D =E0=AE=AA=E0=AF=81 (ippu + u =3D pu) and NOT =E0=AE=AA + =E0=AE=89 =3D =E0=AE=AA=E0=AF=81 (pa + u =3D pu) =20=20=20=20 --=-=-=--