1 ;;; poem-xfc.el --- poem module for XEmacs with file coding; -*-byte-compile-dynamic: t;-*-
3 ;; Copyright (C) 1998 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
8 ;; This file is part of APEL (A Portable Emacs Library).
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
32 ;;; @ fix coding-system definition
35 ;; Redefine if -{dos|mac|unix} is not found.
36 (or (find-coding-system 'raw-text-dos)
37 (copy-coding-system 'no-conversion-dos 'raw-text-dos))
38 (or (find-coding-system 'raw-text-mac)
39 (copy-coding-system 'no-conversion-mac 'raw-text-mac))
40 (or (find-coding-system 'raw-text-unix)
41 (copy-coding-system 'no-conversion-unix 'raw-text-unix))
43 ;;; @ without code-conversion
46 (defun insert-file-contents-as-binary (filename
47 &optional visit beg end replace)
48 "Like `insert-file-contents', but only reads in the file literally.
49 A buffer may be modified in several ways after reading into the buffer,
50 to Emacs features such as format decoding, character code
51 conversion, find-file-hooks, automatic uncompression, etc.
53 This function ensures that none of these modifications will take place."
54 (let ((format-alist nil)
55 (after-insert-file-functions nil)
56 (coding-system-for-read 'binary)
57 (coding-system-for-write 'binary)
58 (jka-compr-compression-info-list nil)
59 (jam-zcat-filename-list nil)
60 (find-buffer-file-type-function
61 (if (fboundp 'find-buffer-file-type)
62 (symbol-function 'find-buffer-file-type)
66 (fset 'find-buffer-file-type (lambda (filename) t))
67 (insert-file-contents filename visit beg end replace))
68 (if find-buffer-file-type-function
69 (fset 'find-buffer-file-type find-buffer-file-type-function)
70 (fmakunbound 'find-buffer-file-type)))))
73 ;;; @ buffer representation
76 (defsubst-maybe set-buffer-multibyte (flag)
77 "Set the multibyte flag of the current buffer to FLAG.
78 If FLAG is t, this makes the buffer a multibyte buffer.
79 If FLAG is nil, this makes the buffer a single-byte buffer.
80 The buffer contents remain unchanged as a sequence of bytes
81 but the contents viewed as characters do change.
82 \[Emacs 20.3 emulating function]"
88 (put 'ascii 'charset-description "Character set of ASCII")
89 (put 'ascii 'charset-registry "ASCII")
91 (put 'latin-iso8859-1 'charset-description "Character set of ISO-8859-1")
92 (put 'latin-iso8859-1 'charset-registry "ISO8859-1")
94 (defun charset-description (charset)
95 "Return description of CHARSET."
96 (get charset 'charset-description))
98 (defun charset-registry (charset)
99 "Return registry name of CHARSET."
100 (get charset 'charset-registry))
102 (defun charset-width (charset)
103 "Return number of columns a CHARSET occupies when displayed."
106 (defun charset-direction (charset)
107 "Return the direction of a character of CHARSET by
108 0 (left-to-right) or 1 (right-to-left)."
111 (defun find-charset-string (str)
112 "Return a list of charsets in the string."
113 (if (string-match "[\200-\377]" str)
117 (defalias 'find-non-ascii-charset-string 'find-charset-string)
119 (defun find-charset-region (start end)
120 "Return a list of charsets in the region between START and END."
123 (re-search-forward "[\200-\377]" end t))
127 (defalias 'find-non-ascii-charset-region 'find-charset-region)
132 (defun-maybe string-to-int-list (str)
133 (mapcar #'char-int str))
135 (defalias 'looking-at-as-unibyte 'looking-at)
143 ;;; poem-xfc.el ends here