Dear Werner,
Here it is - should work just with
git am < ...patch
The change log entry is basically a shorter version of the important bits in the
last two e-mails.
I tested examples/{CJKbabel.tex, muletest.tex, rubytest.tex, thai.tex}
with emacs 22.3 and 23.3, and EMACS_PRETEST_24_0_92-142-g559675b (earlier
today's emacs git master head). AFAIK it is working as it was with emacs 22.
Cheers,
Hin-Tak
Werner LEMBERG wrote:
Dear Hin-Tak!
Thanks a lot for your hard work. Unfortunately, I don't have enough
time to work on it currently, so I save your emails for later
reference. I would be glad if you could prepare a patch (with a
proper ChangeLog entry) so that everyone interested can test it
easily.
Werner
>From db0183e52f9d25c95bcee62d82ade153dacae886 Mon Sep 17 00:00:00 2001
From: Hin-Tak Leung <ht...@users.sourceforge.net>
Date: Fri, 16 Dec 2011 22:16:58 +0000
Subject: [PATCH] utils/lisp/emacs/cjk-enc.el: emacs 23+ related adaptions.
See ChangeLog as well as within-code comments for details.
---
ChangeLog | 27 ++++++++++++++++++
utils/lisp/emacs/cjk-enc.el | 63 ++++++++++++++++++++++++++++++++++++++-----
2 files changed, 83 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a57c7bd..fb52951 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2011-12-16 Hin-Tak Leung <ht...@users.sourceforge.net>
+
+ * utils/lisp/emacs/cjk-enc.el: emacs 23+ related adaptions.
+
+ 'make-coding-system" is deprecated - use 'define-coding-system
+ instead.
+
+ emacs 23+ uses unicode internally and a new charset-priority
+ system is introduced.
+ 'char-charset and 'split-char preferably return 'unicode as
+ charset and unicode code-point, instead of localised
+ charset/code-point, and are sensitive to charset-priority.
+ Switch over to use the much-improved get-text-property 'charset as
+ localized charset, instead of the outcome of 'char-charset ; and also
+ explicitly set highest priority the current text-property 'charset,
+ in order for 'split-char to operate by localized charset.
+
+ A new charset/text-property called 'tis620-2533' (superset of
+ 'ascii and 'thai-tis620) is introduced in emacs 23+ . This has
+ the tendency of swallowing up every ascii character and go into
+ an infinite loop with examples/thai.tex, so switch back to use
+ 'char-charset with restriction - 'char-charset in emacs 23+
+ accept an optional restriction list.
+
+ Tested with emacs 22.3 and 23.3, and EMACS_PRETEST_24_0_92-142-g559675b
+ on examples/{CJKbabel.tex, muletest.tex, rubytest.tex, thai.tex} .
+
2011-12-03 Werner LEMBERG <w...@gnu.org>
* examples/thai.tex: Improve prologue comments.
diff --git a/utils/lisp/emacs/cjk-enc.el b/utils/lisp/emacs/cjk-enc.el
index 4d1bae5..87f912f 100644
--- a/utils/lisp/emacs/cjk-enc.el
+++ b/utils/lisp/emacs/cjk-enc.el
@@ -4,6 +4,7 @@
;; Author: Kenichi HANDA <ha...@etl.go.jp>
;; Werner LEMBERG <w...@gnu.org>
+;; Hin-Tak Leung <ht...@users.sourceforge.net> (emacs 23+ related
changes)
;; Keywords: CJK package, LaTeX2e, emacs, xemacs
@@ -549,12 +550,45 @@
"Coding-system for LaTeX2e CJK Package"
'(mnemonic "CJK"
pre-write-conversion cjk-encode))
- (make-coding-system
- 'cjk-coding 0 ?c
- "Coding-system for LaTeX2e CJK Package"
- nil
- '((pre-write-conversion . cjk-encode))))
-
+ (if (< emacs-major-version 23)
+ (make-coding-system
+ 'cjk-coding 0 ?c
+ "Coding-system for LaTeX2e CJK Package"
+ nil
+ '((pre-write-conversion . cjk-encode)))
+ ;; make-coding-system deprecated in emacs 23+
+ (define-coding-system
+ 'cjk-coding
+ "Coding-system for LaTeX2e CJK Package"
+ :mnemonic ?c
+ :coding-type 'emacs-mule
+ :default-char ?
+ :charset-list '(ascii
+ latin-iso8859-1
+ latin-iso8859-2
+ latin-iso8859-3
+ latin-iso8859-4
+ cyrillic-iso8859-5
+ greek-iso8859-7
+ thai-tis620
+ vietnamese-viscii-lower
+ vietnamese-viscii-upper
+ latin-jisx0201
+ katakana-jisx0201
+ japanese-jisx0208
+ japanese-jisx0212
+ korean-ksc5601
+ chinese-gb2312
+ chinese-big5-1
+ chinese-big5-2
+ chinese-cns11643-1
+ chinese-cns11643-2
+ chinese-cns11643-3
+ chinese-cns11643-4
+ chinese-cns11643-5
+ chinese-cns11643-6
+ chinese-cns11643-7)
+ :pre-write-conversion 'cjk-encode)))
;; XEmacs doesn't have set-buffer-multibyte.
;;
@@ -602,11 +636,26 @@
(setq prev-charset 'ascii)
(while (not (eobp))
+ (setq tpch (get-text-property (point) 'charset))
+ ;; get-text-property in emacs 23+ is a more reliable
+ ;; locality indicator; return harmless nil in emacs 22
(setq ch (following-char))
(set-buffer work-buf)
;; Set CHARSET to the character set of the current character.
- (setq charset (char-charset ch))
+ ;; use text-property (emacs 23+) in preference to char-charset)
+ (if (not (eq tpch nil))
+ (setq charset tpch)
+ (setq charset (char-charset ch))
+ )
+ ;; tis620-2533 has a problem with swallowing all the ascii
+ (if (eq charset 'tis620-2533)
+ ;; emacs 23's char-charset takes an optional restriction list
+ (setq charset (char-charset ch '(thai-tis620 ascii))))
+ ;; split-char below in emacs 23+ is sensitive to charset-priority
+ (cond ((> emacs-major-version 22)
+ (if (not (eq charset 'ascii))
+ (set-charset-priority charset))))
(if (eq charset 'ascii)
;; Not a multibyte character.
(progn
--
1.7.7.4
_______________________________________________
Cjk maillist - Cjk@ffii.org
https://lists.ffii.org/mailman/listinfo/cjk