Delete vc-deduce-fileset-1, taking advantage of set-buffer

* lisp/vc/vc.el (vc-deduce-fileset): Set buffer to the base
buffer, if any (bug#63949).  That's to replace the more complex
previous strategy.  vc-deduce-fileset is allowed to change the
current buffer, so why not do it for that case.
(vc-deduce-fileset-1): Delete, moving the meat of the logic back
to vc-deduce-fileset.
This commit is contained in:
Dmitry Gutov 2023-07-18 03:49:44 +03:00
parent bec707da4d
commit 2f48e488d4

View file

@ -1121,19 +1121,8 @@ possible values of STATE are explained in `vc-state', and MODEL in
the returned list.
BEWARE: this function may change the current buffer."
(let (new-buf res)
(with-current-buffer (or (buffer-base-buffer) (current-buffer))
(setq res
(vc-deduce-fileset-1 not-state-changing
allow-unregistered
state-model-only-files))
(setq new-buf (current-buffer)))
(set-buffer new-buf)
res))
(defun vc-deduce-fileset-1 (not-state-changing
allow-unregistered
state-model-only-files)
(when (buffer-base-buffer)
(set-buffer (buffer-base-buffer)))
(let (backend)
(cond
((derived-mode-p 'vc-dir-mode)
@ -1158,7 +1147,7 @@ BEWARE: this function may change the current buffer."
(derived-mode-p 'diff-mode)))))
(progn ;FIXME: Why not `with-current-buffer'? --Stef.
(set-buffer vc-parent-buffer)
(vc-deduce-fileset-1 not-state-changing allow-unregistered state-model-only-files)))
(vc-deduce-fileset not-state-changing allow-unregistered state-model-only-files)))
((and (not buffer-file-name)
(setq backend (vc-responsible-backend default-directory)))
(list backend nil))