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.
parent f3183009
Pipeline #267 failed with stage
in 5 minutes and 52 seconds
......@@ -2033,8 +2033,6 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file."
(with-current-buffer filebuf
(let ((failed t))
(let ((coding-system-for-read 'no-conversion)
(coding-system-for-write 'no-conversion))
(with-current-buffer (or buffer (create-file-buffer filename))
(unless buffer (setq buffer-file-name filename))
(let ((outbuf (current-buffer)))
......@@ -2042,11 +2040,18 @@ Unlike `vc-find-revision-save', doesn't save the buffer to the file."
(if backend
(vc-call-backend backend 'find-revision file revision outbuf)
(vc-call find-revision file revision outbuf))))
(decode-coding-inserted-region (point-min) (point-max) file)
(after-insert-file-set-coding (- (point-max) (point-min)))
(goto-char (point-min))
(if buffer (let ((buffer-file-name file)) (normal-mode)) (normal-mode))
(if buffer
;; For non-interactive, skip any questions
(let ((enable-local-variables :safe) ;; to find `mode:'
(buffer-file-name file))
(ignore-errors (set-auto-mode)))
(set-buffer-modified-p nil)
(setq buffer-read-only t))
(setq failed nil))
(setq failed nil)
(when (and failed (unless buffer (get-file-buffer filename)))
(with-current-buffer (get-file-buffer filename)
(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