diff options
| author | Richard M. Stallman | 1998-06-23 15:49:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-06-23 15:49:54 +0000 |
| commit | b296cbd4abf9a9b203f0a57d5d06f5c01fa8ee93 (patch) | |
| tree | 29ed57861c66f857c38eedbf5b891ef608bbbaa9 | |
| parent | 8146c81d068646eb5c5ca306c1b39854f972226d (diff) | |
| download | emacs-b296cbd4abf9a9b203f0a57d5d06f5c01fa8ee93.tar.gz emacs-b296cbd4abf9a9b203f0a57d5d06f5c01fa8ee93.zip | |
(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.
| -rw-r--r-- | lisp/files.el | 24 |
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." | |||
| 890 | (if (or find-file-existing-other-name find-file-visit-truename) | 890 | (if (or find-file-existing-other-name find-file-visit-truename) |
| 891 | (setq buf other)))) | 891 | (setq buf other)))) |
| 892 | (if buf | 892 | (if buf |
| 893 | ;; We are using an existing buffer. | ||
| 893 | (progn | 894 | (progn |
| 894 | (or nowarn | 895 | (or nowarn |
| 895 | (verify-visited-file-modtime buf) | 896 | (verify-visited-file-modtime buf) |
| @@ -948,19 +949,24 @@ Optional second arg RAWFILE non-nil means the file is read literally." | |||
| 948 | (find-file-noselect-1 buf filename nowarn | 949 | (find-file-noselect-1 buf filename nowarn |
| 949 | rawfile truename number) | 950 | rawfile truename number) |
| 950 | (error (if rawfile "File already visited non-literally" | 951 | (error (if rawfile "File already visited non-literally" |
| 951 | "File already visited literally"))))))) | 952 | "File already visited literally")))))) |
| 952 | (progn | 953 | ;; Return the buffer we are using. |
| 953 | (setq buf (create-file-buffer filename)) | 954 | buf) |
| 954 | (set-buffer-major-mode buf) | 955 | ;; Create a new buffer. |
| 955 | (find-file-noselect-1 buf filename nowarn rawfile truename number))) | 956 | (setq buf (create-file-buffer filename)) |
| 956 | buf))) | 957 | (set-buffer-major-mode buf) |
| 958 | ;; find-file-noselect-1 may use a different buffer. | ||
| 959 | (find-file-noselect-1 buf filename nowarn | ||
| 960 | rawfile truename number))))) | ||
| 957 | 961 | ||
| 958 | (defun find-file-noselect-1 (buf filename nowarn rawfile truename number) | 962 | (defun find-file-noselect-1 (buf filename nowarn rawfile truename number) |
| 959 | (let ((inhibit-read-only t) | 963 | (let ((inhibit-read-only t) |
| 960 | error) | 964 | error) |
| 961 | (with-current-buffer buf | 965 | (with-current-buffer buf |
| 962 | (kill-local-variable 'find-file-literally) | 966 | (kill-local-variable 'find-file-literally) |
| 963 | (setq buffer-file-coding-system nil) | 967 | ;; Needed in case we are re-visiting the file with a different |
| 968 | ;; text representation. | ||
| 969 | (setq buffer-file-coding-system default-buffer-file-coding-system) | ||
| 964 | (erase-buffer) | 970 | (erase-buffer) |
| 965 | (and (default-value 'enable-multibyte-characters) | 971 | (and (default-value 'enable-multibyte-characters) |
| 966 | (not rawfile) | 972 | (not rawfile) |
| @@ -1018,8 +1024,8 @@ Optional second arg RAWFILE non-nil means the file is read literally." | |||
| 1018 | (setq buffer-file-coding-system 'no-conversion) | 1024 | (setq buffer-file-coding-system 'no-conversion) |
| 1019 | (make-local-variable 'find-file-literally) | 1025 | (make-local-variable 'find-file-literally) |
| 1020 | (setq find-file-literally t)) | 1026 | (setq find-file-literally t)) |
| 1021 | (after-find-file error (not nowarn)) | 1027 | (after-find-file error (not nowarn))) |
| 1022 | (setq buf (current-buffer)))))) | 1028 | (current-buffer)))) |
| 1023 | 1029 | ||
| 1024 | (defun insert-file-contents-literally (filename &optional visit beg end replace) | 1030 | (defun insert-file-contents-literally (filename &optional visit beg end replace) |
| 1025 | "Like `insert-file-contents', but only reads in the file literally. | 1031 | "Like `insert-file-contents', but only reads in the file literally. |