]> git.eshelyaron.com Git - emacs.git/commitdiff
New user option vc-dir-hide-up-to-date-on-revert
authorSean Whitton <spwhitton@spwhitton.name>
Thu, 29 May 2025 11:53:37 +0000 (12:53 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 7 Jun 2025 19:53:10 +0000 (21:53 +0200)
* lisp/vc/vc-dir.el (vc-dir-hide-up-to-date-on-revert):
New defcustom.
(vc-dir-revert-buffer-function): Use it.
* etc/NEWS: Document it.

(cherry picked from commit f9b311464db2e1cc34faaf2c86a9c46216337013)

lisp/vc/vc-dir.el

index 34699ea340d84b03e1d2133a77ae59bac056d175..b8c7e8f67075cc538312c08c841401603b0a8aa2 100644 (file)
@@ -158,6 +158,14 @@ option."
   :group 'vc
   :version "31.1")
 
+(defcustom vc-dir-hide-up-to-date-on-revert nil
+  "If non-nil, \\<vc-dir-mode-map>\\[revert-buffer] in VC-Dir buffers also does \\[vc-dir-hide-up-to-date].
+That is, refreshing the VC-Dir buffer also hides `up-to-date' and
+`ignored' items."
+  :type 'boolean
+  :group 'vc
+  :version "31.1")
+
 (defun vc-dir-move-to-goal-column ()
   ;; Used to keep the cursor on the file name column.
   (beginning-of-line)
@@ -1347,7 +1355,9 @@ specific headers."
                               (not (vc-dir-fileinfo->needs-update info))))))))))))
 
 (defun vc-dir-revert-buffer-function (&optional _ignore-auto _noconfirm)
-  (vc-dir-refresh))
+  (vc-dir-refresh)
+  (when vc-dir-hide-up-to-date-on-revert
+    (vc-dir-hide-state)))
 
 (defun vc-dir-refresh ()
   "Refresh the contents of the *VC-dir* buffer.