annotate lisp/prim/files-nomule.el @ 78:c7528f8e288d r20-0b34

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