[Mac-emacs-users] Bug Fix: Correctly Choosing Coding System for Mac Roman
Brought to you by:
akochoi
|
From: Andrew C. <ch...@tr...> - 2000-04-03 03:05:08
|
Hi Everyone,
There is a bug in the .emacs file I posted on 20-03-2000 that prevents
Emacs from correctly choosing the right coding system to save a file
containing Mac Roman characters.
The code to construct the coding system was
;; INCORRECT
(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))
; ^ DELETE! ^ DELETE!
(valid codes (0 . 255))))
and it should actually read
;; CORRECT
(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))))
Also, if you want use cut-and-paste in Emacs with Mac Roman
characters, put the following in your .emacs file:
(set-selection-coding-system 'mac-roman)
(setq interprogram-cut-function
'(lambda (str push)
(mac-cut-function
(encode-coding-string str selection-coding-system t) push)))
(setq interprogram-paste-function
'(lambda ()
(decode-coding-string
(mac-paste-function) selection-coding-system t)))
Make sure your buffer is set to the mac-roman encoding:
C-x RET f mac-roman RET
and cutting-and-pasting clipboards with Mac Roman characters should
work correctly between Emacs and other applications. Together with
the fix above, you can save your files in Mac Roman encoding and open
it with other applications like Alpha or BB Edit too.
I'd like to thank Tsutomu for sending in those two previous bug fixes.
Cheers,
Andrew.
|