Subject: bug#56323: 29.0.50; [v2] Add new customisable phonetic Tamil input method

From: Visuwesh <[email-masked]>
Date: Fri, 01 Jul 2022 19:17:18 +0530

[வெள்ளி ஜூலை 01, 2022] Eli Zaretskii wrote:

>> From: Visuwesh <[email-masked]>
>> Date: Fri, 01 Jul 2022 18:29:00 +0530
>> 
>> Also, can someone guide me to write a sort function for
>> quail-tamil-itrans-compute-syllable-table please?  The ideal order of
>> consonants should be the same as the one in the default value of
>> tamil-consonant-translation, same for tamil-vowel-translation.  I tried
>> the following
>> 
>>     (sort (reverse (mapcar #'car tamil-consonant-translation))
>>           (lambda (x y) (let ((lx (length x))
>>                               (ly (length y)))
>>                            (if (= lx ly) (string-lessp x y) (< lx ly)))))
>> 
>> 
>> but that definitely doesn't do what I want.  The idea was to sort the
>> list so that the basic consonants (க் ங் ச் etc.) first then the composite
>> ones (க்‌ஷ் க்ஷ் etc.) but `string-lessp' does not even sort the basic
>> consonants in the right order (the right order being the order in the
>> default value of `tamil-consonant-translation').
>
> Then you'll need to write your own comparison function and use it
> instead string-lessp.
>

I suppose so.  How does the following look?

    (sort
     '("க்" "ங்" "ச்" "ஞ்" "ட்" "ண்" "ற்ற்" "ந்" "ப்" "ய்"
       "ம்" "த்" "ர்" "ல்" "வ்" "ள்" "ற்" "ழ்" "ன்"
       "ஸ்" "ஜ்" "க்ஷ்" "ஷ்" "ஹ்" "க்‌ஷ்" "ஶ்")
     (lambda (x y)
       (let* ((cp '(("க்" . 0) ("ங்" . 1) ("ச்" . 2) ("ஞ்" . 3) ("ட்" . 4) ("ண்" . 5)
                    ("த்" . 6) ("ந்" . 7) ("ப்" . 8) ("ம்" . 9) ("ய்" . 10) ("ர்" . 11)
                    ("ல்" . 12) ("வ்" . 13) ("ழ்" . 14) ("ள்" . 15) ("ற்" . 16) ("ன்" . 17)
                    ("ஜ்" . 18) ("ஸ்" . 19) ("ஷ்" . 20) ("ஹ்" . 21) ("க்ஷ்" . 22)
                    ("க்‌ஷ்" . 23) ("ஶ்" . 24)))
              (xp (or (assoc-default x cp nil) 10000))
              (yp (or (assoc-default y cp nil) 10000)))
         (< xp yp))))

[ I won't have the unnecessary let in the final version.  ]

>> Can I use the min-width property in buffer text?
>
> Why do you need that?  Please tell more about what you want to
> accomplish.

Currently we don't try too hard to ensure that text don't bump into each
other in the tables we calculate.  If you are unlucky, then the table
will be incomprehensible so I thought about putting a reasonable
min-width value on the text in signs table at least.  Of course, finding
a reasonable value is a headache in of itself; the better solution would
be probably pulling in the vtable library but I'm not too sure about
that.

I also attached a screenshot comparing my running Emacs session and
emacs -Q (yellow window is my current Emacs session) to get the point
across better.