diff options
| author | Richard M. Stallman | 2003-04-14 10:06:55 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-04-14 10:06:55 +0000 |
| commit | 872a0a6ff33db07994a8e89c5423875cf672a98f (patch) | |
| tree | d1b253a4abc7d41f1d2d58163e68dcae747328c4 | |
| parent | 7065d42f229b6c004854f2e178209fbb3293226f (diff) | |
| download | emacs-872a0a6ff33db07994a8e89c5423875cf672a98f.tar.gz emacs-872a0a6ff33db07994a8e89c5423875cf672a98f.zip | |
(after-insert-file-set-coding): Properly treat INSERTED as number of
characters, for both the argument and the value.
| -rw-r--r-- | lisp/international/mule.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index 8dda6bd0e7c..2b9af0f810c 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -1695,7 +1695,11 @@ function by default." | |||
| 1695 | (setq set-auto-coding-function 'set-auto-coding) | 1695 | (setq set-auto-coding-function 'set-auto-coding) |
| 1696 | 1696 | ||
| 1697 | (defun after-insert-file-set-coding (inserted) | 1697 | (defun after-insert-file-set-coding (inserted) |
| 1698 | "Set `buffer-file-coding-system' of current buffer after text is inserted." | 1698 | "Set `buffer-file-coding-system' of current buffer after text is inserted. |
| 1699 | INSERTED is the number of characters that were inserted, as figured | ||
| 1700 | in the situation before this function. Return the number of characters | ||
| 1701 | inserted, as figured in the situation after. The two numbers can be | ||
| 1702 | different if the buffer has become unibyte." | ||
| 1699 | (if last-coding-system-used | 1703 | (if last-coding-system-used |
| 1700 | (let ((coding-system | 1704 | (let ((coding-system |
| 1701 | (find-new-buffer-file-coding-system last-coding-system-used)) | 1705 | (find-new-buffer-file-coding-system last-coding-system-used)) |
| @@ -1711,9 +1715,9 @@ function by default." | |||
| 1711 | (= (buffer-size) inserted)) | 1715 | (= (buffer-size) inserted)) |
| 1712 | ;; For coding systems no-conversion and raw-text..., | 1716 | ;; For coding systems no-conversion and raw-text..., |
| 1713 | ;; edit the buffer as unibyte. | 1717 | ;; edit the buffer as unibyte. |
| 1714 | (let ((pos-byte (position-bytes (+ (point) inserted)))) | 1718 | (let ((pos-marker (copy-marker (+ (point) inserted)))) |
| 1715 | (set-buffer-multibyte nil) | 1719 | (set-buffer-multibyte nil) |
| 1716 | (setq inserted (- pos-byte (position-bytes (point)))))) | 1720 | (setq inserted (- pos-marker (point))))) |
| 1717 | (set-buffer-modified-p modified-p)))) | 1721 | (set-buffer-modified-p modified-p)))) |
| 1718 | inserted) | 1722 | inserted) |
| 1719 | 1723 | ||