aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2025-06-27 12:39:29 +0100
committerSean Whitton2025-06-27 12:39:29 +0100
commit772099bc9b8043d46154992e1f06d7b4aa9ceccd (patch)
tree411baf741e1be44f57c192a93cf33e89042e54dd
parentd70f1e0cfe5c6cca5c551326bc0fec613a2d683a (diff)
downloademacs-772099bc9b8043d46154992e1f06d7b4aa9ceccd.tar.gz
emacs-772099bc9b8043d46154992e1f06d7b4aa9ceccd.zip
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/NEWS6
-rw-r--r--lisp/vc/vc-dir.el8
2 files changed, 14 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index eb85baae341..32f08d63c68 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1876,6 +1876,12 @@ the VC Directory buffer also has the effect of the 'x' command.
1876That is, typing 'g' refreshes the buffer and also hides items in the 1876That is, typing 'g' refreshes the buffer and also hides items in the
1877'up-to-date' and 'ignored' states. 1877'up-to-date' and 'ignored' states.
1878 1878
1879---
1880*** New user option 'vc-dir-save-some-buffers-on-revert'.
1881If you customize this variable to non-nil, Emacs will offer to save
1882relevant buffers before generating the contents of a VC Directory buffer
1883(like the third-party package Magit does with its status buffer).
1884
1879+++ 1885+++
1880*** New user option 'vc-async-checkin' to enable async checkin operations. 1886*** New user option 'vc-async-checkin' to enable async checkin operations.
1881Currently only supported by the Git and Mercurial backends. 1887Currently 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
166 :group 'vc 166 :group 'vc
167 :version "31.1") 167 :version "31.1")
168 168
169(defcustom vc-dir-save-some-buffers-on-revert nil
170 "If non-nil, first offer to save relevant buffers when refreshing VC-Dir."
171 :type 'boolean
172 :group 'vc
173 :version "31.1")
174
169(defun vc-dir-move-to-goal-column () 175(defun vc-dir-move-to-goal-column ()
170 ;; Used to keep the cursor on the file name column. 176 ;; Used to keep the cursor on the file name column.
171 (beginning-of-line) 177 (beginning-of-line)
@@ -1367,6 +1373,8 @@ Throw an error if another update process is in progress."
1367 (error "Another update process is in progress, cannot run two at a time") 1373 (error "Another update process is in progress, cannot run two at a time")
1368 (let ((def-dir default-directory) 1374 (let ((def-dir default-directory)
1369 (backend vc-dir-backend)) 1375 (backend vc-dir-backend))
1376 (when vc-dir-save-some-buffers-on-revert
1377 (vc-buffer-sync-fileset `(,vc-dir-backend (,def-dir)) t))
1370 (vc-set-mode-line-busy-indicator) 1378 (vc-set-mode-line-busy-indicator)
1371 ;; Call the `dir-status' backend function. 1379 ;; Call the `dir-status' backend function.
1372 ;; `dir-status' is supposed to be asynchronous. 1380 ;; `dir-status' is supposed to be asynchronous.