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: Fri, 01 Jul 2022 18:31:50 +0530 Message-ID: <874k01q94x.fsf@gmail.com> References: <87pmiqe4da.fsf@gmail.com> <878rpdq99n.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="7152"; 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 Fri Jul 01 15:06:37 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 1o7GM1-0001fp-BP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Jul 2022 15:06:37 +0200 Original-Received: from localhost ([::1]:41108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7GLz-00024T-TY for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Jul 2022 09:06:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7GIZ-00077s-5F for bug-gnu-emacs@gnu.org; Fri, 01 Jul 2022 09:03:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7GIY-0002XU-SL for bug-gnu-emacs@gnu.org; Fri, 01 Jul 2022 09:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o7GIY-0007mu-Kj for bug-gnu-emacs@gnu.org; Fri, 01 Jul 2022 09:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Jul 2022 13:03:02 +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.165668052928442 (code B ref 56323); Fri, 01 Jul 2022 13:03:02 +0000 Original-Received: (at 56323) by debbugs.gnu.org; 1 Jul 2022 13:02:09 +0000 Original-Received: from localhost ([127.0.0.1]:36648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7GHe-0007MX-Na for submit@debbugs.gnu.org; Fri, 01 Jul 2022 09:02:09 -0400 Original-Received: from mail-pj1-f66.google.com ([209.85.216.66]:45792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7GHY-0007F9-Bf for 56323@debbugs.gnu.org; Fri, 01 Jul 2022 09:02:04 -0400 Original-Received: by mail-pj1-f66.google.com with SMTP id g20-20020a17090a579400b001ed52939d72so2619564pji.4 for <56323@debbugs.gnu.org>; Fri, 01 Jul 2022 06:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=dL5/4b6kdDYKlaNjM8Ahu3CG4qmARskkeRavUl3ukCk=; b=VTk8HJ3K5b7cOM6exynBCASgrupl+5P0U3ad5B7I88C//V+qJWwJLIjl6IJc3JLxxJ mMsrQonovsagMLQGonWaCcuYq8FHJRk5RMo9GEz38w/VqBfbU2f1oTikgwskUhgIV+E0 ON/30nhSf5Wrw6srzjzayO63Ekue/UDufmJ2ny2RhOvBWP5Y2b8IO/k+7MRPVHxXxoiY SyNDKuxxz5GmD+YfdJEXBkVWttJeccpuO9hyX/rwd4TBMez7AkHpIY4JxqdrLrHKUqGB d23ypDZXHUOYOdt/QaD6fOhiFIfdNn/le5nDZgB8G50DdoC0mGW+4HiKekDzTuDiZpZY 4w3g== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=dL5/4b6kdDYKlaNjM8Ahu3CG4qmARskkeRavUl3ukCk=; b=XiQGhkQFy9GQ1dn/03r9lzrr0eI/MmhawgvKJP+bX5QVaFVy0HKWVervxT7/X6mrDL qSaEqJoXthDKlxuREMe1uzYr3K67rJkCIz+LsFmZwLUIe9nlDgnwvjFaMyPdKQ1WjJ8O abIsNl0TqnwWucPJuVIr1kTy6ULP8jLh6UVlTAIHj21J8qpljbhZzpdyNGz2OOZMLgz6 CyzhcH3vOHFRvU2SnM38a+NuitiLja7cpA8jhAx83H3jc644DzJYa12tCuy9QOKxH67E Lp01MsAaNXitF3VBUUj/iqTajCYtk99U27ZWWKgTam9AT1UO6KTnSpfBFo9QLlSrY947 zA9g== X-Gm-Message-State: AJIora+6jviydsxHHnyU1rpJrhGDVqal0pJeFcwXSkDREoMeqSZLAh5N WDcb98H4R9WVtdLJudornwzdgve/Hdg= X-Google-Smtp-Source: AGRyM1s7R4gdt8U/GzviisP1LUFxafLHDteBBf6r4JKnEUMgJX0ys30Zwe+yAdK/9WS1jw9UQDkWbg== X-Received: by 2002:a17:90b:3b82:b0:1ec:ac0d:5d3b with SMTP id pc2-20020a17090b3b8200b001ecac0d5d3bmr18642410pjb.158.1656680514107; Fri, 01 Jul 2022 06:01:54 -0700 (PDT) Original-Received: from localhost ([49.204.133.141]) by smtp.gmail.com with ESMTPSA id p13-20020a17090b010d00b001e0c1044ceasm6482174pjz.43.2022.07.01.06.01.52 for <56323@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 06:01:53 -0700 (PDT) In-Reply-To: <878rpdq99n.fsf@gmail.com> (Visuwesh's message of "Fri, 01 Jul 2022 18:29:00 +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:235806 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=B5=E0=AF=86=E0=AE=B3=E0=AF=8D=E0=AE=B3=E0=AE=BF =E0=AE=9C=E0=AF=82= =E0=AE=B2=E0=AF=88 01, 2022] Visuwesh wrote: > [=E0=AE=B5=E0=AE=BF=E0=AE=AF=E0=AE=BE=E0=AE=B4=E0=AE=A9=E0=AF=8D =E0=AE= =9C=E0=AF=82=E0=AE=A9=E0=AF=8D 30, 2022] Visuwesh wrote: > >> 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'. >> [blah blah blah...] > > Here's a second revision of the second patch. > Here's a corrected patch with a really silly oversight fixed: --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-new-customizable-phonetic-Tamil-input-method.patch Content-Transfer-Encoding: quoted-printable >From 8774f2f3dc1c5850e9ec6f6b0c178fd455221f17 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Thu, 30 Jun 2022 17:01:07 +0530 Subject: [PATCH] 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-tables): Function to produce vowels, consonants, and their translations. (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 | 302 +++++++++++++++++++++++++++++--------- 2 files changed, 236 insertions(+), 68 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..ebc04c518b 100644 --- a/lisp/leim/quail/indian.el +++ b/lisp/leim/quail/indian.el @@ -127,47 +127,19 @@ "\\''" 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. +;; This also does not sort by vowel or consonant. :( +(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 +169,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 +237,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 +266,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 +278,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)))) =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" "srii") = (?=E0=AF=90 "OM")))) =20 (if nil (quail-define-package "tamil-itrans" "Tamil" "TmlIT" t "Tamil ITRANS")) @@ -347,6 +347,174 @@ 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 + :version "29.1" + :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 + :version "29.1" + :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 + :version "29.1" + :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 + :version "29.1" + :type 'boolean) + +(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" . 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=92" . ?=E0=AF=8A) ("=E0=AE=93" . ?= =E0=AF=8B) ("=E0=AE=94" . ?=E0=AF=8C))) + +(defun tamil--make-tables () + "Return vowels, consonants, and their translation rules. +The returned table is a list (VOWELS CONSONANTS VTRANS CTRANS) +where VOWELS is a list of (VOWEL VOWEL-SIGN) where VOWEL is the +Tamil vowel character, and VOWEL-SIGN is its sign, CONSONANTS is +a list of consonants that have translation rules. +VTRANS is a list of translation rules for vowels in VOWELS in the +order they appear, CTRANS is a list of translation rules for +consonants in CONSONANTS." + (let (c-table v-table v-trans c-trans) + (dolist (v tamil-vowel-translation) + (push (list (car v) (assoc-default (car v) tamil--vowel-signs)) v-ta= ble) + (push (cdr v) v-trans)) + (dolist (c tamil-consonant-translation) + (push (cdr c) c-trans) + ;; Remove pulli/virama from consonant entry. + (push (substring (car c) 0 -1) c-table)) + ;; FIXME: Remove when sorting is done properly! + (setq c-table (nreverse c-table) + v-table (nreverse v-table) + c-trans (nreverse c-trans) + v-trans (nreverse v-trans)) + (list v-table c-table + v-trans c-trans))) + +(defun tamil--update-quail-rules () + ;; 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-default "tamil" quail-package-alist= )) + (tables (tamil--make-tables)) + (vowels (nth 0 tables)) + (vowels-trans (nth 2 tables)) + (consonants (nth 1 tables)) + (consonants-trans (nth 3 tables)) + (pulli (string #x0BCD))) + (clrhash (car tamil--hashtables)) + (clrhash (cdr tamil--hashtables)) + (indian--puthash-v vowels vowels-trans tamil--hashtables) + (indian--puthash-c consonants consonants-trans pulli tamil--hashtables) + (indian--puthash-cv consonants consonants-trans + vowels vowels-trans tamil--hashtables) + (indian--puthash-m (mapcar #'car tamil-misc-translation) + (mapcar #'cdr tamil-misc-translation) + tamil--hashtables) + (when tamil-native-digits + (indian--puthash-m (nth 3 indian-tml-base-digits-table) + '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9") + tamil--hashtables)) + ;; Now override the current translation rules. + ;; Empty quail map is '(list nil)'. + (setf (nth 2 quail-current-package) '(())) + (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 (v) (append v (pop vowels-trans))) vowels) + (mapcar (lambda (c) (cons c (pop consonants-trans))) consonant= s)) + 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 tamil-misc-translation)))) + +(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 Sorry for the noise. --=-=-=--