source: projects/emacsen-common/trunk/apel-sample/usr/share/emacs/site-lisp/apel/pces-e20_2.el @ 7238

Revision 7238, 5.3 KB checked in by daisuke, 12 years ago (diff)

import emacsen-common

Line 
1;;; -*-byte-compile-dynamic: t;-*-
2;;; pces-e20_2.el --- pces implementation for Emacs 20.1 and 20.2
3
4;; Copyright (C) 1996,1997,1998,1999 Free Software Foundation, Inc.
5
6;; Author: MORIOKA Tomohiko <tomo@m17n.org>
7;; Keywords: emulation, compatibility, Mule
8
9;; This file is part of APEL (A Portable Emacs Library).
10
11;; This program is free software; you can redistribute it and/or
12;; modify it under the terms of the GNU General Public License as
13;; published by the Free Software Foundation; either version 2, or (at
14;; your option) any later version.
15
16;; This program is distributed in the hope that it will be useful, but
17;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19;; General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING.  If not, write to the
23;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24;; Boston, MA 02111-1307, USA.
25
26;;; Commentary:
27
28;;    This module requires Emacs 20.1 and 20.2.
29
30;;; Code:
31
32;;; @ without code-conversion
33;;;
34
35(defun insert-file-contents-as-binary (filename
36                                       &optional visit beg end replace)
37  "Like `insert-file-contents', q.v., but don't code and format conversion.
38Like `insert-file-contents-literary', but it allows find-file-hooks,
39automatic uncompression, etc.
40
41Namely this function ensures that only format decoding and character
42code conversion will not take place."
43  (let ((flag enable-multibyte-characters)
44        (coding-system-for-read 'binary)
45        format-alist)
46    (prog1
47        ;; Returns list absolute file name and length of data inserted.
48        (insert-file-contents filename visit beg end replace)
49      ;; This operation does not change the length.
50      (set-buffer-multibyte flag))))
51
52(defun insert-file-contents-as-raw-text (filename
53                                         &optional visit beg end replace)
54  "Like `insert-file-contents', q.v., but don't code and format conversion.
55Like `insert-file-contents-literary', but it allows find-file-hooks,
56automatic uncompression, etc.
57Like `insert-file-contents-as-binary', but it converts line-break
58code."
59  (let ((flag enable-multibyte-characters)
60        (coding-system-for-read 'raw-text)
61        format-alist)
62    (prog1
63        ;; Returns list absolute file name and length of data inserted.
64        (insert-file-contents filename visit beg end replace)
65      ;; This operation does not change the length.
66      (set-buffer-multibyte flag))))
67
68(defun insert-file-contents-as-raw-text-CRLF (filename
69                                              &optional visit beg end replace)
70  "Like `insert-file-contents', q.v., but don't code and format conversion.
71Like `insert-file-contents-literary', but it allows find-file-hooks,
72automatic uncompression, etc.
73Like `insert-file-contents-as-binary', but it converts line-break code
74from CRLF to LF."
75  (let ((flag enable-multibyte-characters)
76        (coding-system-for-read 'raw-text-dos)
77        format-alist)
78    (prog1
79        ;; Returns list absolute file name and length of data inserted.
80        (insert-file-contents filename visit beg end replace)
81      ;; This operation does not change the length.
82      (set-buffer-multibyte flag))))
83
84(defun find-file-noselect-as-binary (filename &optional nowarn rawfile)
85  "Like `find-file-noselect', q.v., but don't code and format conversion."
86  (let ((flag enable-multibyte-characters)
87        (coding-system-for-read 'binary)
88        format-alist)
89    (save-current-buffer
90      (prog1
91          (set-buffer (find-file-noselect filename nowarn rawfile))
92        (set-buffer-multibyte flag)))))
93
94(defun find-file-noselect-as-raw-text (filename &optional nowarn rawfile)
95  "Like `find-file-noselect', q.v., but it does not code and format conversion
96except for line-break code."
97  (let ((flag enable-multibyte-characters)
98        (coding-system-for-read 'raw-text)
99        format-alist)
100    (save-current-buffer
101      (prog1
102          (set-buffer (find-file-noselect filename nowarn rawfile))
103        (set-buffer-multibyte flag)))))
104
105(defun find-file-noselect-as-raw-text-CRLF (filename &optional nowarn rawfile)
106  "Like `find-file-noselect', q.v., but it does not code and format conversion
107except for line-break code."
108  (let ((flag enable-multibyte-characters)
109        (coding-system-for-read 'raw-text-dos)
110        format-alist)
111    (save-current-buffer
112      (prog1
113          (set-buffer (find-file-noselect filename nowarn rawfile))
114        (set-buffer-multibyte flag)))))
115
116
117;;; @ with code-conversion
118;;;
119
120(defun insert-file-contents-as-coding-system
121  (coding-system filename &optional visit beg end replace)
122  "Like `insert-file-contents', q.v., but CODING-SYSTEM the first arg will
123be applied to `coding-system-for-read'."
124  (let ((flag enable-multibyte-characters)
125        (coding-system-for-read coding-system)
126        format-alist)
127    (prog1
128        (insert-file-contents filename visit beg end replace)
129      (set-buffer-multibyte flag))))
130
131(defun find-file-noselect-as-coding-system
132  (coding-system filename &optional nowarn rawfile)
133  "Like `find-file-noselect', q.v., but CODING-SYSTEM the first arg will
134be applied to `coding-system-for-read'."
135  (let ((flag enable-multibyte-characters)
136        (coding-system-for-read coding-system)
137        format-alist)
138    (save-current-buffer
139      (prog1
140          (set-buffer (find-file-noselect filename nowarn rawfile))
141        (set-buffer-multibyte flag)))))
142
143
144;;; @ end
145;;;
146
147(require 'product)
148(product-provide (provide 'pces-e20_2) (require 'apel-ver))
149
150;;; pces-e20_2.el ends here
Note: See TracBrowser for help on using the repository browser.