70
|
1 ;;; files-nomule.el --- file I/O stubs when not under Mule.
|
|
2
|
|
3 ;; Copyright (C) 1985-1987, 1992-1994 Free Software Foundation, Inc.
|
|
4 ;; Copyright (C) 1995 Sun Microsystems.
|
|
5
|
|
6 ;; This file is part of XEmacs.
|
|
7
|
|
8 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
9 ;; under the terms of the GNU General Public License as published by
|
|
10 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
11 ;; any later version.
|
|
12
|
|
13 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16 ;; General Public License for more details.
|
|
17
|
|
18 ;; You should have received a copy of the GNU General Public License
|
|
19 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
20 ;; Free Software Foundation, 59 Temple Place - Suite 330,
|
|
21 ;; Boston, MA 02111-1307, USA.
|
|
22
|
72
|
23 ;;; Synched up with: FSF 19.34 (files.el).
|
|
24
|
|
25 ;;; Commentary:
|
|
26
|
|
27 ;; These stubs were moved from the bottom of files.el.
|
|
28
|
|
29 ;;; Code:
|
70
|
30
|
|
31 (defun insert-file-contents (filename &optional visit beg end replace)
|
|
32 "Insert contents of file FILENAME after point.
|
|
33 Returns list of absolute file name and length of data inserted.
|
|
34 If second argument VISIT is non-nil, the buffer's visited filename
|
|
35 and last save file modtime are set, and it is marked unmodified.
|
|
36 If visiting and the file does not exist, visiting is completed
|
|
37 before the error is signaled.
|
|
38
|
|
39 The optional third and fourth arguments BEG and END
|
|
40 specify what portion of the file to insert.
|
|
41 If VISIT is non-nil, BEG and END must be nil.
|
|
42 If optional fifth argument REPLACE is non-nil,
|
|
43 it means replace the current buffer contents (in the accessible portion)
|
|
44 with the file contents. This is better than simply deleting and inserting
|
|
45 the whole thing because (1) it preserves some marker positions
|
|
46 and (2) it puts less data in the undo list."
|
|
47 (insert-file-contents-internal filename visit beg end replace nil nil))
|
|
48
|
|
49 (defun write-region (start end filename &optional append visit lockname)
|
|
50 "Write current region into specified file.
|
|
51 When called from a program, takes three arguments:
|
|
52 START, END and FILENAME. START and END are buffer positions.
|
|
53 Optional fourth argument APPEND if non-nil means
|
|
54 append to existing file contents (if any).
|
|
55 Optional fifth argument VISIT if t means
|
|
56 set the last-save-file-modtime of buffer to this file's modtime
|
|
57 and mark buffer not modified.
|
|
58 If VISIT is a string, it is a second file name;
|
|
59 the output goes to FILENAME, but the buffer is marked as visiting VISIT.
|
|
60 VISIT is also the file name to lock and unlock for clash detection.
|
|
61 If VISIT is neither t nor nil nor a string,
|
|
62 that means do not print the \"Wrote file\" message.
|
|
63 The optional sixth arg LOCKNAME, if non-nil, specifies the name to
|
|
64 use for locking and unlocking, overriding FILENAME and VISIT.
|
|
65 Kludgy feature: if START is a string, then that string is written
|
|
66 to the file, instead of any buffer contents, and END is ignored."
|
|
67 (interactive "r\nFWrite region to file: ")
|
|
68 (write-region-internal start end filename append visit lockname nil))
|
|
69
|
|
70 (defun load (file &optional noerror nomessage nosuffix)
|
|
71 "Execute a file of Lisp code named FILE.
|
|
72 First try FILE with `.elc' appended, then try with `.el',
|
|
73 then try FILE unmodified.
|
|
74 This function searches the directories in `load-path'.
|
|
75 If optional second arg NOERROR is non-nil,
|
|
76 report no error if FILE doesn't exist.
|
|
77 Print messages at start and end of loading unless
|
|
78 optional third arg NOMESSAGE is non-nil (ignored in -batch mode).
|
|
79 If optional fourth arg NOSUFFIX is non-nil, don't try adding
|
|
80 suffixes `.elc' or `.el' to the specified name FILE.
|
|
81 Return t if file exists."
|
|
82 (load-internal file noerror nomessage nosuffix nil nil))
|
|
83
|
78
|
84 ;;; files-nomule.el ends here
|