update.
[chise/xemacs-chise.git.1] / lisp / files-nomule.el
1 ;;; files-nomule.el --- file I/O stubs when not under Mule.
2
3 ;; Copyright (C) 1985-1987, 1992-1994, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Sun Microsystems.
5
6 ;; Maintainer: XEmacs Development Team
7 ;; Keywords: extensions, dumped
8
9 ;; This file is part of XEmacs.
10
11 ;; XEmacs is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; XEmacs 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 XEmacs; see the file COPYING.  If not, write to the
23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Synched up with: FSF 19.34 (files.el).   (Is it?  Please check)
27
28 ;;; Commentary:
29
30 ;; This file is dumped with XEmacs (when Mule is not compiled in).
31
32 ;; These stubs were moved from the bottom of files.el.
33
34 ;;; Code:
35
36 (defun insert-file-contents (filename &optional visit start end replace)
37   "Insert contents of file FILENAME after point.
38 Returns list of absolute file name and length of data inserted.
39 If second argument VISIT is non-nil, the buffer's visited filename
40 and last save file modtime are set, and it is marked unmodified.
41 If visiting and the file does not exist, visiting is completed
42 before the error is signaled.
43
44 The optional third and fourth arguments START and END
45 specify what portion of the file to insert.
46 If VISIT is non-nil, START and END must be nil.
47 If optional fifth argument REPLACE is non-nil,
48 it means replace the current buffer contents (in the accessible portion)
49 with the file contents.  This is better than simply deleting and inserting
50 the whole thing because (1) it preserves some marker positions
51 and (2) it puts less data in the undo list."
52   (insert-file-contents-internal filename visit start end replace nil nil))
53
54 (defun write-region (start end filename &optional append visit lockname coding-system)
55   "Write current region into specified file.
56 By default, the file's existing contents are replaced by the specified region.
57 When called from a program, takes three arguments:
58 START, END and FILENAME.  START and END are buffer positions.
59 Optional fourth argument APPEND if non-nil means
60   append to existing file contents (if any).
61 Optional fifth argument VISIT if t means
62   set the last-save-file-modtime of buffer to this file's modtime
63   and mark buffer not modified.
64 If VISIT is a string, it is a second file name;
65   the output goes to FILENAME, but the buffer is marked as visiting VISIT.
66   VISIT is also the file name to lock and unlock for clash detection.
67 If VISIT is neither t nor nil nor a string,
68   that means do not print the \"Wrote file\" message.
69 The optional sixth arg LOCKNAME, if non-nil, specifies the name to
70   use for locking and unlocking, overriding FILENAME and VISIT.
71 Kludgy feature: if START is a string, then that string is written
72 to the file, instead of any buffer contents, and END is ignored.
73 Optional seventh argument CODING-SYSTEM is meaningful only if support
74   for Mule is present in XEmacs and specifies the coding system
75   used to encode the text when it is written out, and defaults to
76   the value of `buffer-file-coding-system' in the current buffer.
77   When Mule support is not present, the CODING-SYSTEM argument is
78   ignored."
79   (interactive "r\nFWrite region to file: ")
80   (write-region-internal start end filename append visit lockname nil))
81
82 (defun load (file &optional noerror nomessage nosuffix)
83   "Execute a file of Lisp code named FILE.
84 First try FILE with `.elc' appended, then try with `.el',
85  then try FILE unmodified.
86 This function searches the directories in `load-path'.
87 If optional second arg NOERROR is non-nil,
88  report no error if FILE doesn't exist.
89 Print messages at start and end of loading unless
90  optional third arg NOMESSAGE is non-nil (ignored in -batch mode).
91 If optional fourth arg NOSUFFIX is non-nil, don't try adding
92  suffixes `.elc' or `.el' to the specified name FILE.
93 Return t if file exists."
94   (load-internal file noerror nomessage nosuffix nil nil))
95
96 ;;; files-nomule.el ends here