emacs-devel
[Top][All Lists]
Advanced

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

Re: New Mac OS Changes


From: Kenichi Handa
Subject: Re: New Mac OS Changes
Date: Mon, 30 Oct 2000 10:46:13 +0900 (JST)

Kenichi Handa <address@hidden> writes:
> Ok.  As it seems that there's no objection, I'll soon
> install codes to support mule-unicode-2500-33ff and
> mule-unicode-e000-ffff, then send a patch for
> lisp/term/mac-win to Andrew so that he can test it before
> installing it.  I think I can finish them by the next
> Monday.

I've just installed these changes for those new charsets.

2000-10-30  Kenichi Handa  <address@hidden>

        * international/mule-conf.el: New charsets mule-unicode-2500-33ff
        and mule-unicode-e000-ffff.

        * international/mule.el (decode-char, encode-char): New functions.
        (make-coding-system): Accept a symbol of translation table as a
        value of property `safe-chars'.

        * international/mule-cmds.el (encode-coding-char): Check property
        safe-chars instead of safe-charsets.

        * international/fontset.el (fontset-default): Modified for
        mule-unicode-2500-33ff and mule-unicode-e000-ffff.
        (x-font-name-charset-alist): Likewise.
        (ccl-encode-unicode-font): New CCL program.  Record it in
        font-ccl-encoder-alist to be used for fonts "ISO10646-1".

        * language/european.el (mac-roman-decoder, mac-roman-encoder): New
        translation tables.
        (decode-mac-roman, encode-mac-roman): Definition of these CCL
        programs are modified and moved from mac-win.el.
        (mac-roman): Definition of this coding system is modified and
        moved from mac-win.el.

Andrew, I moved the code for mac-roman encoding (except for
font encoding) to european.el, because even a Unix user may
have to read/write a file with this encoding.

And the attached is a change to mac-win.el which is not yet
installed.  Please check these changes.  I deleted
mac-roman-kbd-mode entirely because the same facility should
be available just by setting keyboard coding system to
`mac-roman' (C-x RET k mac-roman RET).  Please verify it.

---
Ken'ichi HANDA
address@hidden

        * term/mac-win.el: (decode-mac-roman, encode-mac-roman,
        mac-roman): Moved to european.el.
        (ccl-encode-mac-roman-font, fontset-mac): Modified for
        mule-unicode-2500-33ff and mule-unicode-e000-ffff.
        (mac-roman-kbd-insert, mac-roman-kbd-mode): These functions
        deleted.
        (mac-roman-kbd-mode, mac-roman-kbd-mode-map): These variables
        deleted.
        
Index: lisp/term/mac-win.el
===================================================================
RCS file: /cvs/old/emacs21/lisp/term/mac-win.el,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 mac-win.el
*** lisp/term/mac-win.el        2000/10/25 11:18:36     1.1.1.1
--- lisp/term/mac-win.el        2000/10/30 01:12:15
***************
*** 170,306 ****
  (defconst kTextEncodingISOLatin1 513 "0x201")
  (defconst kTextEncodingISOLatin2 514 "0x202")
  
- ;; Definitions for the Mac Roman character sets and coding system.
- ;; The Mac Roman encoding uses all 128 code points in the range 128 to
- ;; 255 for actual characters.  Since Emacs cannot handle this many
- ;; code points as one character set, we divide it into two:
- ;; mac-roman-lower for code points 128 to 159 and mac-roman-upper for
- ;; code points 160 to 255.
- 
- ;; Since Mac Roman does not follow the ISO 2022 standard and uses code
- ;; points in the range 128-159, it is necessary to define it as a
- ;; type-4 charset, with CCL programs and all.
- 
- (define-ccl-program decode-mac-roman
-   `(2
-     ((loop
-       (read r0)
-       (if (r0 < 128)  ;; ASCII
-         (if (r0 == ?\r)  ;; assume such a file uses Mac EOL's
-             (write-repeat ?\n)
-           (write-repeat r0))
-       (if (r0 < 160)  ;; lower
-           ((r0 += 32)
-            (r1 = ,(charset-id 'mac-roman-lower))
-            (write-multibyte-character r1 r0)
-            (repeat))
-         ((r1 = ,(charset-id 'mac-roman-upper))  ;; upper
-          (write-multibyte-character r1 r0)
-          (repeat)))))))
-   "CCL program to decode Mac Roman")
- 
- (define-ccl-program encode-mac-roman
-   `(1
-     ((loop
-       (read-multibyte-character r0 r1)
-       (if (r0 == ,(charset-id 'ascii))
-         (if (r1 == ?\n)
-             (write-repeat ?\r)
-           (write-repeat r1))
-       (if (r0 == ,(charset-id 'mac-roman-lower))
-           ((r1 += 96)
-            (write-repeat r1))
-         (if (r0 == ,(charset-id 'mac-roman-upper))
-             ((r1 += 128)
-              (write-repeat r1))))))))
-   "CCL program to encode Mac Roman")
- 
- (make-coding-system
-  'mac-roman 4 ?M "Mac Roman Encoding"
-  '(decode-mac-roman . encode-mac-roman)
-  '((safe-charsets ascii mac-roman-lower mac-roman-upper)
-    (valid codes (0 . 255))))
  
- ;; This doesn't seem to do anything for type-4 charsets:
- ;; (put 'mac-roman 'eol-type (make-subsidiary-coding-system 'mac-roman))
- 
  (define-ccl-program ccl-encode-mac-roman-font
    `(0
!     (if (r0 == ,(charset-id 'mac-roman-lower))
!       (r1 += 96)
!       (r1 += 128))))
  
  (setq font-ccl-encoder-alist
        (cons '("mac-roman" . ccl-encode-mac-roman-font)
            font-ccl-encoder-alist))
  
  (if (fboundp 'new-fontset)
      (progn
        (create-fontset-from-fontset-spec
         "-etl-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-mac,
!         mac-roman-lower:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman,
!         mac-roman-upper:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman"
!        t)))
  
  ;; To display filenames in Chinese or Japanese, replace mac-roman with
  ;; big5 or sjis
  (setq file-name-coding-system 'mac-roman)
  
  ;; (prefer-coding-system 'mac-roman)
- 
- (defun mac-roman-kbd-insert ()
-   "Insert a character in Mac Roman encoding at point.\n\
- Called by keymap of Mac-kbd minor mode."
-   (interactive "*")
-   (let ((ch last-command-char))
-     (if (< ch 160)
-       (insert
-        (make-char 'mac-roman-lower
-                   (- last-command-char 96)))
-       (insert
-        (make-char 'mac-roman-upper
-                 (- last-command-char 128))))))
- 
- (defvar mac-roman-kbd-mode nil
-   "Non-nil if in Mac-kbd minor mode.")
- 
- (put 'mac-roman-kbd-mode 'permanent-local t)
- 
- (or (assq 'mac-roman-kbd-mode minor-mode-alist)
-     (setq minor-mode-alist
-         (cons '(mac-roman-kbd-mode " Mac-kbd") minor-mode-alist)))
- 
- (defvar mac-roman-kbd-mode-map
-   (let ((map (make-keymap))
-       (i 128))
-     (while (< i 256)
-       (define-key map (vector i) 'mac-roman-kbd-insert)
-       (setq i (1+ i)))
-     map)
-   "Keymap for Mac-kbd minor mode.")
- 
- (or (assq 'mac-roman-kbd-mode minor-mode-map-alist)
-     (setq minor-mode-map-alist
-         (cons (cons 'mac-roman-kbd-mode mac-roman-kbd-mode-map)
-               minor-mode-map-alist)))
- 
- (defun mac-roman-kbd-mode (&optional arg)
-   "Toggle Mac Roman Keyboard (Mac-kbd) minor mode.\n\
- In this minor mode, characters in the range 128 to 255 generated by\n\
- the Mac keyboard are inserted as mac-roman-lower or mac-roman-upper\n\
- characters, in the mac-roman encoding.\n\
- \n\
- With an argument, a positive argument enables Mac Roman Keyboard mode,\n\
- and a negative argument disables it."
-   (interactive "P")
-   (if (if arg
-         ;; Negative arg means switch it off.
-         (<= (prefix-numeric-value arg) 0)
-       ;; No arg means toggle.
-       mac-roman-kbd-mode)
-       (setq mac-roman-kbd-mode nil)
-     ;; Enable mode.
-     (setq mac-roman-kbd-mode t)))
  
  ;;
  ;; Available colors
--- 170,214 ----
  (defconst kTextEncodingISOLatin1 513 "0x201")
  (defconst kTextEncodingISOLatin2 514 "0x202")
  
  
  (define-ccl-program ccl-encode-mac-roman-font
    `(0
!     (if (r0 != ,(charset-id 'ascii))
!       (if (r0 == ,(charset-id 'latin-iso8859-1))
!           (r1 += 128)
!         ((r1 <<= 7)
!          (r1 |= r2)
!          (translate-character mac-roman-encoder r0 r1)))))
!   "CCL program for Mac Roman font")
  
  (setq font-ccl-encoder-alist
        (cons '("mac-roman" . ccl-encode-mac-roman-font)
            font-ccl-encoder-alist))
  
+ ;; Create a fontset that uses mac-roman font.  With this fontset,
+ ;; characters decoded from mac-roman encoding (ascii, latin-iso8859-1,
+ ;; and mule-unicode-xxxx-yyyy) are displayed by a mac-roman font.
+ 
  (if (fboundp 'new-fontset)
      (progn
        (create-fontset-from-fontset-spec
         "-etl-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-mac,
! ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman")
!       (let ((monaco-font '("monaco" . "mac-roman")))
!       (map-char-table
!        (function
!         (lambda (key val)
!           (or (generic-char-p key)
!               (memq (char-charset key)
!                     '(ascii eight-bit-control eight-bit-graphic))
!               (set-fontset-font "fontset-mac" key monaco-font))))
!        (get 'mac-roman-encoder 'translation-table)))))
  
  ;; To display filenames in Chinese or Japanese, replace mac-roman with
  ;; big5 or sjis
  (setq file-name-coding-system 'mac-roman)
  
  ;; (prefer-coding-system 'mac-roman)
  
  ;;
  ;; Available colors



reply via email to

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