bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Visuwesh
Subject: bug#56323: 29.0.50; [v2] Add new customisable phonetic Tamil input method
Date: Sun, 10 Jul 2022 12:12:47 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

[ஞாயிறு ஜூலை 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
>> +  '(("க" . 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)))
>
> 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 ு 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-itrans--consonant-order) 10000)
>> +                              (or (assoc-default (car y) 
>> quail-tamil-itrans--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 "௦௧௨௩௪௫௬௭௮௯")
>>      (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" "ழ" t
>> + "Customisable Tamil phonetic input method.
>
> See above regarding the name of the input method.

Done.

>> +    ;; Consonants.
>> +    ("க்" "k" "g") ("ங்" "ng") ("ச்" "ch" "s") ("ஞ்" "nj") ("ட்" "t" "d")
>> +    ("ண்" "N") ("த்" "th" "dh") ("ந்" "nh") ("ப்" "p" "b") ("ம்" "m")
>> +    ("ய்" "y") ("ர்" "r") ("ல்" "l") ("வ்" "v") ("ழ்" "z" "zh")
>> +    ("ள்" "L") ("ற்" "rh") ("ன்" "n")
>> +    ;; Sanskrit.
>> +    ("ஜ்" "j") ("ஸ்" "S") ("ஷ்" "sh") ("ஹ்" "h")
>> +    ("க்‌ஷ்" "ksh") ("க்ஷ்" "ksH") ("ஶ்" "Z")
>> +
>> +    ;; Misc.  ஃ is neither a consonant nor a vowel.
>> +    ("ஃ" "F" "q")
>> +    ("ௐ" "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 (மெய் எழுத்து) 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 (உயிர்மெய் எழுத்துக்கள்)
>> +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.

Attachment: 0001-Add-new-customisable-phonetic-Tamil-input-method.patch
Description: Text Data

>> [ 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 
‘tamil--vowel-signs’
    language/indian.el:151:32: Warning: reference to free variable 
‘indian-tml-base-table’
    language/indian.el:154:41: Warning: reference to free variable 
‘indian-tml-base-digits-table’

    In end of data:
    language/indian.el:143:10: Warning: the function ‘tamil--setter’ is not 
known to be defined.
    rm -f emacs && cp -f temacs emacs
    LC_ALL=C ./temacs -batch  -l loadup --temacs=pdump \
        --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?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]