comparison lisp/international/mule.el @ 21023:bac070da6b6d

(load-with-code-conversion): Don't bind enable-multibyte-characters; instead, bind default-enable-multibyte-characters before creating buffer. (after-insert-file-set-buffer-file-coding-system): Use set-buffer-multibyte. Use add-hook to add this to after-insert-file-functions.
author Karl Heuer <kwzh@gnu.org>
date Mon, 02 Mar 1998 20:01:46 +0000
parents 7c906916c8ae
children b6c858daa80d
comparison
equal deleted inserted replaced
21022:52bc6b672a50 21023:bac070da6b6d
43 (signal 'file-error (list "Cannot open load file" file))) 43 (signal 'file-error (list "Cannot open load file" file)))
44 ;; Read file with code conversion, and then eval. 44 ;; Read file with code conversion, and then eval.
45 (let* ((buffer 45 (let* ((buffer
46 ;; To avoid any autoloading, set default-major-mode to 46 ;; To avoid any autoloading, set default-major-mode to
47 ;; fundamental-mode. 47 ;; fundamental-mode.
48 (let ((default-major-mode 'fundamental-mode)) 48 (let ((default-major-mode 'fundamental-mode)
49 (default-enable-multibyte-characters t))
49 ;; We can't use `generate-new-buffer' because files.el 50 ;; We can't use `generate-new-buffer' because files.el
50 ;; is not yet loaded. 51 ;; is not yet loaded.
51 (get-buffer-create (generate-new-buffer-name " *load*")))) 52 (get-buffer-create (generate-new-buffer-name " *load*"))))
52 (load-in-progress t) 53 (load-in-progress t)
53 (source (save-match-data (string-match "\\.el\\'" fullname)))) 54 (source (save-match-data (string-match "\\.el\\'" fullname))))
60 (unwind-protect 61 (unwind-protect
61 (let ((load-file-name fullname) 62 (let ((load-file-name fullname)
62 (inhibit-file-name-operation nil)) 63 (inhibit-file-name-operation nil))
63 (save-excursion 64 (save-excursion
64 (set-buffer buffer) 65 (set-buffer buffer)
65 ;; This is buffer-local.
66 (setq enable-multibyte-characters t)
67 (insert-file-contents fullname) 66 (insert-file-contents fullname)
68 ;; Make `kill-buffer' quiet. 67 ;; Make `kill-buffer' quiet.
69 (set-buffer-modified-p nil)) 68 (set-buffer-modified-p nil))
70 ;; Have the original buffer current while we eval. 69 ;; Have the original buffer current while we eval.
71 (eval-buffer buffer nil file)) 70 (eval-buffer buffer nil file))
825 (when coding-system 824 (when coding-system
826 (set-buffer-file-coding-system coding-system) 825 (set-buffer-file-coding-system coding-system)
827 (if (or (eq coding-system 'no-conversion) 826 (if (or (eq coding-system 'no-conversion)
828 (eq (coding-system-type coding-system) 5)) 827 (eq (coding-system-type coding-system) 5))
829 ;; It seems that random 8-bit codes are read. We had 828 ;; It seems that random 8-bit codes are read. We had
830 ;; better edit this buffer without multibyte character 829 ;; better edit this buffer without multibyte characters.
831 ;; facility.
832 (set-buffer-multibyte nil)) 830 (set-buffer-multibyte nil))
833 (set-buffer-modified-p modified-p)))) 831 (set-buffer-modified-p modified-p))))
834 nil) 832 nil)
835 833
836 (setq after-insert-file-functions 834 (add-hook 'after-insert-file-functions
837 (cons 'after-insert-file-set-buffer-file-coding-system 835 'after-insert-file-set-buffer-file-coding-system)
838 after-insert-file-functions))
839 836
840 ;; The coding-spec and eol-type of coding-system returned is decided 837 ;; The coding-spec and eol-type of coding-system returned is decided
841 ;; independently in the following order. 838 ;; independently in the following order.
842 ;; 1. That of buffer-file-coding-system locally bound. 839 ;; 1. That of buffer-file-coding-system locally bound.
843 ;; 2. That of CODING. 840 ;; 2. That of CODING.