diff options
| author | Juri Linkov | 2018-12-13 01:17:05 +0200 |
|---|---|---|
| committer | Juri Linkov | 2018-12-13 01:17:05 +0200 |
| commit | fcccd52ab086f94fe56900cf15fbdc0ea11b428b (patch) | |
| tree | d805a0ac6294b9d65b6fd9004e35449587c3ec8b | |
| parent | f318300959c1a72fd1f97fddfd71a22ea53e8226 (diff) | |
| download | emacs-fcccd52ab086f94fe56900cf15fbdc0ea11b428b.tar.gz emacs-fcccd52ab086f94fe56900cf15fbdc0ea11b428b.zip | |
* lisp/vc/vc.el (vc-find-revision-no-save): Use decode-coding-inserted-region
and after-insert-file-set-coding. Don't let-bind coding-system-for-read
and coding-system-for-write. For non-interactive use, let-bind
enable-local-variables to :safe and ignore errors from set-auto-mode call.
(Bug#33567)
| -rw-r--r-- | lisp/vc/vc.el | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 5ff9f4d5be6..48b7c98dfac 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -2033,20 +2033,25 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file." | |||
| 2033 | (with-current-buffer filebuf | 2033 | (with-current-buffer filebuf |
| 2034 | (let ((failed t)) | 2034 | (let ((failed t)) |
| 2035 | (unwind-protect | 2035 | (unwind-protect |
| 2036 | (let ((coding-system-for-read 'no-conversion) | 2036 | (with-current-buffer (or buffer (create-file-buffer filename)) |
| 2037 | (coding-system-for-write 'no-conversion)) | 2037 | (unless buffer (setq buffer-file-name filename)) |
| 2038 | (with-current-buffer (or buffer (create-file-buffer filename)) | 2038 | (let ((outbuf (current-buffer))) |
| 2039 | (unless buffer (setq buffer-file-name filename)) | 2039 | (with-current-buffer filebuf |
| 2040 | (let ((outbuf (current-buffer))) | 2040 | (if backend |
| 2041 | (with-current-buffer filebuf | 2041 | (vc-call-backend backend 'find-revision file revision outbuf) |
| 2042 | (if backend | 2042 | (vc-call find-revision file revision outbuf)))) |
| 2043 | (vc-call-backend backend 'find-revision file revision outbuf) | 2043 | (decode-coding-inserted-region (point-min) (point-max) file) |
| 2044 | (vc-call find-revision file revision outbuf)))) | 2044 | (after-insert-file-set-coding (- (point-max) (point-min))) |
| 2045 | (goto-char (point-min)) | 2045 | (goto-char (point-min)) |
| 2046 | (if buffer (let ((buffer-file-name file)) (normal-mode)) (normal-mode)) | 2046 | (if buffer |
| 2047 | (set-buffer-modified-p nil) | 2047 | ;; For non-interactive, skip any questions |
| 2048 | (setq buffer-read-only t)) | 2048 | (let ((enable-local-variables :safe) ;; to find `mode:' |
| 2049 | (setq failed nil)) | 2049 | (buffer-file-name file)) |
| 2050 | (ignore-errors (set-auto-mode))) | ||
| 2051 | (normal-mode)) | ||
| 2052 | (set-buffer-modified-p nil) | ||
| 2053 | (setq buffer-read-only t)) | ||
| 2054 | (setq failed nil) | ||
| 2050 | (when (and failed (unless buffer (get-file-buffer filename))) | 2055 | (when (and failed (unless buffer (get-file-buffer filename))) |
| 2051 | (with-current-buffer (get-file-buffer filename) | 2056 | (with-current-buffer (get-file-buffer filename) |
| 2052 | (set-buffer-modified-p nil)) | 2057 | (set-buffer-modified-p nil)) |