diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2006-02-12 00:15:44 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2006-02-12 00:15:44 +0000 |
commit | 1913a2b35da45eeeb71ef851975be7d57c11de78 (patch) | |
tree | 6cd59883fb931999da5b62c03b321ade6f77e66e /lisp/files.el | |
parent | a5805c9d0240fab504f2a3e32db6449392005fb6 (diff) | |
parent | a528b71e55b2b244a5dd35318713ccb20398cbbf (diff) | |
download | emacs-1913a2b35da45eeeb71ef851975be7d57c11de78.tar.gz |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-49
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-50
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-51
Make constrain-to-field notice overlays
* emacs@sv.gnu.org/emacs--devo--0--patch-52
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-53
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-54
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-55
Merge from erc--emacs--0
* emacs@sv.gnu.org/emacs--devo--0--patch-56
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-57
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-58
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-59
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-60
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-61
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-62
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-63
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-64
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-65
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-66
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-67
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-68
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-69
rcirc: Add flexible response formatting; Add nick abbrevs
* emacs@sv.gnu.org/emacs--devo--0--patch-70
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-71
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-72
Update from CVS: man/dired.texi (Tumme): More tumme documentation.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-18
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-19
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-20
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-21
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-22
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-23
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-24
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-25
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-26
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-27
Update from CVS: lisp/gnus.el: Remove bogus comment.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-28
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-29
Add sendmail.el and smptmail.el from Emacs tree to contrib/
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-508
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 111 |
1 files changed, 55 insertions, 56 deletions
diff --git a/lisp/files.el b/lisp/files.el index ec974ceebe7..0a33a658d9d 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1,7 +1,8 @@ ;;; files.el --- file input and output commands for Emacs -;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -;; 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, +;; 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +;; 2006 Free Software Foundation, Inc. ;; Maintainer: FSF @@ -1024,7 +1025,7 @@ type M-n to pull it into the minibuffer. Interactively, or if WILDCARDS is non-nil in a call from Lisp, expand wildcards (if any) and visit multiple files. You can -suppress wildcard expansion by setting `find-file-wildcards'. +suppress wildcard expansion by setting `find-file-wildcards' to nil. To visit a file without any kind of conversion and without automatically choosing a major mode, use \\[find-file-literally]." @@ -1076,7 +1077,7 @@ expand wildcards (if any) and visit multiple files." (defun find-file-existing (filename &optional wildcards) "Edit the existing file FILENAME. -Like \\[find-file] but only allow files that exists." +Like \\[find-file] but only allow a file that exists." (interactive (find-file-read-args "Find existing file: " t)) (unless (file-exists-p filename) (error "%s does not exist" filename)) (find-file filename wildcards) @@ -3795,8 +3796,8 @@ sake of backward compatibility. IGNORE-AUTO is optional, defaulting to nil. Optional second argument NOCONFIRM means don't ask for confirmation at -all. (The local variable `revert-without-query', if non-nil, prevents -confirmation.) +all. \(The variable `revert-without-query' offers another way to +revert buffers without querying for confirmation.) Optional third argument PRESERVE-MODES non-nil means don't alter the files modes. Normally we reinitialize them using `normal-mode'. @@ -3831,13 +3832,10 @@ non-nil, it is called instead of rereading visited file contents." (error "Buffer does not seem to be associated with any file")) ((or noconfirm (and (not (buffer-modified-p)) - (let ((tail revert-without-query) - (found nil)) - (while tail - (if (string-match (car tail) file-name) - (setq found t)) - (setq tail (cdr tail))) - found)) + (catch 'found + (dolist (regexp revert-without-query) + (when (string-match regexp file-name) + (throw 'found t))))) (yes-or-no-p (format "Revert buffer from file %s? " file-name))) (run-hooks 'before-revert-hook) @@ -3846,50 +3844,51 @@ non-nil, it is called instead of rereading visited file contents." (and (not auto-save-p) (not (verify-visited-file-modtime (current-buffer))) (setq buffer-backed-up nil)) - ;; Get rid of all undo records for this buffer. - (or (eq buffer-undo-list t) - (setq buffer-undo-list nil)) ;; Effectively copy the after-revert-hook status, ;; since after-find-file will clobber it. (let ((global-hook (default-value 'after-revert-hook)) - (local-hook-p (local-variable-p 'after-revert-hook)) - (local-hook (and (local-variable-p 'after-revert-hook) - after-revert-hook))) - (let (buffer-read-only - ;; Don't make undo records for the reversion. - (buffer-undo-list t)) - (if revert-buffer-insert-file-contents-function - (funcall revert-buffer-insert-file-contents-function - file-name auto-save-p) - (if (not (file-exists-p file-name)) - (error (if buffer-file-number - "File %s no longer exists!" - "Cannot revert nonexistent file %s") - file-name)) - ;; Bind buffer-file-name to nil - ;; so that we don't try to lock the file. - (let ((buffer-file-name nil)) - (or auto-save-p - (unlock-buffer))) - (widen) - (let ((coding-system-for-read - ;; Auto-saved file shoule be read by Emacs' - ;; internal coding. - (if auto-save-p 'auto-save-coding - (or coding-system-for-read - buffer-file-coding-system-explicit)))) - ;; This force after-insert-file-set-coding - ;; (called from insert-file-contents) to set - ;; buffer-file-coding-system to a proper value. - (kill-local-variable 'buffer-file-coding-system) - - ;; Note that this preserves point in an intelligent way. - (if preserve-modes - (let ((buffer-file-format buffer-file-format)) - (insert-file-contents file-name (not auto-save-p) - nil nil t)) - (insert-file-contents file-name (not auto-save-p) - nil nil t))))) + (local-hook (when (local-variable-p 'after-revert-hook) + after-revert-hook)) + (inhibit-read-only t)) + (cond + (revert-buffer-insert-file-contents-function + (unless (eq buffer-undo-list t) + ;; Get rid of all undo records for this buffer. + (setq buffer-undo-list nil)) + ;; Don't make undo records for the reversion. + (let ((buffer-undo-list t)) + (funcall revert-buffer-insert-file-contents-function + file-name auto-save-p))) + ((not (file-exists-p file-name)) + (error (if buffer-file-number + "File %s no longer exists!" + "Cannot revert nonexistent file %s") + file-name)) + (t + ;; Bind buffer-file-name to nil + ;; so that we don't try to lock the file. + (let ((buffer-file-name nil)) + (or auto-save-p + (unlock-buffer))) + (widen) + (let ((coding-system-for-read + ;; Auto-saved file should be read by Emacs' + ;; internal coding. + (if auto-save-p 'auto-save-coding + (or coding-system-for-read + buffer-file-coding-system-explicit)))) + ;; This force after-insert-file-set-coding + ;; (called from insert-file-contents) to set + ;; buffer-file-coding-system to a proper value. + (kill-local-variable 'buffer-file-coding-system) + + ;; Note that this preserves point in an intelligent way. + (if preserve-modes + (let ((buffer-file-format buffer-file-format)) + (insert-file-contents file-name (not auto-save-p) + nil nil t)) + (insert-file-contents file-name (not auto-save-p) + nil nil t))))) ;; Recompute the truename in case changes in symlinks ;; have changed the truename. (setq buffer-file-truename @@ -3897,7 +3896,7 @@ non-nil, it is called instead of rereading visited file contents." (after-find-file nil nil t t preserve-modes) ;; Run after-revert-hook as it was before we reverted. (setq-default revert-buffer-internal-hook global-hook) - (if local-hook-p + (if local-hook (set (make-local-variable 'revert-buffer-internal-hook) local-hook) (kill-local-variable 'revert-buffer-internal-hook)) @@ -3943,7 +3942,7 @@ non-nil, it is called instead of rereading visited file contents." (insert-directory-safely file-name switches)))) (yes-or-no-p (format "Recover auto save file %s? " file-name))) (switch-to-buffer (find-file-noselect file t)) - (let ((buffer-read-only nil) + (let ((inhibit-read-only t) ;; Keep the current buffer-file-coding-system. (coding-system buffer-file-coding-system) ;; Auto-saved file shoule be read with special coding. |