diff options
| author | Kenichi Handa | 1998-11-16 01:17:06 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-11-16 01:17:06 +0000 |
| commit | d0c26c63e84207acf52e31f6e793ef055e4cb031 (patch) | |
| tree | 9004c26a68bdb58b6e00d93e2f291d859e25b32f | |
| parent | 1b33e237605724471fa486643252702feca7a6e1 (diff) | |
| download | emacs-d0c26c63e84207acf52e31f6e793ef055e4cb031.tar.gz emacs-d0c26c63e84207acf52e31f6e793ef055e4cb031.zip | |
(after-insert-file-set-buffer-file-coding-system): If the buffer
is changed to unibyte, return inserted bytes.
| -rw-r--r-- | lisp/international/mule.el | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 5235d6721c0..54d1cda86a5 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -953,15 +953,18 @@ function by default." | |||
| 953 | (modified-p (buffer-modified-p))) | 953 | (modified-p (buffer-modified-p))) |
| 954 | (when coding-system | 954 | (when coding-system |
| 955 | (set-buffer-file-coding-system coding-system) | 955 | (set-buffer-file-coding-system coding-system) |
| 956 | (if (and (or (eq coding-system 'no-conversion) | 956 | (if (and enable-multibyte-characters |
| 957 | (or (eq coding-system 'no-conversion) | ||
| 957 | (eq (coding-system-type coding-system) 5)) | 958 | (eq (coding-system-type coding-system) 5)) |
| 958 | ;; If buffer was unmodified, we must be visiting it. | 959 | ;; If buffer was unmodified, we must be visiting it. |
| 959 | (not modified-p)) | 960 | (not modified-p)) |
| 960 | ;; For coding systems no-conversion and raw-text..., | 961 | ;; For coding systems no-conversion and raw-text..., |
| 961 | ;; edit the buffer as unibyte. | 962 | ;; edit the buffer as unibyte. |
| 962 | (set-buffer-multibyte nil)) | 963 | (let ((pos-byte (position-bytes (+ (point) inserted)))) |
| 964 | (set-buffer-multibyte nil) | ||
| 965 | (setq inserted (- pos-byte (position-bytes (point)))))) | ||
| 963 | (set-buffer-modified-p modified-p)))) | 966 | (set-buffer-modified-p modified-p)))) |
| 964 | nil) | 967 | inserted) |
| 965 | 968 | ||
| 966 | (add-hook 'after-insert-file-functions | 969 | (add-hook 'after-insert-file-functions |
| 967 | 'after-insert-file-set-buffer-file-coding-system) | 970 | 'after-insert-file-set-buffer-file-coding-system) |