Permalink
Browse files

Sync up with apel-7_6-char-next-index.

  • Loading branch information...
1 parent 9b19988 commit 88b7f5a3012c849d9adacfe03c554a6c50a69ef8 morioka committed Apr 9, 1998
Showing with 206 additions and 74 deletions.
  1. +5 −0 ChangeLog
  2. +44 −18 emu-e19.el
  3. +38 −8 emu-e20.el
  4. +78 −35 emu-mule.el
  5. +37 −13 emu-nemacs.el
  6. +4 −0 emu-x20.el
View
@@ -1,3 +1,8 @@
+1998-04-09 MORIOKA Tomohiko <morioka@mousai.jaist.ac.jp>
+
+ * emu-e20.el, emu-x20.el, emu-e19.el, emu-mule.el, emu-nemacs.el
+ (char-next-index): New macro.
+
1998-03-26 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* std11.el: Require 'std11-parse when compile.
View
@@ -1,9 +1,8 @@
-;;; emu-e19.el --- emu module for Emacs 19 and XEmacs 19
+;;; emu-e19.el --- emu module for Emacs 19 and XEmacs without MULE
-;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id$
;; Keywords: emulation, compatibility, mule, Latin-1
;; This file is part of emu.
@@ -160,8 +159,23 @@ else returns nil. [emu-e19.el; old MULE emulating function]"
;;; @ binary access
;;;
-(defun insert-binary-file-contents-literally
- (filename &optional 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 ((emx-binary-mode t))
+ (insert-file-contents filename visit beg end replace)
+ ))
+
+(defalias 'insert-binary-file-contents 'insert-file-contents-as-binary)
+(make-obsolete 'insert-binary-file-contents 'insert-file-contents-as-binary)
+
+(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,
@@ -171,6 +185,13 @@ find-file-hooks, etc.
(insert-file-contents-literally filename visit beg end replace)
))
+(defun write-region-as-binary (start end filename
+ &optional append visit lockname)
+ "Like `write-region', q.v., but don't code conversion."
+ (let ((emx-binary-mode t))
+ (write-region start end filename append visit lockname)
+ ))
+
;;; @ MIME charset
;;;
@@ -222,32 +243,37 @@ find-file-hooks, etc.
;;; @ character
;;;
-(defun char-charset (chr)
- "Return the character set of char CHR.
-\[emu-e19.el; XEmacs 20 emulating function]"
+(defun char-charset (char)
+ "Return the character set of char CHAR."
(if (< chr 128)
charset-ascii
charset-latin-iso8859-1))
(defun char-bytes (char)
- "Return number of bytes a character in CHAR occupies in a buffer.
-\[emu-e19.el; MULE emulating function]"
+ "Return number of bytes a character in CHAR occupies in a buffer."
1)
-(defalias 'char-length 'char-bytes)
-
-(defun char-columns (character)
- "Return number of columns a CHARACTER occupies when displayed.
-\[emu-e19.el]"
+(defun char-width (char)
+ "Return number of columns a CHAR occupies when displayed."
1)
-;;; @@ for old MULE emulation
-;;;
+(defmacro char-next-index (char index)
+ "Return index of character succeeding CHAR whose index is INDEX."
+ (` (1+ index)))
-(defalias 'char-width 'char-columns)
+;;; @@ 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)
+
;;; @ string
;;;
View
@@ -1,9 +1,8 @@
-;;; emu-e20.el --- emu API implementation for Emacs 20
+;;; 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$
;; Keywords: emulation, compatibility, Mule
;; This file is part of emu.
@@ -25,7 +24,7 @@
;;; Commentary:
-;; This module requires Emacs 20.1 or later.
+;; This module requires Emacs 20.1 and 20.2.
;;; Code:
@@ -73,6 +72,31 @@ in the region between START and END."
(defalias 'set-process-input-coding-system 'set-process-coding-system)
+;;; @ binary access
+;;;
+
+(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
;;;
@@ -150,10 +174,9 @@ in the region between START and END."
;;; @ character
;;;
-(defalias 'char-length 'char-bytes)
-
-(defalias 'char-columns 'char-width)
-
+(defmacro char-next-index (char index)
+ "Return index of character succeeding CHAR whose index is INDEX."
+ `(+ index (char-bytes char)))
;;; @@ Mule emulating aliases
;;;
@@ -166,6 +189,13 @@ TABLE defaults to the current buffer's category table."
(category-set-mnemonics (char-category-set character))
)
+;;; @@ obsoleted aliases
+;;;
+;;; You should not use them.
+
+(defalias 'char-length 'char-bytes)
+(defalias 'char-columns 'char-width)
+
;;; @ string
;;;
View
@@ -1,9 +1,9 @@
;;; emu-mule.el --- emu module for Mule 1.* and Mule 2.*
-;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
+;; Copyright (C) 1995,1996,1997,1998 MORIOKA Tomohiko
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Id$
+;; Katsumi Yamaoka <yamaoka@jpl.org>
;; Keywords: emulation, compatibility, Mule
;; This file is part of emu.
@@ -141,19 +141,53 @@
;;; @ binary access
;;;
-(defun insert-binary-file-contents-literally
- (filename &optional 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 (mc-flag
+ (file-coding-system *noconv*))
+ (insert-file-contents filename visit beg end replace)
+ ))
+
+(defalias 'insert-binary-file-contents 'insert-file-contents-as-binary)
+(make-obsolete 'insert-binary-file-contents 'insert-file-contents-as-binary)
+
+(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 (mc-flag
- (file-coding-system *noconv*)
- )
+ (file-coding-system *noconv*))
(insert-file-contents-literally filename visit beg end replace)
))
+(if running-emacs-19_29-or-later
+ ;; for MULE 2.3 based on Emacs 19.34.
+ (defun write-region-as-binary (start end filename
+ &optional append visit lockname)
+ "Like `write-region', q.v., but don't code conversion."
+ (let (mc-flag
+ (file-coding-system *noconv*))
+ (write-region start end filename append visit lockname)
+ ))
+ ;; for MULE 2.3 based on Emacs 19.28.
+ (defun write-region-as-binary (start end filename
+ &optional append visit lockname)
+ "Like `write-region', q.v., but don't code conversion."
+ (let (mc-flag
+ (file-coding-system *noconv*))
+ (write-region start end filename append visit)
+ ))
+ )
+
;;; @ MIME charset
;;;
@@ -222,48 +256,50 @@ find-file-hooks, etc.
(defvar charsets-mime-charset-alist
(let ((alist
- '(((lc-ascii) . 'us-ascii)
- ((lc-ascii lc-ltn1) . 'iso-8859-1)
- ((lc-ascii lc-ltn2) . 'iso-8859-2)
- ((lc-ascii lc-ltn3) . 'iso-8859-3)
- ((lc-ascii lc-ltn4) . 'iso-8859-4)
-;;; ((lc-ascii lc-crl) . 'iso-8859-5)
- ((lc-ascii lc-crl) . 'koi8-r)
- ((lc-ascii lc-arb) . 'iso-8859-6)
- ((lc-ascii lc-grk) . 'iso-8859-7)
- ((lc-ascii lc-hbw) . 'iso-8859-8)
- ((lc-ascii lc-ltn5) . 'iso-8859-9)
- ((lc-ascii lc-roman lc-jpold lc-jp) . 'iso-2022-jp)
- ((lc-ascii lc-kr) . 'euc-kr)
- ((lc-ascii lc-cn) . 'gb2312)
- ((lc-ascii lc-big5-1 lc-big5-2) . 'big5)
+ '(((lc-ascii) . us-ascii)
+ ((lc-ascii lc-ltn1) . iso-8859-1)
+ ((lc-ascii lc-ltn2) . iso-8859-2)
+ ((lc-ascii lc-ltn3) . iso-8859-3)
+ ((lc-ascii lc-ltn4) . iso-8859-4)
+;;; ((lc-ascii lc-crl) . iso-8859-5)
+ ((lc-ascii lc-crl) . koi8-r)
+ ((lc-ascii lc-arb) . iso-8859-6)
+ ((lc-ascii lc-grk) . iso-8859-7)
+ ((lc-ascii lc-hbw) . iso-8859-8)
+ ((lc-ascii lc-ltn5) . iso-8859-9)
+ ((lc-ascii lc-roman lc-jpold lc-jp) . iso-2022-jp)
+ ((lc-ascii lc-kr) . euc-kr)
+ ((lc-ascii lc-cn) . gb2312)
+ ((lc-ascii lc-big5-1 lc-big5-2) . big5)
((lc-ascii lc-roman lc-ltn1 lc-grk
lc-jpold lc-cn lc-jp lc-kr
- lc-jp2) . 'iso-2022-jp-2)
+ lc-jp2) . iso-2022-jp-2)
((lc-ascii lc-roman lc-ltn1 lc-grk
lc-jpold lc-cn lc-jp lc-kr lc-jp2
- lc-cns1 lc-cns2) . 'iso-2022-int-1)
+ lc-cns1 lc-cns2) . iso-2022-int-1)
((lc-ascii lc-roman
lc-ltn1 lc-ltn2 lc-crl lc-grk
lc-jpold lc-cn lc-jp lc-kr lc-jp2
lc-cns1 lc-cns2 lc-cns3 lc-cns4
- lc-cns5 lc-cns6 lc-cns7) . 'iso-2022-int-1)
+ lc-cns5 lc-cns6 lc-cns7) . iso-2022-int-1)
))
dest)
(while alist
(catch 'not-found
(let ((pair (car alist)))
(setq dest
- (cons (mapcar (function
- (lambda (cs)
- (if (boundp cs)
- (symbol-value cs)
- (throw 'not-found nil)
- )))
- (car pair))
- (cdr pair)))))
- (setq alist (cdr alist))))
- )
+ (append dest
+ (list
+ (cons (mapcar (function
+ (lambda (cs)
+ (if (boundp cs)
+ (symbol-value cs)
+ (throw 'not-found nil)
+ )))
+ (car pair))
+ (cdr pair)))))))
+ (setq alist (cdr alist)))
+ dest))
(defvar default-mime-charset 'x-ctext
"Default value of MIME-charset.
@@ -281,8 +317,15 @@ It must be symbol.")
(defalias 'char-charset 'char-leading-char)
-(defalias 'char-length 'char-bytes)
+(defmacro char-next-index (char index)
+ "Return index of character succeeding CHAR whose index is INDEX."
+ (` (+ index (char-bytes char))))
+;;; @@ obsoleted aliases
+;;;
+;;; You should not use them.
+
+(defalias 'char-length 'char-bytes)
(defalias 'char-columns 'char-width)
Oops, something went wrong. Retry.

0 comments on commit 88b7f5a

Please sign in to comment.