summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorKaroly Lorentey <karoly@lorentey.hu>2007-04-22 12:12:29 +0000
committerKaroly Lorentey <karoly@lorentey.hu>2007-04-22 12:12:29 +0000
commite18c709364b095ea0be8ecabe458ac9a642a252f (patch)
treeefe814a842f932f387b3947c572bf43a548d17ef /lisp/files.el
parent81088e260b086fe28f36964f32b6338210ec6fd8 (diff)
parent9f25e707aaad5ed14a9448e9c5d345ff0bdbc5a7 (diff)
downloademacs-e18c709364b095ea0be8ecabe458ac9a642a252f.tar.gz
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-660 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-661 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-662 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-663 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-664 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-665 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-666 Fix read-only prompt problem in isearch * emacs@sv.gnu.org/emacs--devo--0--patch-667 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-668 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-669 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-670 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-671 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-672 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-673 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-206 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-207 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-208 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-600
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el43
1 files changed, 24 insertions, 19 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 22c817993f9..f11c6d37834 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1474,11 +1474,12 @@ the various files."
(error "Aborted"))
(if buf
;; We are using an existing buffer.
- (progn
+ (let (nonexistent)
(or nowarn
(verify-visited-file-modtime buf)
(cond ((not (file-exists-p filename))
- (error "File %s no longer exists!" filename))
+ (setq nonexistent t)
+ (message "File %s no longer exists!" filename))
;; Certain files should be reverted automatically
;; if they have changed on disk and not in the buffer.
((and (not (buffer-modified-p buf))
@@ -1515,7 +1516,8 @@ the various files."
;; writable and vice versa, but if the buffer agrees
;; with the new state of the file, that is ok too.
(let ((read-only (not (file-writable-p buffer-file-name))))
- (unless (or (eq read-only buffer-file-read-only)
+ (unless (or nonexistent
+ (eq read-only buffer-file-read-only)
(eq read-only buffer-read-only))
(when (or nowarn
(let ((question
@@ -1528,6 +1530,7 @@ the various files."
(when (and (not (eq (not (null rawfile))
(not (null find-file-literally))))
+ (not nonexistent)
;; It is confusing to ask whether to visit
;; non-literally if they have the file in
;; hexl-mode.
@@ -1697,16 +1700,6 @@ This function ensures that none of these modifications will take place."
(if (file-directory-p filename)
(signal 'file-error (list "Opening input file" "file is a directory"
filename)))
- ;; Check whether the file is uncommonly large (see find-file-noselect):
- (let (size)
- (when (and large-file-warning-threshold
- (setq size (nth 7 (file-attributes filename)))
- (> size large-file-warning-threshold)
- (not (y-or-n-p
- (format "File %s is large (%dMB), really insert? "
- (file-name-nondirectory filename)
- (/ size 1048576)))))
- (error "Aborted")))
(let* ((buffer (find-buffer-visiting (abbreviate-file-name (file-truename filename))
#'buffer-modified-p))
(tem (funcall insert-func filename)))
@@ -2144,7 +2137,7 @@ associated with that interpreter in `interpreter-mode-alist'.")
(comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\n]*<\\)")))
(concat "[ \t\n]*<" comment-re "*!DOCTYPE "))
. sgml-mode)
- ("%![^V]" . ps-mode)
+ ("%!PS" . ps-mode)
("# xmcd " . conf-unix-mode))
"Alist of buffer beginnings vs. corresponding major mode functions.
Each element looks like (REGEXP . FUNCTION) or (MATCH-FUNCTION . FUNCTION).
@@ -2443,6 +2436,7 @@ asking you for confirmation."
(mapc (lambda (pair)
(put (car pair) 'safe-local-variable (cdr pair)))
'((buffer-read-only . booleanp) ;; C source code
+ (default-directory . stringp) ;; C source code
(fill-column . integerp) ;; C source code
(indent-tabs-mode . booleanp) ;; C source code
(left-margin . integerp) ;; C source code
@@ -3602,10 +3596,21 @@ Before and after saving the buffer, this function runs
(let ((filename
(expand-file-name
(read-file-name "File to save in: ") nil)))
- (and (file-exists-p filename)
- (or (y-or-n-p (format "File `%s' exists; overwrite? "
- filename))
- (error "Canceled")))
+ (if (file-exists-p filename)
+ (if (file-directory-p filename)
+ ;; Signal an error if the user specified the name of an
+ ;; existing directory.
+ (error "%s is a directory" filename)
+ (unless (y-or-n-p (format "File `%s' exists; overwrite? "
+ filename))
+ (error "Canceled")))
+ ;; Signal an error if the specified name refers to a
+ ;; non-existing directory.
+ (let ((dir (file-name-directory filename)))
+ (unless (file-directory-p dir)
+ (if (file-exists-p dir)
+ (error "%s is not a directory" dir)
+ (error "%s: no such directory" dir)))))
(set-visited-file-name filename)))
(or (verify-visited-file-modtime (current-buffer))
(not (file-exists-p buffer-file-name))
@@ -3679,7 +3684,7 @@ Before and after saving the buffer, this function runs
(if (not (file-directory-p dir))
(if (file-exists-p dir)
(error "%s is not a directory" dir)
- (error "%s: no such directory" buffer-file-name))
+ (error "%s: no such directory" dir))
(if (not (file-exists-p buffer-file-name))
(error "Directory %s write-protected" dir)
(if (yes-or-no-p