Don't require 'emu-xemacs or 'emu-e19.
[elisp/apel.git] / emu-x20.el
index 7b3d394..c893038 100644 (file)
 ;;; @ binary access
 ;;;
 
-(defun insert-binary-file-contents (filename &optional visit beg end replace)
-  "Like `insert-file-contents', q.v., but don't code and format conversion."
+(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 ((coding-system-for-read 'binary)
        format-alist)
     (insert-file-contents filename visit beg end replace)
     ))
 
+(define-obsolete-function-alias '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 ((coding-system-for-read 'binary))
+    (insert-file-contents-literally filename visit beg end replace)
+    ))
+
     
 ;;; @ MIME charset
 ;;;
 
-(defsubst encode-mime-charset-region (start end charset)
+(defun encode-mime-charset-region (start end charset)
   "Encode the text between START and END as MIME CHARSET."
   (let ((cs (mime-charset-to-coding-system charset)))
     (if cs
        (encode-coding-region start end cs)
       )))
 
-(defsubst decode-mime-charset-region (start end charset)
+(defun decode-mime-charset-region (start end charset)
   "Decode the text between START and END as MIME CHARSET."
   (let ((cs (mime-charset-to-coding-system charset)))
     (if cs
 ;;; @ character
 ;;;
 
+(defmacro char-next-index (char index)
+  "Return index of character succeeding CHAR whose index is INDEX."
+  `(1+ index))
+
 ;;; @@ Mule emulating aliases
 ;;;
 ;;; You should not use them.
 
-(defalias 'char-leading-char 'char-charset)
+;;(defalias 'char-leading-char 'char-charset)
 
 (defun char-category (character)
   "Return string of category mnemonics for CHAR in TABLE.