1735 |
;; After writing, basic-save-buffer-1 sets this value to |
;; After writing, basic-save-buffer-1 sets this value to |
1736 |
;; last-coding-system-used. |
;; last-coding-system-used. |
1737 |
;; This variable is used for decoding in revert-buffer. |
;; This variable is used for decoding in revert-buffer. |
1738 |
(defvar explicit-buffer-file-coding-system nil |
(defvar buffer-file-coding-system-explicit nil |
1739 |
"The file coding system explicitly specified for the current buffer. |
"The file coding system explicitly specified for the current buffer. |
1740 |
Internal use only.") |
Internal use only.") |
1741 |
(make-variable-buffer-local 'explicit-buffer-file-coding-system) |
(make-variable-buffer-local 'buffer-file-coding-system-explicit) |
1742 |
(put 'explicit-buffer-file-coding-system 'permanent-local t) |
(put 'buffer-file-coding-system-explicit 'permanent-local t) |
1743 |
|
|
1744 |
(defun after-insert-file-set-coding (inserted &optional visit) |
(defun after-insert-file-set-coding (inserted &optional visit) |
1745 |
"Set `buffer-file-coding-system' of current buffer after text is inserted. |
"Set `buffer-file-coding-system' of current buffer after text is inserted. |
1751 |
(if (and visit |
(if (and visit |
1752 |
coding-system-for-read |
coding-system-for-read |
1753 |
(not (eq coding-system-for-read 'auto-save-coding))) |
(not (eq coding-system-for-read 'auto-save-coding))) |
1754 |
(setq explicit-buffer-file-coding-system coding-system-for-read)) |
(setq buffer-file-coding-system-explicit coding-system-for-read)) |
1755 |
(if last-coding-system-used |
(if last-coding-system-used |
1756 |
(let ((coding-system |
(let ((coding-system |
1757 |
(find-new-buffer-file-coding-system last-coding-system-used)) |
(find-new-buffer-file-coding-system last-coding-system-used)) |