aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-06-28 10:30:29 +0100
committerSean Whitton2025-06-28 10:30:29 +0100
commit6cd9574e20dccb15924dd42f0f481ba5b7367a42 (patch)
tree68208b570458bce0600bb82d5dc4e7cf4aaf81e1
parentb4d3ac1e041347081f0843e0b47ad86516cd9cc9 (diff)
downloademacs-6cd9574e20dccb15924dd42f0f481ba5b7367a42.tar.gz
emacs-6cd9574e20dccb15924dd42f0f481ba5b7367a42.zip
vc-dir-update: Update 'backend' VC properties
* lisp/vc/vc-dir.el (vc-dir-update): Update 'backend' VC file properties from ENTRIES. This resolves some issues relating to cache invalidation. * lisp/vc/vc-hooks.el (vc-backend): Improve docstring.
-rw-r--r--lisp/vc/vc-dir.el14
-rw-r--r--lisp/vc/vc-hooks.el5
2 files changed, 14 insertions, 5 deletions
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index dfd95b17397..b8dd07cd294 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -487,9 +487,11 @@ If BODY uses EVENT, it should be a variable,
487 (vc-dir-fileinfo->name data))))))) 487 (vc-dir-fileinfo->name data)))))))
488 488
489(defun vc-dir-update (entries buffer &optional noinsert) 489(defun vc-dir-update (entries buffer &optional noinsert)
490 "Update BUFFER's ewoc from the list of ENTRIES. 490 "Update BUFFER's VC-Dir ewoc from ENTRIES.
491If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." 491This has the effect of adding ENTRIES to the VC-Dir buffer BUFFER.
492 ;; Add ENTRIES to the vc-dir buffer BUFFER. 492If optional argument NOINSERT is non-nil, update ewoc nodes, but don't
493add elements of ENTRIES to the buffer that aren't already in the ewoc.
494Also update some VC file properties from ENTRIES."
493 (with-current-buffer buffer 495 (with-current-buffer buffer
494 ;; Insert the entries sorted by name into the ewoc. 496 ;; Insert the entries sorted by name into the ewoc.
495 ;; We assume the ewoc is sorted too, which should be the 497 ;; We assume the ewoc is sorted too, which should be the
@@ -592,7 +594,11 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
592 (apply #'vc-dir-create-fileinfo entry)))))) 594 (apply #'vc-dir-create-fileinfo entry))))))
593 (when to-remove 595 (when to-remove
594 (let ((inhibit-read-only t)) 596 (let ((inhibit-read-only t))
595 (apply #'ewoc-delete vc-ewoc (nreverse to-remove))))))) 597 (apply #'ewoc-delete vc-ewoc (nreverse to-remove)))))
598 ;; Update VC file properties.
599 (pcase-dolist (`(,file ,state ,_extra) entries)
600 (vc-file-setprop file 'vc-backend
601 (if (eq state 'unregistered) 'none vc-dir-backend)))))
596 602
597(defun vc-dir-busy () 603(defun vc-dir-busy ()
598 (and (buffer-live-p vc-dir-process-buffer) 604 (and (buffer-live-p vc-dir-process-buffer)
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index f9fa3e1bd7e..3e12fac350e 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -377,7 +377,10 @@ backend is tried first."
377 377
378(defun vc-backend (file-or-list) 378(defun vc-backend (file-or-list)
379 "Return the version control type of FILE-OR-LIST, nil if it's not registered. 379 "Return the version control type of FILE-OR-LIST, nil if it's not registered.
380If the argument is a list, the files must all have the same back end." 380If the argument is a list, the files must all have the same back end.
381
382This function returns cached information. To query the VCS regarding
383whether FILE-OR-LIST is registered or unregistered, use `vc-registered'."
381 ;; `file' can be nil in several places (typically due to the use of 384 ;; `file' can be nil in several places (typically due to the use of
382 ;; code like (vc-backend buffer-file-name)). 385 ;; code like (vc-backend buffer-file-name)).
383 (cond ((stringp file-or-list) 386 (cond ((stringp file-or-list)