;;; @ character set
;;;
-(defconst charset-ascii 0 "Character set of ASCII")
-(defconst charset-jisx0208 146 "Character set of JIS X0208-1983")
+(put 'ascii
+ 'charset-description "Character set of ASCII")
+(put 'ascii
+ 'charset-registry "ASCII")
+
+(put 'japanese-jisx0208
+ 'charset-description "Character set of JIS X0208-1983")
+(put 'japanese-jisx0208
+ 'charset-registry "JISX0208.1983")
(defun charset-description (charset)
"Return description of CHARSET. [emu-nemacs.el]"
- (if (< charset 128)
- (documentation-property 'charset-ascii 'variable-documentation)
- (documentation-property 'charset-jisx0208 'variable-documentation)
- ))
+ (get charset 'charset-description)
+ )
(defun charset-registry (charset)
"Return registry name of CHARSET. [emu-nemacs.el]"
- (if (< charset 128)
- "ASCII"
- "JISX0208.1983"))
+ (get charset 'charset-registry)
+ )
-(defun charset-columns (charset)
+(defun charset-width (charset)
"Return number of columns a CHARSET occupies when displayed.
\[emu-nemacs.el]"
- (if (< charset 128)
+ (if (eq charset 'ascii)
1
2))
"Return a list of charsets in the string.
\[emu-nemacs.el; Mule emulating function]"
(if (string-match "[\200-\377]" str)
- (list lc-jp)
+ '(japanese-jisx0208)
))
(defalias 'find-non-ascii-charset-string 'find-charset-string)
(goto-char start)
(re-search-forward "[\200-\377]" nil t)
))
- (list lc-jp)
+ '(japanese-jisx0208)
))
(defalias 'find-non-ascii-charset-region 'find-charset-region)
;;; @@ for old MULE emulation
;;;
-(defconst lc-ascii 0)
-(defconst lc-jp 146)
+;;(defconst lc-ascii 0)
+;;(defconst lc-jp 146)
;;; @ coding system
(fset 'insert-binary-file-contents 'insert-file-contents-as-binary)
+(defun insert-file-contents-as-raw-text (filename
+ &optional visit beg end replace)
+ "Like `insert-file-contents', q.v., but don't character code conversion.
+\[emu-nemacs.el]"
+ (let (kanji-flag)
+ (insert-file-contents filename visit beg end replace)
+ ))
+
(defun insert-binary-file-contents-literally (filename
&optional visit beg end replace)
"Like `insert-file-contents-literally', q.v., but don't code conversion.
;;;
(defvar charsets-mime-charset-alist
- (list (cons (list charset-ascii) 'us-ascii)))
+ '(((ascii) . us-ascii)))
(defvar default-mime-charset 'iso-2022-jp)
(convert-string-kanji-code string cs 3)
string)))
+(defun write-region-as-mime-charset (charset start end filename)
+ "Like `write-region', q.v., but code-convert by MIME CHARSET.
+\[emu-nemacs.el]"
+ (let ((kanji-fileio-code
+ (or (mime-charset-to-coding-system charset)
+ *noconv*)))
+ (write-region start end filename)
+ ))
+
+
+;;; @ buffer representation
+;;;
+
+(defsubst-maybe set-buffer-multibyte (flag)
+ "Set the multibyte flag of the current buffer to FLAG.
+If FLAG is t, this makes the buffer a multibyte buffer.
+If FLAG is nil, this makes the buffer a single-byte buffer.
+The buffer contents remain unchanged as a sequence of bytes
+but the contents viewed as characters do change.
+\[Emacs 20.3 emulating function]"
+ (setq kanji-flag flag)
+ )
+
;;; @ character
;;;
"Return the character set of char CHR.
\[emu-nemacs.el; MULE emulating function]"
(if (< chr 128)
- charset-ascii
- charset-jisx0208))
+ 'ascii
+ 'japanese-jisx0208))
(defun char-bytes (chr)
"Return number of bytes CHAR will occupy in a buffer.
1
2))
+(defalias 'char-length 'char-bytes)
+
(defmacro char-next-index (char index)
"Return index of character succeeding CHAR whose index is INDEX."
- (` (1+ index)))
-
-;;; @@ Old Mule emulating aliases
-;;;
-;;; You should not use them.
-
-(defalias 'char-leading-char 'char-charset)
-
-;;; @@ obsoleted aliases
-;;;
-;;; You should not use them.
-
-(defalias 'char-length 'char-bytes)
-(defalias 'char-columns 'char-width)
+ (` (+ (, index) (char-bytes (, char)))))
;;; @ string
;;;
-(defalias 'string-columns 'length)
+(defalias 'string-width 'length)
(defun sref (str idx)
"Return the character in STR at index IDX.
(setq to to-prev)))
(substring str from to))))
-;;; @@ for Mule emulation
+(defalias 'looking-at-as-unibyte 'looking-at)
+
+;;; @@ obsoleted aliases
;;;
+;;; You should not use them.
-(defalias 'string-width 'length)
+(defalias 'string-columns 'length)
;;; @ text property emulation