[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: chinese word mode
From: |
William Xu |
Subject: |
Re: chinese word mode |
Date: |
Wed, 06 Nov 2013 23:37:10 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (darwin) |
Eric Abrahamsen <address@hidden> writes:
> 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.
modify-category-entry also accepts a range cons, where you can select
Chinese characters by range. For example,
(#x3400 . #x4DBF) ; CJK Unified Ideographs Extension A
(#x4E00 . #x9FFF) ; CJK Unified Ideographs
(#xF900 . #xFAFF) ; CJK Compatibility Ideographs
put-charset-property seems only accepts a charset..
> 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?
It can make those word movement functions useful. :)
--
William
http://xwl.appspot.com
Re: chinese word mode,
William Xu <=