emacs-pretest-bug
[Top][All Lists]
Advanced

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

emacs-unicode-2: copy & paste problem of non standard encoding ctext


From: Zhang Wei
Subject: emacs-unicode-2: copy & paste problem of non standard encoding ctext
Date: Sun, 19 Feb 2006 20:03:46 +0800

While copy and paste between Emacs unicode branch and a ctext required
software such as crxvt-gb, emacs can't format/decode correctly the
"gbk-0" encoded compound text.

With the following patch, emacs could accept gbk-0 encoded selection,
but still can't paste to crxvt-gb.

btw, because emacs-unicode-2 has a different internal character
representation, functions such as `following-char' and 'char-after',
return a quite different value from emacs22. We have to replace every
occurrence of these function with:

(multibyte-char-to-unibyte (char-after ... ))
(multibyte-char-to-unibyte (following-char ... ))

May be change the definitions of these functions is a better solution.

--- orig/lisp/international/mule.el
+++ mod/lisp/international/mule.el
@@ -1345,7 +1345,8 @@
 (defvar ctext-non-standard-encodings-alist
   '(("big5-0" big5 2 (chinese-big5-1 chinese-big5-2))
     ("ISO8859-14" iso-8859-14 1 latin-iso8859-14)
-    ("ISO8859-15" iso-8859-15 1 latin-iso8859-15))
+    ("ISO8859-15" iso-8859-15 1 latin-iso8859-15)
+    ("gbk-0" gbk 2 chinese-gbk))
   "Alist of non-standard encoding names vs the corresponding usages in CTEXT.
 
 It controls how extended segments of a compound text are handled
@@ -1375,7 +1376,7 @@
 `ctext-non-standard-encodings' are used.")
 
 (defvar ctext-non-standard-encodings
-  '("big5-0")
+  '("big5-0" "gbk-0")
   "List of non-standard encoding names used in extended segments of CTEXT.
 Each element must be one of the names listed in the variable
 `ctext-non-standard-encodings-alist' (which see).")
@@ -1412,8 +1413,8 @@
          (setq pos (match-beginning 0))
          (if (match-beginning 1)
              ;; ESC % / [0-4] M L --ENCODING-NAME-- \002 --BYTES--
-             (let* ((M (char-after (+ pos 4)))
-                    (L (char-after (+ pos 5)))
+             (let* ((M (multibyte-char-to-unibyte (char-after (+ pos 4))))
+                    (L (multibyte-char-to-unibyte (char-after (+ pos 5))))
                     (encoding (match-string 2))
                     (encoding-info (assoc-string
                                     encoding

--- orig/lisp/language/chinese.el
+++ mod/lisp/language/chinese.el
@@ -228,7 +228,9 @@
                 (coding-system chinese-gbk)
                 (coding-priority gbk iso-2022-cn chinese-big5
                                  chinese-iso-8bit) ; fixme?
+                (ctext-non-standard-encodings "gbk-0")          
                 (input-method . "chinese-py-punct") ; fixme?
+                (sample-text . "Chinese (中文,普通话,汉语) 妳好")
                 (features china-util)
                 (documentation . "Support for Chinese GBK character set."))
  '("Chinese"))
 


In GNU Emacs 23.0.0.7 (i686-pc-linux-gnu, GTK+ Version 2.8.9)
 of 2006-02-19 on emacsfans.tsinghua.edu.cn
X server distributor `The X.Org Foundation', version 11.0.60802000
configured using `configure '--with-gtk' 'CFLAGS=-g''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: zh_CN.GBK
  locale-coding-system: gbk
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  gnus-undo-mode: t
  display-time-mode: t
  delete-selection-mode: t
  pc-selection-mode: t
  auto-image-file-mode: t
  tooltip-mode: t
  auto-compression-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<right> <down> <up> <left> <left> C-d C-d C-d C-d C-d 
C-d C-d C-d C-d C-d C-d C-x C-s <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<next> <next> <next> <next> <next> <next> <next> <prior> 
<prior> <prior> <prior> <prior> <prior> <prior> <prior> 
<prior> <prior> <prior> <prior> <prior> <prior> <prior> 
<prior> <prior> M-x g n u s <return> C y g <return> 
q <return> <return> q M-x r e p o r t <tab> <retur
n>

Recent messages:
Fetching headers for gnu.emacs.help...done
Scoring...done
Generating summary...done
Loading gnus-bcklg...done
Loading mail-extr...done
Loading ansi-color...done
Loading smiley...done
Loading gnus-cite...done
No more unread newsgroups
Loading emacsbug...done

-- 
Zhang Wei or Brep
<address@hidden>




reply via email to

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