emacs-devel
[Top][All Lists]
Advanced

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

Re: chinese word mode


From: Eric Abrahamsen
Subject: Re: chinese word mode
Date: Wed, 06 Nov 2013 14:59:12 +0800
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

Eric Abrahamsen <address@hidden> writes:

[...]

> (define-minor-mode thai-word-mode
>   :global t :group 'mule
>   (cond (thai-word-mode
>        ;; This enables linebreak between Thai characters.
>        (modify-category-entry (make-char 'thai-tis620) ?|)
>        ;; This enables linebreak at a Thai word boundary.
>        (put-charset-property 'thai-tis620 'fill-find-break-point-function
>                              'thai-fill-find-break-point))
>       (t
>        (modify-category-entry (make-char 'thai-tis620) ?| nil t)
>        (put-charset-property 'thai-tis620 'fill-find-break-point-function
>                              nil))))
>

[...]

> My buffers are utf-8 encoded, and describe-char on a Chinese character
> shows "preferred charset: unicode-bmp". So what do I put for the charset
> in order to make these functions target the right characters? Chinese
> characters all seem to have the "|" line-breakable category by default,
> but (I think) I can only add the custom fill break point function one
> charset at a time.

I've tried slapping the 'fill-find-break-point-function onto the
'unicode charset for now, and it works fine because the function only
does anything if point is in the midst of Chinese. It presumably gets
applied to all characters, though, and that can't be a real solution.

I'm guessing I'll need to separate simplified and traditional word sets
and make two versions of the mode. Both modes will loop through their
applicable charsets and apply/remove the custom break point function.

Assuming I fix this problem and other inevitable bugs, would this
library be of general interest to Emacs? The dictionary comes from the
(relatively authoritative) CC-CEDCIT project[1], which is licensed under
the Creative Commons Attribution-Share Alike 3.0 License. I've lopped
off some non-applicable dictionary entries, and everything over four
characters long, since those are usually compound phrasal entries.

Eric

[1] http://cc-cedict.org/wiki/




reply via email to

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