Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
bcd74314
Commit
bcd74314
authored
Dec 07, 2018
by
Juri Linkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* lisp/vc/vc.el (vc-find-revision-no-save): Add optional arg BUFFER.
(Bug#33567)
parent
0e8e5da1
Pipeline
#215
failed with stage
in 23 minutes and 55 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
lisp/vc/vc.el
lisp/vc/vc.el
+21
-13
No files found.
lisp/vc/vc.el
View file @
bcd74314
...
...
@@ -1998,33 +1998,41 @@ Saves the buffer to the file."
(
set
(
make-local-variable
'vc-parent-buffer
)
filebuf
))
result-buf
)))
(
defun
vc-find-revision-no-save
(
file
revision
&optional
backend
)
"Read REVISION of FILE into a buffer and return the buffer.
Unlike `vc-find-revision-save', doesn't save the created buffer to file."
(
let
((
filebuf
(
or
(
get-file-buffer
file
)
(
current-buffer
)))
(
filename
(
vc-version-backup-file-name
file
revision
'manual
)))
(
unless
(
or
(
get-file-buffer
filename
)
(
file-exists-p
filename
))
(
defun
vc-find-revision-no-save
(
file
revision
&optional
backend
buffer
)
"Read REVISION of FILE into BUFFER and return the buffer.
If BUFFER omitted or nil, this function creates a new buffer and sets
`buffer-file-name' to the name constructed from the file name and the
revision number.
Unlike `vc-find-revision-save', doesn't save the buffer to the file."
(
let*
((
buffer
(
when
(
buffer-live-p
buffer
)
buffer
))
(
filebuf
(
or
buffer
(
get-file-buffer
file
)
(
current-buffer
)))
(
filename
(
unless
buffer
(
vc-version-backup-file-name
file
revision
'manual
))))
(
unless
(
and
(
not
buffer
)
(
or
(
get-file-buffer
filename
)
(
file-exists-p
filename
)))
(
with-current-buffer
filebuf
(
let
((
failed
t
))
(
unwind-protect
(
let
((
coding-system-for-read
'no-conversion
)
(
coding-system-for-write
'no-conversion
))
(
with-current-buffer
(
create-file-buffer
filename
)
(
setq
buffer-file-name
filename
)
(
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
)))
(
with-current-buffer
filebuf
(
if
backend
(
vc-call-backend
backend
'find-revision
file
revision
outbuf
)
(
vc-call
find-revision
file
revision
outbuf
))))
(
goto-char
(
point-min
))
(
normal-mode
)
(
if
buffer
(
let
((
buffer-file-name
file
))
(
normal-mode
))
(
normal-mode
)
)
(
set-buffer-modified-p
nil
)
(
setq
buffer-read-only
t
))
(
setq
failed
nil
))
(
when
(
and
failed
(
get-file-buffer
filename
))
(
when
(
and
failed
(
unless
buffer
(
get-file-buffer
filename
)))
(
with-current-buffer
(
get-file-buffer
filename
)
(
set-buffer-modified-p
nil
))
(
kill-buffer
(
get-file-buffer
filename
)))))))
(
let
((
result-buf
(
or
(
get-file-buffer
filename
)
(
let
((
result-buf
(
or
buffer
(
get-file-buffer
filename
)
(
find-file-noselect
filename
))))
(
with-current-buffer
result-buf
(
set
(
make-local-variable
'vc-parent-buffer
)
filebuf
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment