Commit fcccd52a authored by Juri Linkov's avatar Juri Linkov
Browse files

* 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)
parent f3183009
Pipeline #267 failed with stage
in 5 minutes and 52 seconds
...@@ -2033,20 +2033,25 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file." ...@@ -2033,20 +2033,25 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file."
(with-current-buffer filebuf (with-current-buffer filebuf
(let ((failed t)) (let ((failed t))
(unwind-protect (unwind-protect
(let ((coding-system-for-read 'no-conversion) (with-current-buffer (or buffer (create-file-buffer filename))
(coding-system-for-write 'no-conversion)) (unless buffer (setq buffer-file-name filename))
(with-current-buffer (or buffer (create-file-buffer filename)) (let ((outbuf (current-buffer)))
(unless buffer (setq buffer-file-name filename)) (with-current-buffer filebuf
(let ((outbuf (current-buffer))) (if backend
(with-current-buffer filebuf (vc-call-backend backend 'find-revision file revision outbuf)
(if backend (vc-call find-revision file revision outbuf))))
(vc-call-backend backend 'find-revision file revision outbuf) (decode-coding-inserted-region (point-min) (point-max) file)
(vc-call find-revision file revision outbuf)))) (after-insert-file-set-coding (- (point-max) (point-min)))
(goto-char (point-min)) (goto-char (point-min))
(if buffer (let ((buffer-file-name file)) (normal-mode)) (normal-mode)) (if buffer
(set-buffer-modified-p nil) ;; For non-interactive, skip any questions
(setq buffer-read-only t)) (let ((enable-local-variables :safe) ;; to find `mode:'
(setq failed nil)) (buffer-file-name file))
(ignore-errors (set-auto-mode)))
(normal-mode))
(set-buffer-modified-p nil)
(setq buffer-read-only t))
(setq failed nil)
(when (and failed (unless buffer (get-file-buffer filename))) (when (and failed (unless buffer (get-file-buffer filename)))
(with-current-buffer (get-file-buffer filename) (with-current-buffer (get-file-buffer filename)
(set-buffer-modified-p nil)) (set-buffer-modified-p nil))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment