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; [v2] Add new customisable phonetic Tamil input method Date: Sun, 10 Jul 2022 12:12:47 +0530 Message-ID: <87czedcvtk.fsf@gmail.com> References: <87pmiqe4da.fsf@gmail.com> <878rpdq99n.fsf@gmail.com> <83fsjldl2b.fsf@gnu.org> <87tu81osgp.fsf@gmail.com> <83czepdj0z.fsf@gnu.org> <87pmioq51w.fsf@gmail.com> <831qv4erwf.fsf@gnu.org> <87r134aiwd.fsf@gmail.com> <83mtdsc86u.fsf@gnu.org> <87czeoj68q.fsf@gmail.com> <83edz3di24.fsf@gnu.org> <87zghrj22n.fsf@gmail.com> <87tu7phb7s.fsf@gmail.com> <83r12t1qgb.fsf@gnu.org> 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="22128"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56323@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 10 08:44: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 1oAQfq-0005cp-Jf for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jul 2022 08:44:10 +0200 Original-Received: from localhost ([::1]:47920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAQfp-00074A-6h for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Jul 2022 02:44:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAQfh-000740-WA for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2022 02:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAQfh-0005ZY-Mg for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2022 02:44:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oAQfh-0007vN-Jk for bug-gnu-emacs@gnu.org; Sun, 10 Jul 2022 02:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Jul 2022 06:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56323 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 56323-submit@debbugs.gnu.org id=B56323.165743538730385 (code B ref 56323); Sun, 10 Jul 2022 06:44:01 +0000 Original-Received: (at 56323) by debbugs.gnu.org; 10 Jul 2022 06:43:07 +0000 Original-Received: from localhost ([127.0.0.1]:36196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAQeo-0007u0-GS for submit@debbugs.gnu.org; Sun, 10 Jul 2022 02:43:07 -0400 Original-Received: from mail-pj1-f66.google.com ([209.85.216.66]:42996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oAQel-0007tT-U7 for 56323@debbugs.gnu.org; Sun, 10 Jul 2022 02:43:05 -0400 Original-Received: by mail-pj1-f66.google.com with SMTP id i8-20020a17090a4b8800b001ef8a65bfbdso2290338pjh.1 for <56323@debbugs.gnu.org>; Sat, 09 Jul 2022 23:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :user-agent:mime-version; bh=t5gKmQ7z5Sh8By9fqmnl2C/rakk9WPrMCUkz3lUHJDw=; b=LrFFzA7TMYfpZckUPkP4B7Qs8GwlS1P0xN0jMFQX6rGf/b3qcYNMT/8XSKtZSpjzO3 aXg/72vGLcl+Fu36YW4EW5GFnwLnioBinprxvabJRAl6h8WQmcMWOHPPDEFUD58ah9Lj IoP+oSjZQVXv2/hdbUAKI9w3brd4F5riN/weBQpaZZxm4+/aHLjqjYqEaZzrgmpPwMSX L2YXYK5Ea+yDkukkNAndKnky5zd2f+M16r3am/nZ6pSwu9tYpcVyY9becD/B6WZnotzy Ge0G6M5dklQQLWirhn9DVCj0X/fEcfxPhxcAhM96/fwWnEMLVFzfDjlTNuBn/2x3CSgM SmYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:user-agent:mime-version; bh=t5gKmQ7z5Sh8By9fqmnl2C/rakk9WPrMCUkz3lUHJDw=; b=NoNwEucIGBWpdfrYcO5NCksTXSRcVB1wZ4NjwL2Kyb0piIdaSL7Kj9E09Wbo3tg/x4 GHHHLBeXnE42gel1zWz+gcYQBQveTesr5kgP/m75JiXe4NIZBMvUJhIf53tgI4zw6QvL eRuJQPNtgkX7Csqen4mVvUI6+9jQnISWtcMqh/LjdaVFSmp2biJ4ohjd5oC++NpWLFcl dThQprJyoXan41CUJYpbShZYjp6KzgZW6wsRj3KlVckN/2ZDFGTxPJK40ayRZ53KyVy0 2+55bURub2qr+R+lxNrEn4hWyv/kzfS6jrpLWdqsommLyRftBJObSX9hxVrvzIXnyhRO L96g== X-Gm-Message-State: AJIora+xqojTuhrN01IK4LKZ1Vnjd1MLJRFAy9Duer0qZCaQJT2vFlgb vUZdjRmOLytqSZVBf7ixUOaDHsywhy4= X-Google-Smtp-Source: AGRyM1uVT1wEncWbjoctmWN0yGL1RpMXc+As0uh/+cFtvs4FOxgkeIhcrtsM1vPBLZJhWwI9eykvFA== X-Received: by 2002:a17:90b:3ece:b0:1ed:13a9:8531 with SMTP id rm14-20020a17090b3ece00b001ed13a98531mr10018611pjb.183.1657435377856; Sat, 09 Jul 2022 23:42:57 -0700 (PDT) Original-Received: from localhost ([49.205.87.212]) by smtp.gmail.com with ESMTPSA id e124-20020a621e82000000b0051c4f6d2d95sm2387767pfe.106.2022.07.09.23.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Jul 2022 23:42:56 -0700 (PDT) In-Reply-To: <83r12t1qgb.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 10 Jul 2022 08:34:12 +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:236540 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=9C=E0=AF=82= =E0=AE=B2=E0=AF=88 10, 2022] Eli Zaretskii wrote: > Please name the new input method "tamil-phonetic", not just "tamil", > so that users who type "C-u C-\ tamil TAB" could have some means of > making the decision which one to choose. Done. >> +;; This is needed since the Unicode codepoint order does not reflect >> +;; the actual order in the Tamil language. >> +(defvar quail-tamil-itrans--consonant-order >> + '(("=E0=AE=95" . 0) ("=E0=AE=99" . 1) ("=E0=AE=9A" . 2) ("=E0=AE=9E" = . 3) ("=E0=AE=9F" . 4) ("=E0=AE=A3" . 5) >> + ("=E0=AE=A4" . 6) ("=E0=AE=A8" . 7) ("=E0=AE=AA" . 8) ("=E0=AE=AE" = . 9) ("=E0=AE=AF" . 10) ("=E0=AE=B0" . 11) >> + ("=E0=AE=B2" . 12) ("=E0=AE=B5" . 13) ("=E0=AE=B4" . 14) ("=E0=AE= =B3" . 15) ("=E0=AE=B1" . 16) ("=E0=AE=A9" . 17) >> + ("=E0=AE=9C" . 18) ("=E0=AE=B8" . 19) ("=E0=AE=B7" . 20) ("=E0=AE= =B9" . 21) ("=E0=AE=95=E0=AF=8D=E0=AE=B7" . 22) >> + ("=E0=AE=95=E0=AF=8D=E2=80=8C=E0=AE=B7" . 23) ("=E0=AE=B6" . 24))) > > Since the characters are ordered in the correct order, I wonder why we > need the explicit ordinal numbers here: they are determined by the > index of the character in the list. Ah yes, we could use seq-position, I forgot about that. Now done. >> +(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 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > What does it mean "character representing ... character"? Can you > clarify this confusing part of the doc string? I mean to say that VOWEL can be the datatypes string or character. But now, I cut that part out since I say no such thing for CONSONANT as well. >> +vowel sign corresponding to VOWEL or nil for none, > > Likewise here: "vowel corresponding to VOWEL"? It should be vowel sign corresponding to VOWEL. I'm not sure how to phrase it better, I borrowed the term "vowel sign" from the Unicode name (e.g., name of =E0=AF=81 a.k.a. #x0bc1). >> and TRANS is >> +the input sequence to insert VOWEL. > > The input sequence is generally a sequence of ASCII characters, is > that right? If so, I think telling that would make the documentation > more clear. Also, TRANS is a peculiar name for something described as > "input sequence", so maybe rename it to INPUT-SEQ? > >> +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." > > Same here regarding TRANS and its description. Now done. >> + (setq vowels (sort vowels (lambda (x y) (string-lessp (car x) (car y)= ))) >> + consonants (sort consonants >> + (lambda (x y) >> + (< (or (assoc-default (car x) quail-tamil-it= rans--consonant-order) 10000) >> + (or (assoc-default (car y) quail-tamil-it= rans--consonant-order) 10000))))) > > Can you wrap these long lines, so that they would be easier to read? I hope it is better now. >> + (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 ?-)) > > Did you test those :align-to specs when display-line-numbers is in > use? Seems to work fine from a short test on my side. >> +;;; >> +;;; Tamil phonetic input method >> +;;; >> + >> +;; Define the input method straightaway. >> +(quail-define-package "tamil" "Tamil" "=E0=AE=B4" t >> + "Customisable Tamil phonetic input method. > > See above regarding the name of the input method. Done. >> + ;; Consonants. >> + ("=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=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=95= =E0=AF=8D=E0=AE=B7=E0=AF=8D" "ksH") ("=E0=AE=B6=E0=AF=8D" "Z") >> + >> + ;; Misc. =E0=AE=83 is neither a consonant nor a vowel. >> + ("=E0=AE=83" "F" "q") >> + ("=E0=AF=90" "OM")) >> + "List of input sequences to translate to Tamil characters. >> +Each element should be (CHARACTER . TRANSLATIONS) where CHARACTER > > The (CHARACTER . TRANSLATIONS) form seems to imply the elements are > cons cells, but the value itself uses lists. Suggest to say instead > > Each element should be (CHARACTER TRANSLATIONS...) > Done. >> +is the Tamil character, and TRANSLATIONS is a list of input >> +sequences to translate to that character. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > "sequences which produce that character" is better. And I suggest to > use INPUT-SEQUENCES here, not TRANSLATIONS, for the reason explained > above. > Done. >> +CHARACTER is considered as a consonant (=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) if = it ends >> +with a pulli. > > What is a "pulli"? It is not a character name AFAICT. > It is the Tamil name for virama. I use pulli over virama since I don't think any Tamil reader would know it. But I put virama in brackets now for future maintainers. >> +CHARACTER is that is neither a vowel nor a consonant are > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Typo and/or redundant words here. > Fixed, thanks. >> +considered as \"miscellaneous\" characters and are inserted as >> +is. > > Not sure what this wants to say: the fact that characters are inserted > in some way seems to be unrelated to the description of the value. > What is this about? I tried to allude to the miscellaneous section in the docstring but I don't think it is really necessary. Now removed. >> +The input sequence for consonant+vowel pairs (=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) >> +is the input sequence for the consonant followed by the >> +corresponding vowel." > > Isn't that obvious? If not, the non-obvious part(s) should be > mentioned explicitly. Thinking twice, yes, it should be obvious. I removed this part. >> + :group 'tamil-input >> + :type '(alist :key-type string :value-type (repeat string)) >> + :set #'tamil--setter >> + :options > > This defcustom lacks the :version tag. > Oops, now fixed. Updated patch attached. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-new-customisable-phonetic-Tamil-input-method.patch Content-Transfer-Encoding: quoted-printable >From bb9105e32b9ea992ade4ce4b15db89a5b56ba630 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Sun, 10 Jul 2022 08:59:40 +0530 Subject: [PATCH] Add new customizable phonetic Tamil input method * lisp/language/indian.el ("Tamil"): Change the default input method of the Tamil language environment to the new input method. * lisp/leim/quail/indian.el (quail-tamil-itrans-compute-syllable-table): New function extracted from... (quail-tamil-itrans-syllable-table): ... here. Use the above function. (quail-tamil-itrans--consonant-order): Auxiliary variable for the above function. (quail-tamil-itrans-compute-signs-table): Add new VARIOUS argument. (quail-tamil-itrans-various-signs-and-digits-table) (quail-tamil-itrans-various-signs-table): Adjust call to the above function. ("tamil-phonetic"): Add new input method. (tamil-input): New group for the input method. (tamil-translation-rules): New defcustom for the input method to change the translation rules. (tamil--syllable-table, tamil--signs-table, tamil--hashtables) (tamil--vowel-signs): Internal variables used by the input method. (tamil--setter, tamil--make-tables) (tamil--update-quail-rules): Internal functions for the input method. (bug#56323) * etc/NEWS: Announce the new input method. --- etc/NEWS | 7 + lisp/language/indian.el | 2 +- lisp/leim/quail/indian.el | 306 +++++++++++++++++++++++++++++--------- 3 files changed, 247 insertions(+), 68 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 02fe67129d..33a489e18a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1043,6 +1043,13 @@ supported. Type 'C-u C-h t' to select it in case your language setup does not do so automatically. +--- +*** New default phonetic input method for the Tamil language environment. +The default input method for the Tamil language environment is now +"tamil-phonetic" which is a customizable phonetic input method. To +change the input method's translation rules, customize the user option +'tamil-translation-rules'. + * Changes in Specialized Modes and Packages in Emacs 29.1 diff --git a/lisp/language/indian.el b/lisp/language/indian.el index 2887d410ad..407173827f 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-phonetic") (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 04e95b0737..b2f31d7469 100644 --- a/lisp/leim/quail/indian.el +++ b/lisp/leim/quail/indian.el @@ -127,47 +127,34 @@ "\\''" indian-mlm-itrans-v5-hash "malayalam-itrans" "Malayalam" "MlmIT" "Malayalam transliteration by ITRANS method.") -(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) +;; This is needed since the Unicode codepoint order does not reflect +;; the actual order in the Tamil language. +(defvar quail-tamil-itrans--consonant-order + '("=E0=AE=95" "=E0=AE=99" "=E0=AE=9A" "=E0=AE=9E" "=E0=AE=9F" "=E0=AE=A3" + "=E0=AE=A4" "=E0=AE=A8" "=E0=AE=AA" "=E0=AE=AE" "=E0=AE=AF" "=E0=AE=B0" + "=E0=AE=B2" "=E0=AE=B5" "=E0=AE=B4" "=E0=AE=B3" "=E0=AE=B1" "=E0=AE=A9" + "=E0=AE=9C" "=E0=AE=B8" "=E0=AE=B7" "=E0=AE=B9" "=E0=AE=95=E0=AF=8D=E0= =AE=B7" + "=E0=AE=95=E0=AF=8D=E2=80=8C=E0=AE=B7" "=E0=AE=B6")) + +(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 INPUT-SEQ) where VOWEL is the +Tamil vowel character, SIGN is the vowel sign corresponding to +that vowel character or nil for none, and INPUT-SEQ is the input +sequence to insert VOWEL. + +CONSONANTS is a list of (CONSONANT INPUT-SEQ...) where CONSONANT +is the Tamil consonant character, and INPUT-SEQ is one or more +strings that describe how to insert CONSONANT." + (setq vowels (sort vowels + (lambda (x y) + (string-lessp (car x) (car y))))) + (setq consonants + (sort consonants + (lambda (x y) + (or (seq-position (car x) quail-tamil-itrans--consonant-order) = 1000) + (or (seq-position (car y) quail-tamil-itrans--consonant-order) = 1000)))) + (let ((virama #x0BCD) clm) (with-temp-buffer (insert "\n") @@ -197,21 +184,45 @@ 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)))) +(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)) + (when (characterp (car v)) + (setcar v (string (car v)))) + (setq trans (nth i (car indian-itrans-v5-table-for-tamil))) + (push (append v (list (if (listp trans) (car trans) trans))) + ret))) + ret) + (let ((consonants (cadr indian-tml-base-table)) + trans c ret) + (dotimes (i (length consonants)) + (when (setq c (nth i consonants)) + (when (characterp c) + (setq c (string c))) + (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 +255,28 @@ quail-tamil-itrans-numerics-and-symbols-table (insert "\n") (buffer-string)))) -(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) @@ -270,7 +284,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) @@ -281,25 +296,28 @@ quail-tamil-itrans-compute-signs-table (setq clm 0) (dotimes (i (length various)) (insert (propertize "\t" 'display (list 'space :align-to clm)) - (or (cdr (nth i various)) "")) + (or (cadr (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)))) (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")))) (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" "srii") = (?=E0=AF=90 "OM")))) (if nil (quail-define-package "tamil-itrans" "Tamil" "TmlIT" t "Tamil ITRANS")) @@ -347,6 +365,160 @@ quail-tamil-itrans-various-signs-table Full key sequences are listed below:") +;;; +;;; Tamil phonetic input method +;;; + +;; Define the input method straightaway. +(quail-define-package "tamil-phonetic" "Tamil" "=E0=AE=B4" t + "Customisable Tamil phonetic input method. +To change the translation rules of the input method, customize +`tamil-translation-rules'. + +To use native Tamil digits, customize `tamil-translation-rules' +accordingly. + +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) + +(defvar tamil--syllable-table nil) +(defvar tamil--signs-table nil) +(defvar tamil--hashtables + (cons (make-hash-table :test #'equal) + (make-hash-table :test #'equal))) +(defvar tamil--vowel-signs + '(("=E0=AE=85" . t) ("=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=92" . ?=E0=AF=8A) ("=E0=AE=93" . ?= =E0=AF=8B) ("=E0=AE=94" . ?=E0=AF=8C))) + +(defun tamil--setter (sym val) + (set-default sym val) + (tamil--update-quail-rules val)) + +(defun tamil--make-tables (rules) + (let (v v-table v-trans + c-table c-trans + m-table m-trans) + (dolist (ch rules) + (cond + ;; Vowel. + ((setq v (assoc-default (car ch) tamil--vowel-signs)) + (push (list (car ch) (and (characterp v) v)) v-table) + (push (cdr ch) v-trans)) + ;; Consonant. It needs to end with pulli. + ((string-suffix-p "=E0=AF=8D" (car ch)) + ;; Strip the pulli now. + (push (substring (car ch) 0 -1) c-table) + (push (cdr ch) c-trans)) + ;; If nothing else, then consider it a misc character. + (t (push (car ch) m-table) + (push (cdr ch) m-trans)))) + (list v-table v-trans c-table c-trans m-table m-trans))) + +(defun tamil--update-quail-rules (rules &optional name) + ;; This function does pretty much what `indian-make-hash' does + ;; except that we don't try to copy the structure of + ;; `indian-tml-base-table' which leads to less code hassle. + (let* ((quail-current-package (assoc (or name "tamil-phonetic") quail-pa= ckage-alist)) + (tables (tamil--make-tables rules)) + (v (nth 0 tables)) + (v-trans (nth 1 tables)) + (c (nth 2 tables)) + (c-trans (nth 3 tables)) + (m (nth 4 tables)) + (m-trans (nth 5 tables)) + (pulli (string #x0BCD))) + (clrhash (car tamil--hashtables)) + (clrhash (cdr tamil--hashtables)) + (indian--puthash-v v v-trans tamil--hashtables) + (indian--puthash-c c c-trans pulli tamil--hashtables) + (indian--puthash-cv c c-trans v v-trans tamil--hashtables) + (indian--puthash-m m m-trans tamil--hashtables) + ;; Now override the current translation rules. + ;; Empty quail map is '(list nil)'. + (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 tamil--hashtables)) + (setq tamil--syllable-table + (quail-tamil-itrans-compute-syllable-table + (mapcar (lambda (ch) (append ch (pop v-trans))) v) + (mapcar (lambda (ch) (cons ch (pop c-trans))) c)) + tamil--signs-table + (quail-tamil-itrans-compute-signs-table + nil + (append (mapcar (lambda (ch) (cons ch (pop m-trans))) m) + (and (gethash "=E0=AE=B8=E0=AF=8D" (car tamil--hashtab= les)) + `(("=E0=AE=B8=E0=AF=8D=E0=AE=B0=E0=AF=80" ,(conca= t (gethash "=E0=AE=B8=E0=AF=8D" (car tamil--hashtables)) + (gethash "=E0=AE=B0=E0=AF=80" (c= ar tamil--hashtables))))))))))) + +(defgroup tamil-input nil + "Translation rules for the Tamil input method." + :prefix "tamil-" + :group 'leim) + +(defcustom tamil-translation-rules + ;; Vowels. + '(("=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") + + ;; Consonants. + ("=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=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=95=E0= =AF=8D=E0=AE=B7=E0=AF=8D" "ksH") ("=E0=AE=B6=E0=AF=8D" "Z") + + ;; Misc. =E0=AE=83 is neither a consonant nor a vowel. + ("=E0=AE=83" "F" "q") + ("=E0=AF=90" "OM")) + "List of input sequences to translate to Tamil characters. +Each element should be (CHARACTER INPUT-SEQ...) where CHARACTER +is the Tamil character, and INPUT-SEQ is a list of input +sequences to translate to that character. + +CHARACTER is considered as a consonant (=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) if it = ends +with a pulli (virama). + +CHARACTER that is neither a vowel nor a consonant are inserted as +is." + :group 'tamil-input + :type '(alist :key-type string :value-type (repeat string)) + :set #'tamil--setter + :version "29.1" + :options + (delq nil + (append (mapcar #'car tamil--vowel-signs) + (mapcar (lambda (x) (if (characterp x) + (string x #x0BCD) + (and x (concat x "=E0=AF=8D")))) + (nth 1 indian-tml-base-table)) + '("=E0=AE=83" "=E0=AF=90") + ;; Digits. + (mapcar #'string (nth 3 indian-tml-base-digits-table))))) + ;;; ;;; Input by Inscript ;;; -- 2.35.1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >> [ Also, I don't see the customization group until I load >> lisp/leim/quail/indian.el? But AFAICT, that's not the case for other >> custom groups. ] > > There are no defcustoms in leim/quail/ files. How about moving the > defcustom to lisp/language/indian.el? Hmm, moving it to lisp/language/indian.el brings in warnings about undefined vars and functions, and an error when dumping. In toplevel form: language/indian.el:147:31: Warning: reference to free variable =E2=80= =98tamil--vowel-signs=E2=80=99 language/indian.el:151:32: Warning: reference to free variable =E2=80= =98indian-tml-base-table=E2=80=99 language/indian.el:154:41: Warning: reference to free variable =E2=80= =98indian-tml-base-digits-table=E2=80=99 In end of data: language/indian.el:143:10: Warning: the function =E2=80=98tamil--setter= =E2=80=99 is not known to be defined. rm -f emacs && cp -f temacs emacs LC_ALL=3DC ./temacs -batch -l loadup --temacs=3Dpdump \ --bin-dest /usr/local/bin/ --eln-dest /usr/local/lib/emacs/29.0.50/ Loading loadup.el (source)... Dump mode: pdump Using load-path (/home/viz/lib/ports/emacs/lisp) Loading emacs-lisp/debug-early... Loading emacs-lisp/byte-run... Loading emacs-lisp/backquote... Loading subr... Loading keymap... Loading version... Loading widget... Loading custom... Loading emacs-lisp/map-ynp... Loading international/mule... Loading international/mule-conf... Loading env... Loading format... Loading bindings... Loading window... Loading files... Loading emacs-lisp/macroexp... Loading cus-face... Loading faces... Loading loaddefs.el (source)... Loading button... Loading emacs-lisp/cl-preloaded... Loading emacs-lisp/oclosure... Loading obarray... Loading abbrev... Loading help... Loading jka-cmpr-hook... Loading epa-hook... Loading international/mule-cmds... Loading case-table... Loading international/charprop.el (source)... Loading international/characters... Loading international/charscript... Loading international/emoji-zwj... Loading composite... Loading language/chinese... Loading language/cyrillic... Loading language/indian... Error: void-variable (tamil--vowel-signs) (require cl-print) while preparing to dump make[1]: *** [Makefile:639: emacs.pdmp] Error 255 make[1]: Leaving directory '/home/viz/lib/ports/emacs/src' make: *** [Makefile:469: src] Error 2 Should I stick in defvar's and declare-function's? --=-=-=--