-;;; emu-e20.el --- emu API implementation for Emacs/mule (19.34.91-delta)
+;;; emu-e20.el --- emu API implementation for Emacs 20.1 and 20.2
-;; Copyright (C) 1996,1997 Free Software Foundation, Inc.
+;; Copyright (C) 1996,1997,1998 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id: emu-e20.el,v 7.12 1997/02/13 08:18:53 morioka Exp $
;; Keywords: emulation, compatibility, Mule
;; This file is part of emu.
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
-;;; Code:
+;;; Commentary:
-;;; @ version specific features
-;;;
+;; This module requires Emacs 20.1 and 20.2.
+
+;;; Code:
(require 'emu-19)
;; (defalias 'charset-columns 'charset-width)
(defun find-non-ascii-charset-string (string)
- "Return a list of charsets in the STRING except ascii.
-\[emu-e20.el; Mule emulating function]"
+ "Return a list of charsets in the STRING except ascii."
(delq 'ascii (find-charset-string string))
)
(defun find-non-ascii-charset-region (start end)
"Return a list of charsets except ascii
-in the region between START and END.
-\[emu-e20.el; Mule emulating function]"
+in the region between START and END."
(delq 'ascii (find-charset-string (buffer-substring start end)))
)
;;; @ coding system
;;;
-(defconst *noconv* 'no-conversion)
-
-(defmacro as-binary-process (&rest body)
- `(let (selective-display ; Disable ^M to nl translation.
- ;; for Emacs/mule
- (coding-system-for-read 'no-conversion)
- (coding-system-for-write 'no-conversion)
- )
- ,@ body))
-
-(defmacro as-binary-input-file (&rest body)
- `(let ((coding-system-for-read 'no-conversion))
- ,@body))
-
-(defmacro as-binary-output-file (&rest body)
- `(let ((coding-system-for-write 'no-conversion))
- ,@body))
+(defsubst-maybe find-coding-system (obj)
+ "Return OBJ if it is a coding-system."
+ (if (coding-system-p obj)
+ obj))
(defalias 'set-process-input-coding-system 'set-process-coding-system)
;;; @ binary access
;;;
-(defun insert-binary-file-contents-literally
- (filename &optional visit beg end replace)
- "Like `insert-file-contents-literally', q.v., but don't code conversion.
-A buffer may be modified in several ways after reading into the buffer due
-to advanced Emacs features, such as file-name-handlers, format decoding,
-find-file-hooks, etc.
- This function ensures that none of these modifications will take place."
- (let ((coding-system-for-read 'no-conversion))
- (insert-file-contents-literally filename visit beg end replace)
+(defun insert-file-contents-as-binary (filename
+ &optional visit beg end replace)
+ "Like `insert-file-contents', q.v., but don't code and format conversion.
+Like `insert-file-contents-literary', but it allows find-file-hooks,
+automatic uncompression, etc.
+
+Namely this function ensures that only format decoding and character
+code conversion will not take place."
+ (let ((flag enable-multibyte-characters)
+ (coding-system-for-read 'binary)
+ format-alist)
+ (insert-file-contents filename visit beg end replace)
+ (setq enable-multibyte-characters flag)
))
+(defalias 'insert-binary-file-contents 'insert-file-contents-as-binary)
+(make-obsolete 'insert-binary-file-contents 'insert-file-contents-as-binary)
+
+(defalias 'insert-binary-file-contents-literally
+ 'insert-file-contents-literally)
+
;;; @ MIME charset
;;;
+(defsubst encode-mime-charset-region (start end charset)
+ "Encode the text between START and END as MIME CHARSET."
+ (let (cs)
+ (if (and enable-multibyte-characters
+ (setq cs (mime-charset-to-coding-system charset)))
+ (encode-coding-region start end cs)
+ )))
+
+(defsubst decode-mime-charset-region (start end charset)
+ "Decode the text between START and END as MIME CHARSET."
+ (let (cs)
+ (if (and enable-multibyte-characters
+ (setq cs (mime-charset-to-coding-system charset)))
+ (decode-coding-region start end cs)
+ )))
+
+(defsubst encode-mime-charset-string (string charset)
+ "Encode the STRING as MIME CHARSET."
+ (let (cs)
+ (if (and enable-multibyte-characters
+ (setq cs (mime-charset-to-coding-system charset)))
+ (encode-coding-string string cs)
+ string)))
+
+(defsubst decode-mime-charset-string (string charset)
+ "Decode the STRING as MIME CHARSET."
+ (let (cs)
+ (if (and enable-multibyte-characters
+ (setq cs (mime-charset-to-coding-system charset)))
+ (decode-coding-string string cs)
+ string)))
+
+
(defvar charsets-mime-charset-alist
'(((ascii) . us-ascii)
((ascii latin-iso8859-1) . iso-8859-1)
chinese-cns11643-7) . iso-2022-int-1)
))
-(defvar default-mime-charset 'x-ctext)
-
-(defvar mime-charset-coding-system-alist
- '((x-ctext . ctext)
- (gb2312 . cn-gb-2312)
- (iso-2022-jp-2 . iso-2022-ss2-7)
- (iso-2022-int-1 . iso-2022-int)
- (shift_jis . sjis)
- ))
-
-(defun mime-charset-to-coding-system (charset &optional lbt)
- (if (stringp charset)
- (setq charset (intern (downcase charset)))
- )
- (let ((cs
- (or (cdr (assq charset mime-charset-coding-system-alist))
- (and (coding-system-p charset) charset)
- )))
- (if lbt
- (intern (concat (symbol-name cs) "-" (symbol-name lbt)))
- cs)))
-
-(defun detect-mime-charset-region (start end)
- "Return MIME charset for region between START and END. [emu-e20.el]"
- (charsets-to-mime-charset
- (find-charset-string (buffer-substring start end))
- ))
-
-(defun encode-mime-charset-region (start end charset)
- "Encode the text between START and END as MIME CHARSET. [emu-e20.el]"
- (let ((cs (mime-charset-to-coding-system charset)))
- (if cs
- (encode-coding-region start end cs)
- )))
-
-(defun decode-mime-charset-region (start end charset)
- "Decode the text between START and END as MIME CHARSET. [emu-e20.el]"
- (let ((cs (mime-charset-to-coding-system charset)))
- (if cs
- (decode-coding-region start end cs)
- )))
-
-(defun encode-mime-charset-string (string charset)
- "Encode the STRING as MIME CHARSET. [emu-e20.el]"
- (let ((cs (mime-charset-to-coding-system charset)))
- (if cs
- (encode-coding-string string cs)
- string)))
-
-(defun decode-mime-charset-string (string charset)
- "Decode the STRING as MIME CHARSET. [emu-e20.el]"
- (let ((cs (mime-charset-to-coding-system charset)))
- (if cs
- (decode-coding-string string cs)
- string)))
-
;;; @ character
;;;
;;;
;;; You should not use them.
-(defalias 'make-character 'make-char)
-
(defun char-category (character)
"Return string of category mnemonics for CHAR in TABLE.
CHAR can be any multilingual character
-TABLE defaults to the current buffer's category table.
-\[emu-e20.el; Mule emulating function]"
+TABLE defaults to the current buffer's category table."
(category-set-mnemonics (char-category-set character))
)
(defalias 'sset 'store-substring)
(defun string-to-char-list (string)
- "Return a list of which elements are characters in the STRING.
-\[emu-e20.el; Mule 2.3 emulating function]"
+ "Return a list of which elements are characters in the STRING."
(let* ((len (length string))
(i 0)
l chr)
;;; @ end
;;;
+(require 'emu-20)
+
(provide 'emu-e20)
;;; emu-e20.el ends here