From f9b311464db2e1cc34faaf2c86a9c46216337013 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. --- etc/NEWS | 7 +++++++ lisp/vc/vc-dir.el | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 13479790407..6b6e5ca4c6d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1773,6 +1773,13 @@ were added, removed or edited, Emacs would refuse to proceed. Now Emacs prompts to first register the unregistered files, so that all files in the fileset are in a compatible state for a checkin. +--- +*** New user option 'vc-dir-hide-up-to-date-on-revert'. +If you customize this variable to non-nil, the 'g' command to refresh +the VC Directory buffer also has the effect of the 'x' command. +That is, typing 'g' refreshes the buffer and also hides items in the +'up-to-date' and 'ignored' states. + +++ *** New user option 'vc-async-checkin' to enable async checkin operations. Currently only supported by the Git and Mercurial backends. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index b9d733d934b..278bafba022 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.