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
|
|
23 ;;; Synched up with: Not in FSF.
|
|
24
|
|
25 (defun insert-file-contents (filename &optional visit beg end replace)
|
|
26 "Insert contents of file FILENAME after point.
|
|
27 Returns list of absolute file name and length of data inserted.
|
|
28 If second argument VISIT is non-nil, the buffer's visited filename
|
|
29 and last save file modtime are set, and it is marked unmodified.
|
|
30 If visiting and the file does not exist, visiting is completed
|
|
31 before the error is signaled.
|
|
32
|
|
33 The optional third and fourth arguments BEG and END
|
|
34 specify what portion of the file to insert.
|
|
35 If VISIT is non-nil, BEG and END must be nil.
|
|
36 If optional fifth argument REPLACE is non-nil,
|
|
37 it means replace the current buffer contents (in the accessible portion)
|
|
38 with the file contents. This is better than simply deleting and inserting
|
|
39 the whole thing because (1) it preserves some marker positions
|
|
40 and (2) it puts less data in the undo list."
|
|
41 (insert-file-contents-internal filename visit beg end replace nil nil))
|
|
42
|
|
43 (defun write-region (start end filename &optional append visit lockname)
|
|
44 "Write current region into specified file.
|
|
45 When called from a program, takes three arguments:
|
|
46 START, END and FILENAME. START and END are buffer positions.
|
|
47 Optional fourth argument APPEND if non-nil means
|
|
48 append to existing file contents (if any).
|
|
49 Optional fifth argument VISIT if t means
|
|
50 set the last-save-file-modtime of buffer to this file's modtime
|
|
51 and mark buffer not modified.
|
|
52 If VISIT is a string, it is a second file name;
|
|
53 the output goes to FILENAME, but the buffer is marked as visiting VISIT.
|
|
54 VISIT is also the file name to lock and unlock for clash detection.
|
|
55 If VISIT is neither t nor nil nor a string,
|
|
56 that means do not print the \"Wrote file\" message.
|
|
57 The optional sixth arg LOCKNAME, if non-nil, specifies the name to
|
|
58 use for locking and unlocking, overriding FILENAME and VISIT.
|
|
59 Kludgy feature: if START is a string, then that string is written
|
|
60 to the file, instead of any buffer contents, and END is ignored."
|
|
61 (interactive "r\nFWrite region to file: ")
|
|
62 (write-region-internal start end filename append visit lockname nil))
|
|
63
|
|
64 (defun load (file &optional noerror nomessage nosuffix)
|
|
65 "Execute a file of Lisp code named FILE.
|
|
66 First try FILE with `.elc' appended, then try with `.el',
|
|
67 then try FILE unmodified.
|
|
68 This function searches the directories in `load-path'.
|
|
69 If optional second arg NOERROR is non-nil,
|
|
70 report no error if FILE doesn't exist.
|
|
71 Print messages at start and end of loading unless
|
|
72 optional third arg NOMESSAGE is non-nil (ignored in -batch mode).
|
|
73 If optional fourth arg NOSUFFIX is non-nil, don't try adding
|
|
74 suffixes `.elc' or `.el' to the specified name FILE.
|
|
75 Return t if file exists."
|
|
76 (load-internal file noerror nomessage nosuffix nil nil))
|
|
77
|