aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-09-04 11:14:12 +0200
committerLars Ingebrigtsen2021-09-04 11:14:12 +0200
commita8de88e3300464eb382a65ea96da69f23d21ead2 (patch)
tree45aa8243a4ba09995c4a5fb4453e18bdb5e81fbd
parent56c98a4ad886376b3c73d6c8b9a96f6bca8f0f48 (diff)
downloademacs-a8de88e3300464eb382a65ea96da69f23d21ead2.tar.gz
emacs-a8de88e3300464eb382a65ea96da69f23d21ead2.zip
Allow killing the diff buffer after `C-x v u'
* doc/emacs/maintaining.texi (VC Undo): Document this. * lisp/vc/vc.el (vc-revert-show-diff): Allow a `kill' value. (vc-revert): Use it (bug#16902).
-rw-r--r--doc/emacs/maintaining.texi18
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/vc/vc.el6
3 files changed, 20 insertions, 9 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 008639d1a9a..d17c6d3e757 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1136,13 +1136,17 @@ Revert the work file(s) in the current VC fileset to the last revision
1136@findex vc-revert 1136@findex vc-revert
1137@vindex vc-revert-show-diff 1137@vindex vc-revert-show-diff
1138 If you want to discard all the changes you have made to the current 1138 If you want to discard all the changes you have made to the current
1139VC fileset, type @kbd{C-x v u} (@code{vc-revert}). This shows 1139VC fileset, type @kbd{C-x v u} (@code{vc-revert}). This will ask you
1140you a diff between the work file(s) and the revision from which you 1140for confirmation before discarding the changes. If you agree, the
1141started editing, and asks for confirmation for discarding the changes. 1141fileset is reverted.
1142If you agree, the fileset is reverted. If you don't want @kbd{C-x v 1142
1143u} to show a diff, set the variable @code{vc-revert-show-diff} to 1143 If @code{vc-revert-show-diff} is non-@code{nil}, this command will
1144@code{nil} (you can still view the diff directly with @kbd{C-x v =}; 1144show you a diff between the work file(s) and the revision from which
1145@pxref{Old Revisions}). 1145you started editing. Afterwards, the diff buffer will either be
1146killed (if this variable is @code{kill}), or the buffer will be buried
1147(any other non-@code{nil} value). If you don't want @kbd{C-x v u} to
1148show a diff, set this variable to @code{nil} (you can still view the
1149diff directly with @kbd{C-x v =}; @pxref{Old Revisions}).
1146 1150
1147 On locking-based version control systems, @kbd{C-x v u} leaves files 1151 On locking-based version control systems, @kbd{C-x v u} leaves files
1148unlocked; you must lock again to resume editing. You can also use 1152unlocked; you must lock again to resume editing. You can also use
diff --git a/etc/NEWS b/etc/NEWS
index ec81541e655..506eaab0fc0 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -997,6 +997,11 @@ keys, add the following to your init file:
997 997
998** Change Logs and VC 998** Change Logs and VC
999 999
1000+++
1001*** 'vc-revert-show-diff' now has a third possible value: 'kill'.
1002If this variable is 'kill', then the diff buffer will be killed after
1003the 'vc-revert' action instead of buried.
1004
1000*** More VC commands can be used from non-file buffers. 1005*** More VC commands can be used from non-file buffers.
1001The relevant commands are those that don't change the VC state. 1006The relevant commands are those that don't change the VC state.
1002The non-file buffers which can use VC commands are those that have 1007The non-file buffers which can use VC commands are those that have
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 8036be390a9..f6ae27075f3 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -860,7 +860,9 @@ See `run-hooks'."
860 860
861(defcustom vc-revert-show-diff t 861(defcustom vc-revert-show-diff t
862 "If non-nil, `vc-revert' shows a `vc-diff' buffer before querying." 862 "If non-nil, `vc-revert' shows a `vc-diff' buffer before querying."
863 :type 'boolean 863 :type '(choice (const :tag "Show and bury afterwards" t)
864 (const :tag "Show and kill afterwards" kill)
865 (const :tag "Don't show" nil))
864 :version "24.1") 866 :version "24.1")
865 867
866;; Header-insertion hair 868;; Header-insertion hair
@@ -2757,7 +2759,7 @@ to the working revision (except for keyword expansion)."
2757 (if (= nfiles 1) "" "s")))))) 2759 (if (= nfiles 1) "" "s"))))))
2758 (error "Revert canceled"))) 2760 (error "Revert canceled")))
2759 (when diff-buffer 2761 (when diff-buffer
2760 (quit-windows-on diff-buffer))) 2762 (quit-windows-on diff-buffer (eq vc-revert-show-diff 'kill))))
2761 (dolist (file files) 2763 (dolist (file files)
2762 (message "Reverting %s..." (vc-delistify files)) 2764 (message "Reverting %s..." (vc-delistify files))
2763 (vc-revert-file file) 2765 (vc-revert-file file)