summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-06-23 15:49:54 +0000
committerRichard M. Stallman <rms@gnu.org>1998-06-23 15:49:54 +0000
commitb296cbd4abf9a9b203f0a57d5d06f5c01fa8ee93 (patch)
tree29ed57861c66f857c38eedbf5b891ef608bbbaa9 /lisp/files.el
parent8146c81d068646eb5c5ca306c1b39854f972226d (diff)
downloademacs-b296cbd4abf9a9b203f0a57d5d06f5c01fa8ee93.tar.gz
(find-file-noselect-1): Init buffer-file-coding-system
from default-buffer-file-coding-system. (find-file-noselect-1): Return the buffer that is current after after-find-file. (find-file-noselect): Return whatever find-file-noselect-1 returns.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 6e7e889b880..1f47dff4c31 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -890,6 +890,7 @@ Optional second arg RAWFILE non-nil means the file is read literally."
(if (or find-file-existing-other-name find-file-visit-truename)
(setq buf other))))
(if buf
+ ;; We are using an existing buffer.
(progn
(or nowarn
(verify-visited-file-modtime buf)
@@ -948,19 +949,24 @@ Optional second arg RAWFILE non-nil means the file is read literally."
(find-file-noselect-1 buf filename nowarn
rawfile truename number)
(error (if rawfile "File already visited non-literally"
- "File already visited literally")))))))
- (progn
- (setq buf (create-file-buffer filename))
- (set-buffer-major-mode buf)
- (find-file-noselect-1 buf filename nowarn rawfile truename number)))
- buf)))
+ "File already visited literally"))))))
+ ;; Return the buffer we are using.
+ buf)
+ ;; Create a new buffer.
+ (setq buf (create-file-buffer filename))
+ (set-buffer-major-mode buf)
+ ;; find-file-noselect-1 may use a different buffer.
+ (find-file-noselect-1 buf filename nowarn
+ rawfile truename number)))))
(defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
(let ((inhibit-read-only t)
error)
(with-current-buffer buf
(kill-local-variable 'find-file-literally)
- (setq buffer-file-coding-system nil)
+ ;; Needed in case we are re-visiting the file with a different
+ ;; text representation.
+ (setq buffer-file-coding-system default-buffer-file-coding-system)
(erase-buffer)
(and (default-value 'enable-multibyte-characters)
(not rawfile)
@@ -1018,8 +1024,8 @@ Optional second arg RAWFILE non-nil means the file is read literally."
(setq buffer-file-coding-system 'no-conversion)
(make-local-variable 'find-file-literally)
(setq find-file-literally t))
- (after-find-file error (not nowarn))
- (setq buf (current-buffer))))))
+ (after-find-file error (not nowarn)))
+ (current-buffer))))
(defun insert-file-contents-literally (filename &optional visit beg end replace)
"Like `insert-file-contents', but only reads in the file literally.