Subject: bug#40502: 28.0.50; Hangul Jamo conjoining characters are not composed

From: Robert Pluim <[email-masked]>
Date: Wed, 08 Apr 2020 14:11:19 +0200

>>>>> On Wed, 08 Apr 2020 14:18:22 +0300, Eli Zaretskii <[email-masked]> said:

    >> From: Robert Pluim <[email-masked]>
    >> Cc: [email-masked]
    >> Date: Wed, 08 Apr 2020 12:11:56 +0200
    >> 
    Eli> The call is incorrect: 'vector' should include both 0 and the function
    Eli> symbol.
    >> 
    >> Yes. I misread the docstring of composition-function-table rather than
    >> copying the correct call I had sitting in a buffer already.

    Eli> Maybe we should improve the doc string?  Which part was confusing?

I donʼt know if itʼs confusing, just that it says:

    The element at index C in the table, if non-nil, is a list of
    composition rules of this form: ([PATTERN PREV-CHARS FUNC] ...)

So I did
   (list (vector [..]

then continued to read the docstring, and by the time I got back to
the code, my brain conflated the brackets from the regexp with the
ones from the vector, so I closed the list, and carried on. So
entirely down to my brain fart. Maybe saying

((vector PATTERN PREV-CHARS FUNC) ...)

would have helped, but itʼs too late to tell now.

Perhaps we should have a macro or defun 'composition-function-add-entry' or
somesuch to hide the details? And ensure that weʼre not overwriting
previous entries. How often do people write these things?

    (defsubst composition-function-add-entry (char-or-range pattern
    prev-chars func &optional replace)
    "Add composition-function-table entry for CHAR-OR-RANGE.

    CHAR-OR-RANGE is a single character or a cons of character codes.
    Adds [PATTERN PREV-CHARS FUNC] to any existing composition-function-table
    entry for CHAR-OR-RANGE.

    Optional arg REPLACE non-nil means replace the existing entry rather
    than adding to it.

    See `composition-function-table' and `auto-composition-mode' for
    more details.

(or does this end up growing 'add-to-front', 'supersede',
'sort-then-insert' etc options? :-) )

Robert