[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: revert-buffer-with-coding-system fails to work for CP1250
From: |
Kenichi Handa |
Subject: |
Re: revert-buffer-with-coding-system fails to work for CP1250 |
Date: |
Mon, 30 Oct 2006 16:44:24 +0900 |
In article <address@hidden>, Peter Dyballa <address@hidden> writes:
> When I open a text file with a CP1250 contents, mode-line does not
> show a specific encoding, it starts with ``-:´´. So I invoke C-x REF
> r cp1250 RET – but there does not seem to be change (except that read-
> only goes away).
In article <address@hidden>, Eli Zaretskii <address@hidden> writes:
> It seems that this problem is somehow related to the fact that Emacs
> initially visits the file in unibyte mode.
Right. I've just installed the attached fix. Or, should we
change insert-file-contents?
---
Kenichi Handa
address@hidden
2006-10-30 Kenichi Handa <address@hidden>
* files.el (revert-buffer): If a unibyte buffer is being reverted
with a coding system for multibyte, set buffer multibyte before
calling insert-file-contents.
*** files.el 20 Oct 2006 11:10:12 +0900 1.862
--- files.el 30 Oct 2006 16:37:46 +0900
***************
*** 4094,4099 ****
--- 4094,4108 ----
(if auto-save-p 'auto-save-coding
(or coding-system-for-read
buffer-file-coding-system-explicit))))
+ (if (and (not enable-multibyte-characters)
+ (not (memq (coding-system-base
+ coding-system-for-read)
+ '(no-conversion raw-text))))
+ ;; As a coding system suitable for multibyte
+ ;; buffer is specified, make the current
+ ;; buffer multibyte.
+ (set-buffer-multibyte t))
+
;; This force after-insert-file-set-coding
;; (called from insert-file-contents) to set
;; buffer-file-coding-system to a proper value.