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

From: Visuwesh <[email-masked]>
Date: Sun, 13 Mar 2022 11:21:49 +0530

[வியாழன், பிப்ரவரி 17 2022] Eli Zaretskii wrote:
>> From: Visuwesh <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Thu, 17 Feb 2022 16:23:06 +0530
>> 
>> >  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?
>
> Yes, thanks.
>
>> 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?
>
> No, I think you can do the renaming.  The change is already
> incompatible, because we will be changing the default input method, so
> it will need a NEWS entry to tell how to get back old behavior, and in
> that NEWS entry we can also tell users to switch to another input
> method.
>
>> >  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?
>
> If you can find the problem and fix i there, fine.  But fixing only a
> small number of input methods with patches specific to those methods
> is also fine.
>

I finally decided to procrastinate by working on this patch for once,
please see updated patch below.  I'm not really sure if the commit
message's format is okay (C-c C-w barfs at me), so I tried to do it
manually.  Also, I think the NEWS entries can be improved but I'm not
sure how.

>From b3a7148d638008d6990693cd3d59972b329c3fac Mon Sep 17 00:00:00 2001
From: Visuwesh <[email-masked]>
Date: Sun, 13 Mar 2022 11:16:38 +0530
Subject: [PATCH] Follow contemporary practices in the Tamil IMs

* lisp/language/ind-util.el (indian-tml-base-digits-table): New table
to translates digits.
(indian-tml-base-table): Don't translate digits.
(indian-tml-itrans-digits-v5-hash): Hashtable that translates digits.

* lisp/leim/quail/indian.el (tamil-itrans-digits)
(tamil-inscript-digits): New input method that translates digits.

(tamil-itrans, tamil-inscript): Fix table inclusion.

* etc/NEWS: Announce the change.
---
 etc/NEWS                  | 14 ++++++++++++++
 lisp/language/ind-util.el | 27 +++++++++++++++++++++++++++
 lisp/leim/quail/indian.el | 38 ++++++++++++++++++++++++++++++++++----
 3 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index faac1fbc91..273fa77640 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -158,6 +158,13 @@ beginning.
 An autoload definition appears just as a '(defun . NAME)' and the
 '(t . NAME)' entries are not generated any more.
 
+---
+** The Tamil input methods do not insert Tamil digits anymore.
+The input methods 'tamil-itrans' and 'tamil-inscript' no longer insert
+the Tamil digit.  To get back the previous behaviour, use the
+'tamil-itrans-digits' and 'tamil-inscript-digits' input methods
+instead.
+
 
 * Changes in Emacs 29.1
 
@@ -1656,6 +1663,13 @@ when used as part of a property list specification for the
 ** 'defalias' records a more precise history of definitions.
 This is recorded in the `function-history` symbol property.
 
+---
+** 'indian-tml-base-table' no longer translates digits.
+Use 'indian-tml-base-digits-table' if you want digits translation.
+
+--
+** 'indian-tml-itrans-v5-hash' no longer translates digits.
+Use 'indian-tml-itrans-digits-v5-hash' if you digits translation.
 
 * Changes in Emacs 29.1 on Non-Free Operating Systems
 
diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el
index 8b1c3d69ae..60ada03fa2 100644
--- a/lisp/language/ind-util.el
+++ b/lisp/language/ind-util.el
@@ -255,6 +255,29 @@
      "ണ്" ?ൺ "ന്" ?ൻ "ര്" ?ർ "ല്" ?ൽ "ള്" ?ൾ)))
 
 (defvar indian-tml-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-tml-base-digits-table
   '(
     (;; VOWELS
      (?அ nil) (?ஆ ?ா) (?இ ?ி) (?ஈ ?ீ) (?உ ?ு) (?ஊ ?ூ)
@@ -557,6 +580,10 @@
 (defvar indian-tml-itrans-v5-hash
   (indian-make-hash indian-tml-base-table
 			  indian-itrans-v5-table-for-tamil))
+
+(defvar indian-tml-itrans-digits-v5-hash
+  (indian-make-hash indian-tml-base-digits-table
+			  indian-itrans-v5-table-for-tamil))
 )
 
 (defmacro indian-translate-region (from to hashtable encode-p)
diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el
index 23204c0cd3..33ad79fce4 100644
--- a/lisp/leim/quail/indian.el
+++ b/lisp/leim/quail/indian.el
@@ -171,7 +171,7 @@
 	clm)
     (with-temp-buffer
       (insert "\n")
-      (insert "    +")
+      (insert "----+")
       (insert-char ?- 74)
       (insert "\n    |")
       (setq clm 6)
@@ -293,16 +293,39 @@ You can input characters using the following mapping tables.
     Example: To enter வணக்கம், type vaNakkam.
 
 ### Basic syllables (consonants + vowels) ###
-\\<quail-tamil-itrans-syllable-table>
+\\=\\<quail-tamil-itrans-syllable-table>
 
 ### Miscellaneous (various signs + digits) ###
-\\<quail-tamil-itrans-various-signs-and-digits-table>
+\\=\\<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>
+\\=\\<quail-tamil-itrans-numerics-and-symbols-table>
+
+Full key sequences are listed below:")
+
+(if nil
+    (quail-define-package "tamil-itrans-digits" "Tamil" "TmlITD" t "Tamil ITRANS with digits"))
+(quail-define-indian-trans-package
+ indian-tml-itrans-digits-v5-hash "tamil-itrans-digits" "Tamil" "TmlITD"
+ "Tamil transliteration by ITRANS method with Tamil digits support.
+
+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:")
 
@@ -479,6 +502,13 @@ Full key sequences are listed below:")
  "tamil-inscript" "Tamil" "TmlIS"
  "Tamil keyboard Inscript.")
 
+(if nil
+    (quail-define-package "tamil-inscript-digits" "Tamil" "TmlISD" t "Tamil keyboard Inscript with digits."))
+(quail-define-inscript-package
+ indian-tml-base-digits-table inscript-tml-keytable
+ "tamil-inscript-digits" "Tamil" "TmlISD"
+ "Tamil keyboard Inscript with Tamil digits support.")
+
 ;; Probhat Input Method
 (quail-define-package
  "bengali-probhat" "Bengali" "BngPB" t
-- 
2.33.1

> Btw, the patch is already close to the limit of what we can accept
> without copyright assignment, so would you like to start your legal
> paperwork rolling at this time, so that we could in the future accept
> more contributions from you?  If yes, I will send you the form to fill
> and the instructions to go with that.
>

BTW, I sent the mail to [email-masked] on 23rd Feb, and haven't heard
from them yet.

> Thanks.