- Rename emu-20.el to mcs-20.el.
[elisp/apel.git] / emu-nemacs.el
1 ;;; emu-nemacs.el --- emu API implementation for NEmacs
2
3 ;; Copyright (C) 1995,1996,1997,1998 MORIOKA Tomohiko
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, NEmacs, mule
7
8 ;; This file is part of emu.
9
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.
14
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.
19
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.
24
25 ;;; Code:
26
27 (require 'poem)
28
29
30 ;;; @ coding system
31 ;;;
32
33 ;;; @@ for old MULE emulation
34 ;;;
35
36 (defconst *noconv*    0)
37 (defconst *sjis*      1)
38 (defconst *junet*     2)
39 (defconst *ctext*     2)
40 (defconst *internal*  3)
41 (defconst *euc-japan* 3)
42
43 (defun code-convert-string (str ic oc)
44   "Convert code in STRING from SOURCE code to TARGET code,
45 On successful converion, returns the result string,
46 else returns nil. [emu-nemacs.el; Mule emulating function]"
47   (if (not (eq ic oc))
48       (convert-string-kanji-code str ic oc)
49     str))
50
51 (defun code-convert-region (beg end ic oc)
52   "Convert code of the text between BEGIN and END from SOURCE
53 to TARGET. On successful conversion returns t,
54 else returns nil. [emu-nemacs.el; Mule emulating function]"
55   (if (/= ic oc)
56       (save-excursion
57         (save-restriction
58           (narrow-to-region beg end)
59           (convert-region-kanji-code beg end ic oc)))
60     ))
61
62
63 ;;; @ without code-conversion
64 ;;;
65
66 (fset 'insert-binary-file-contents 'insert-file-contents-as-binary)
67
68 (defun insert-binary-file-contents-literally (filename
69                                               &optional visit beg end replace)
70   "Like `insert-file-contents-literally', q.v., but don't code conversion.
71 A buffer may be modified in several ways after reading into the buffer due
72 to advanced Emacs features, such as file-name-handlers, format decoding,
73 find-file-hooks, etc.
74   This function ensures that none of these modifications will take place.
75 \[emu-nemacs.el]"
76   (as-binary-input-file
77    ;; Returns list absolute file name and length of data inserted.
78    (insert-file-contents-literally filename visit beg end replace)))
79
80
81 ;;; @ end
82 ;;;
83
84 (provide 'emu-nemacs)
85
86 ;;; emu-nemacs.el ends here