(emu-modules): Must add emu-mule for MULE.
[elisp/apel.git] / poem-20.el
1 ;;; poem-20.el --- poem implementation for Emacs 20 and XEmacs-mule
2
3 ;; Copyright (C) 1997,1998 Free Software Foundation, Inc.
4
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
6 ;; Keywords: emulation, compatibility, Mule
7
8 ;; This file is part of APEL (A Portable Emacs Library).
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 ;;; Commentary:
26
27 ;;    This module requires Emacs 20.0.93, XEmacs 20.3-b5 (with mule)
28 ;;    or later.
29
30 ;;; Code:
31
32 ;;; @ without code-conversion
33 ;;;
34
35 (defmacro as-binary-process (&rest body)
36   `(let (selective-display      ; Disable ^M to nl translation.
37          (coding-system-for-read  'binary)
38          (coding-system-for-write 'binary))
39      ,@body))
40
41 (defmacro as-binary-input-file (&rest body)
42   `(let ((coding-system-for-read 'binary))
43      ,@body))
44
45 (defmacro as-binary-output-file (&rest body)
46   `(let ((coding-system-for-write 'binary))
47      ,@body))
48
49 (defun write-region-as-binary (start end filename
50                                      &optional append visit lockname)
51   "Like `write-region', q.v., but don't encode."
52   (let ((coding-system-for-write 'binary))
53     (write-region start end filename append visit lockname)))
54
55 (defun insert-file-contents-as-binary (filename
56                                        &optional visit beg end replace)
57   "Like `insert-file-contents', q.v., but don't code and format conversion.
58 Like `insert-file-contents-literary', but it allows find-file-hooks,
59 automatic uncompression, etc.
60
61 Namely this function ensures that only format decoding and character
62 code conversion will not take place."
63   (let ((coding-system-for-read 'binary)
64         format-alist)
65     ;; Returns list of absolute file name and length of data inserted.
66     (insert-file-contents filename visit beg end replace)))
67
68 (defun insert-file-contents-as-raw-text (filename
69                                          &optional visit beg end replace)
70   "Like `insert-file-contents', q.v., but don't code and format conversion.
71 Like `insert-file-contents-literary', but it allows find-file-hooks,
72 automatic uncompression, etc.
73 Like `insert-file-contents-as-binary', but it converts line-break
74 code."
75   (let ((coding-system-for-read 'raw-text)
76         format-alist)
77     ;; Returns list of absolute file name and length of data inserted.
78     (insert-file-contents filename visit beg end replace)))
79
80 (defun write-region-as-raw-text-CRLF (start end filename
81                                             &optional append visit lockname)
82   "Like `write-region', q.v., but write as network representation."
83   (let ((coding-system-for-write 'raw-text-dos))
84     (write-region start end filename append visit lockname)))
85
86
87 ;;; @ end
88 ;;;
89
90 (provide 'poem-20)
91
92 ;;; poem-20.el ends here