Subject: bug#50143: 28.0.50; Various issues with `tamil-itrans' input method

From: Visuwesh <[email-masked]>
Date: Thu, 17 Feb 2022 16:23:06 +0530

[புதன், பிப்ரவரி 16 2022] Eli Zaretskii wrote:

Hi Eli,

>> As a native Tamil speaker, I can attest that contemporary text uses the
>> Arabic numerals (in fact, Tamil digits are mentioned as a matter of fact
>> in schools).  I'm not sure about the situation in Sri Lanka, tho.
>
> It sounds like a better way forward would be to define a separate
> input method, so that the existing input method is preserved and can
> be used if someone wants the current transliterations.
>
> So my suggestions would be:
>
>  1. For your items 1 and 3, just copy indian-tml-base-table to a new
>     variable, modify it to include the two missing characters and
>     replace the digits with nil, add a new variable similar to
>     indian-tml-itrans-v5-hash, and compute its value like we do with
>     indian-tml-itrans-v5-hash, but using the new table instead of
>     indian-tml-base-table.  Then make a new input method, called, say,
>     tamil-itrans-alt, which would use the new hash variable instead of
>     indian-tml-itrans-v5-hash.  Submit these changes as patches to
>     lisp/language/ind-util.el and lisp/leim/quail/indian.el.
>

Does the attached patch look okay to you?

diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el
index 8b1c3d69ae..7b11be60d5 100644
--- a/lisp/language/ind-util.el
+++ b/lisp/language/ind-util.el
@@ -277,6 +277,29 @@
     (;; Inscript-extra (4)  (#, $, ^, *, ])
      "்ர" "ர்" "த்ர" nil nil)))
 
+(defvar indian-tml-no-digits-base-table
+  '(
+    (;; VOWELS
+     (?அ nil) (?ஆ ?ா) (?இ ?ி) (?ஈ ?ீ) (?உ ?ு) (?ஊ ?ூ)
+     nil nil nil (?ஏ ?ே) (?எ ?ெ) (?ஐ ?ை)
+     nil (?ஓ ?ோ) (?ஒ ?ொ) (?ஔ ?ௌ) nil nil)
+    (;; CONSONANTS
+     ?க nil nil nil ?ங                  ;; GUTTRULS
+     ?ச nil ?ஜ nil ?ஞ                  ;; PALATALS
+     ?ட nil nil nil ?ண                  ;; CEREBRALS
+     ?த nil nil nil ?ந ?ன              ;; DENTALS
+     ?ப nil nil nil ?ம                  ;; LABIALS
+     ?ய ?ர ?ற ?ல ?ள ?ழ ?வ          ;; SEMIVOWELS
+     nil ?ஷ ?ஸ ?ஹ                    ;; SIBILANTS
+     nil nil nil nil nil nil nil nil      ;; NUKTAS
+     "ஜ்ஞ" "க்ஷ")
+    (;; Misc Symbols
+     nil ?ஂ ?ஃ nil ?் nil nil)
+    (;; Digits
+     nil nil nil nil nil nil nil nil nil nil)
+    (;; Inscript-extra (4)  (#, $, ^, *, ])
+     "்ர" "ர்" "த்ர" nil nil)))
+
 (defvar indian-base-table-to-language-alist
   '((indian-dev-base-table . "Devanagari")
     (indian-pnj-base-table . "Punjabi")
@@ -286,6 +309,7 @@
     (indian-tlg-base-table . "Telugu")
     (indian-knd-base-table . "Kannada")
     (indian-mlm-base-table . "Malayalam")
+    ;; TODO: Change this?
     (indian-tml-base-table . "Tamil")))
 
 (defvar indian-itrans-v5-table
@@ -557,6 +581,10 @@
 (defvar indian-tml-itrans-v5-hash
   (indian-make-hash indian-tml-base-table
 			  indian-itrans-v5-table-for-tamil))
+
+(defvar indian-tml-itrans-no-digits-v5-hash
+  (indian-make-hash indian-tml-no-digits-base-table
+			  indian-itrans-v5-table-for-tamil))
 )
 
 (defmacro indian-translate-region (from to hashtable encode-p)
diff --git a/lisp/language/indian.el b/lisp/language/indian.el
index e0adb0de6c..ec0bcb9be9 100644
--- a/lisp/language/indian.el
+++ b/lisp/language/indian.el
@@ -92,7 +92,7 @@ are supported in this language environment."))
  "Tamil" '((charset unicode)
 	   (coding-system utf-8)
 	   (coding-priority utf-8)
-	   (input-method . "tamil-itrans")
+	   (input-method . "tamil-itrans-nodig")
 	   (documentation . "\
 South Indian Language Tamil is supported in this language environment."))
  '("Indian"))
diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el
index 23204c0cd3..7788efb941 100644
--- a/lisp/leim/quail/indian.el
+++ b/lisp/leim/quail/indian.el
@@ -284,9 +284,31 @@
       (buffer-string))))
 
 (if nil
-    (quail-define-package "tamil-itrans" "Tamil" "TmlIT" t "Tamil ITRANS"))
+    (quail-define-package "tamil-itrans" "Tamil" "TmlIT" t "Tamil ITRANS with digits"))
 (quail-define-indian-trans-package
  indian-tml-itrans-v5-hash "tamil-itrans" "Tamil" "TmlIT"
+ "Tamil transliteration by ITRANS method with Tamil digits.
+
+You can input characters using the following mapping tables.
+    Example: To enter வணக்கம், type vaNakkam.
+
+### Basic syllables (consonants + vowels) ###
+\\<quail-tamil-itrans-syllable-table>
+
+### Miscellaneous (various signs + digits) ###
+\\<quail-tamil-itrans-various-signs-and-digits-table>
+
+### Others (numerics + symbols) ###
+
+Characters below have no ITRANS method associated with them.
+Their descriptions are included for easy reference.
+\\<quail-tamil-itrans-numerics-and-symbols-table>
+
+Full key sequences are listed below:")
+(if nil
+    (quail-define-package "tamil-itrans-nodig" "Tamil" "TmlITN" t "Tamil ITRANS"))
+(quail-define-indian-trans-package
+ indian-tml-itrans-no-digits-v5-hash "tamil-itrans-nodig" "Tamil" "TmlITN"
  "Tamil transliteration by ITRANS method.
 
 You can input characters using the following mapping tables.
@@ -473,10 +495,16 @@ Full key sequences are listed below:")
 (quail-defrule "X" ?​)
 
 (if nil
-    (quail-define-package "tamil-inscript" "Tamil" "TmlIS" t "Tamil keyboard Inscript"))
+    (quail-define-package "tamil-inscript" "Tamil" "TmlIS" t "Tamil keyboard Inscript with Tamil digits"))
 (quail-define-inscript-package
  indian-tml-base-table inscript-tml-keytable
  "tamil-inscript" "Tamil" "TmlIS"
+ "Tamil keyboard Inscript with Tamil digits.")
+(if nil
+    (quail-define-package "tamil-inscript-nodig" "Tamil" "TmlISN" t "Tamil keyboard Inscript"))
+(quail-define-inscript-package
+ indian-tml-no-digits-base-table inscript-tml-keytable
+ "tamil-inscript-nodig" "Tamil" "TmlISN"
  "Tamil keyboard Inscript.")
 
 ;; Probhat Input Method

The names of the new input methods are bad.  IMO, tamil-itrans and
tamil-inscript should ideally be renamed to tamil-itrans-digits and
tamil-inscript-digits, and the new input methods should be tamil-itrans
and tamil-inscript.  But I guess such a backwards incompatible change
won't fly?

>  2. For your item 2, submit a patch that fixes the docstring of the
>     relevant input methods.

About item 2: according to the docstring of `quail-define-package',
constructs of the form "\<VAR>" should be replaced by the VAR:

    DOCSTRING is the documentation string of this package.  The command
    ‘describe-input-method’ shows this string while replacing the form
    \<VAR> in the string by the value of VAR.  That value should be a
    string.  For instance, the form \<quail-translation-docstring> is
    replaced by a description about how to select a translation from a
    list of candidates.

but this is not the case, I checked the code but don't see a
substitution like this happen.  Maybe this should be fixed in
`describe-input-method' instead?

>
> Would that work for you?  Can you prepare such patches?