From 7852bc9be14a0e11d6f73bee345c078ec27a9648 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 29 May 2025 12:53:37 +0100 Subject: [PATCH] New user option vc-dir-hide-up-to-date-on-revert * 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 34699ea340d..b8c7e8f6707 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -158,6 +158,14 @@ option." :group 'vc :version "31.1") +(defcustom vc-dir-hide-up-to-date-on-revert nil + "If non-nil, \\\\[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. -- 2.39.5