diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2025-06-27 12:39:29 +0100 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2025-06-27 12:39:29 +0100 |
| commit | 772099bc9b8043d46154992e1f06d7b4aa9ceccd (patch) | |
| tree | 411baf741e1be44f57c192a93cf33e89042e54dd | |
| parent | d70f1e0cfe5c6cca5c551326bc0fec613a2d683a (diff) | |
New user option vc-dir-save-some-buffers-on-revert
* lisp/vc/vc-dir.el (vc-dir-save-some-buffers-on-revert):
New user option.
(vc-dir-refresh): Use it.
* etc/NEWS: Document it.
| -rw-r--r-- | etc/NEWS | 6 | ||||
| -rw-r--r-- | lisp/vc/vc-dir.el | 8 |
2 files changed, 14 insertions, 0 deletions
@@ -1876,6 +1876,12 @@ 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-dir-save-some-buffers-on-revert'. +If you customize this variable to non-nil, Emacs will offer to save +relevant buffers before generating the contents of a VC Directory buffer +(like the third-party package Magit does with its status buffer). + +++ *** 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 278bafba022..dfd95b17397 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -166,6 +166,12 @@ That is, refreshing the VC-Dir buffer also hides `up-to-date' and :group 'vc :version "31.1") +(defcustom vc-dir-save-some-buffers-on-revert nil + "If non-nil, first offer to save relevant buffers when refreshing VC-Dir." + :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) @@ -1367,6 +1373,8 @@ Throw an error if another update process is in progress." (error "Another update process is in progress, cannot run two at a time") (let ((def-dir default-directory) (backend vc-dir-backend)) + (when vc-dir-save-some-buffers-on-revert + (vc-buffer-sync-fileset `(,vc-dir-backend (,def-dir)) t)) (vc-set-mode-line-busy-indicator) ;; Call the `dir-status' backend function. ;; `dir-status' is supposed to be asynchronous. |
