]> git.eshelyaron.com Git - emacs.git/commitdiff
Delete vc-deduce-fileset-1, taking advantage of set-buffer
authorDmitry Gutov <dmitry@gutov.dev>
Tue, 18 Jul 2023 00:49:44 +0000 (03:49 +0300)
committerDmitry Gutov <dmitry@gutov.dev>
Tue, 18 Jul 2023 00:49:44 +0000 (03:49 +0300)
* 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.

lisp/vc/vc.el

index 6c3094719eddb2322d8152a003812925f5668c98..be7fa46c28ec7a6a312a87e1afc59cac393f057e 100644 (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))