Subject: 23.0.94; no doc for character composition

From: "Drew Adams" <[email-masked]>
Date: Sun, 14 Jun 2009 16:17:35 -0700

I can find no doc at all regarding character composition, beyond the
cursory explanation given in the Emacs manual, node Input Methods.
 
In particular, there is nothing in the Elisp manual about it. No
documentation of functions such as `compose-region' and
`compose-chars'.
 
And there is no usage commentary in `composite.el'.
 
How does one compose characters using Emacs Lisp? If characters have
been composed, how do you decompose them? Are there any caveats to be
aware of? Users will have such questions.
 
For example, this snippet is commonly used here and there to display the word
`lambda' as the Greek character:
 
(font-lock-add-keywords
   mode `(("\\<lambda\\>"
   (0 (progn (compose-region (match-beginning 0) (match-end 0)
        ,(make-char 'greek-iso8859-7 107))
      nil)))))
 
But removing that keyword entry from font-lock-keywords, unfontifying, then
refontifying is not sufficient to display `lambda' as a word again. What needs
to be done, to restore the normal display of the word `lambda'?  This kind of
information is missing.
 
Perusing `composite.el', I see that this will do the job:
 
(font-lock-remove-keywords
     nil `(("\\<lambda\\>"
            (0 (progn (compose-region (match-beginning 0) (match-end 0)
                                      ,(make-char 'greek-iso8859-7 107))
                      nil)))))
(save-excursion
   (goto-char (point-min))
   (while (re-search-forward "\\<lambda\\>" nil t)
     (decompose-region (match-beginning 0) (match-end 0))))
 
But it would be helpful to have a little doc in the Elisp manual
explaining how to use character composition. This feature deserves some doc. 

Compare, for example, the doc for font-locking with that for character
composition. Even if these features are not of the same scale, you can see a
qualitative difference in the doc support.

Look at the commentary in file font-lock.el - a section explaining clearly "How
Font Lock mode fontifies", and another section explaining "What is fontification
for?". Plenty of Info doc, in both the Emacs and Elisp manuals.

Character composition should be better documented. I can understand if the
author is not comfortable providing lots of English doc, but someone who
understands character composition should do so. Think in terms of how Emacs
users and Emacs-Lisp users might make use of this feature, then write that up
for those of us who are ignorant.

Thanks.
 
In GNU Emacs 23.0.94.1 (i386-mingw-nt5.1.2600)
 of 2009-05-24 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'