help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: getting Mule, Unicode & X selection to play together


From: Roman Belenov
Subject: Re: getting Mule, Unicode & X selection to play together
Date: Mon, 16 Dec 2002 12:30:12 +0300
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-msvc-nt5.1.2600)

Michael Livshin <usenet@cmm.kakpryg.net> writes:

> so basically I'd like Emacs to somehow recognize the cyrillic
> characters in the X selection it receives, and to convert them into
> the codes it itself uses for the same characters.  how do I do that?

I've patched utf-8.el (located in lisp/international) to make it use
cyrillic-iso8859-5 character set (the patch is against file from
GNU Emacs 21.2); I guess it should solve your problem.

CVS version already has support for it (although I never tried it,
just looked through sources).


==============================================================================
--- utf-8.el.orig       2002-12-16 12:06:57.000000000 +0300
+++ utf-8.el    2002-09-04 17:39:50.000000000 +0400
@@ -116,14 +116,18 @@
                      ((r0 = ,(charset-id 'latin-iso8859-1))
                       (r1 -= 128)
                       (write-multibyte-character r0 r1))
-
+            ((r2 = (r1 <= #x045f))
+             (if ((r1 >= #x0400) & r2)
+                 ((r0 = ,(charset-id 'cyrillic-iso8859-5))
+                  (r1 -= #x03e0)
+                  (write-multibyte-character r0 r1))
                    ;; mule-unicode-0100-24ff (< 0800)
                    ((r0 = ,(charset-id 'mule-unicode-0100-24ff))
                     (r1 -= #x0100)
                     (r2 = (((r1 / 96) + 32) << 7))
                     (r1 %= 96)
                     (r1 += (r2 + 32))
-                    (write-multibyte-character r0 r1)))))))
+            (write-multibyte-character r0 r1)))))))))
 
          ;; 3byte encoding
          ;; zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx
@@ -246,6 +250,12 @@
             (r1 &= #x3f)
             (r1 |= #x80)
             (write r0 r1))
+      (if (r0 == ,(charset-id 'cyrillic-iso8859-5))
+          ((r0 = (((r1 - #x20) >> 6) | #xd0))
+           (r1 -= #x20)
+           (r1 &= #x3f)
+           (r1 |= #x80)
+           (write r0 r1))
 
          (if (r0 == ,(charset-id 'mule-unicode-0100-24ff))
              ((r0 = ((((r1 & #x3f80) >> 7) - 32) * 96))
@@ -327,7 +337,7 @@
                    ;; Output U+FFFD, which is `ef bf bd' in UTF-8.
                    ((write #xef)
                     (write #xbf)
-                    (write #xbd)))))))))
+            (write #xbd))))))))))
       (repeat)))
     (if (r1 >= #xa0)
        (write r1)
@@ -348,6 +358,7 @@
    eight-bit-control
    eight-bit-graphic
    latin-iso8859-1
+   cyrillic-iso8859-5
    mule-unicode-0100-24ff
    mule-unicode-2500-33ff
    mule-unicode-e000-ffff
@@ -367,6 +378,7 @@
     eight-bit-control
     eight-bit-graphic
     latin-iso8859-1
+    cyrillic-iso8859-5
     mule-unicode-0100-24ff
     mule-unicode-2500-33ff
     mule-unicode-e000-ffff)
==============================================================================

-- 
                                                        With regards, Roman.




reply via email to

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