emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a8de88e: Allow killing the diff buffer after `C-x v u'


From: Lars Ingebrigtsen
Subject: master a8de88e: Allow killing the diff buffer after `C-x v u'
Date: Sat, 4 Sep 2021 05:14:20 -0400 (EDT)

branch: master
commit a8de88e3300464eb382a65ea96da69f23d21ead2
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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).
---
 doc/emacs/maintaining.texi | 18 +++++++++++-------
 etc/NEWS                   |  5 +++++
 lisp/vc/vc.el              |  6 ++++--
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 008639d..d17c6d3 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
 @findex vc-revert
 @vindex vc-revert-show-diff
   If you want to discard all the changes you have made to the current
-VC fileset, type @kbd{C-x v u} (@code{vc-revert}).  This shows
-you a diff between the work file(s) and the revision from which you
-started editing, and asks for confirmation for discarding the changes.
-If you agree, the fileset is reverted.  If you don't want @kbd{C-x v
-u} to show a diff, set the variable @code{vc-revert-show-diff} to
-@code{nil} (you can still view the diff directly with @kbd{C-x v =};
-@pxref{Old Revisions}).
+VC fileset, type @kbd{C-x v u} (@code{vc-revert}).  This will ask you
+for confirmation before discarding the changes.  If you agree, the
+fileset is reverted.
+
+  If @code{vc-revert-show-diff} is non-@code{nil}, this command will
+show you a diff between the work file(s) and the revision from which
+you started editing.  Afterwards, the diff buffer will either be
+killed (if this variable is @code{kill}), or the buffer will be buried
+(any other non-@code{nil} value).  If you don't want @kbd{C-x v u} to
+show a diff, set this variable to @code{nil} (you can still view the
+diff directly with @kbd{C-x v =}; @pxref{Old Revisions}).
 
   On locking-based version control systems, @kbd{C-x v u} leaves files
 unlocked; you must lock again to resume editing.  You can also use
diff --git a/etc/NEWS b/etc/NEWS
index ec81541..506eaab 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -997,6 +997,11 @@ keys, add the following to your init file:
 
 ** Change Logs and VC
 
++++
+*** 'vc-revert-show-diff' now has a third possible value: 'kill'.
+If this variable is 'kill', then the diff buffer will be killed after
+the 'vc-revert' action instead of buried.
+
 *** More VC commands can be used from non-file buffers.
 The relevant commands are those that don't change the VC state.
 The 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 8036be3..f6ae270 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -860,7 +860,9 @@ See `run-hooks'."
 
 (defcustom vc-revert-show-diff t
   "If non-nil, `vc-revert' shows a `vc-diff' buffer before querying."
-  :type 'boolean
+  :type '(choice (const :tag "Show and bury afterwards" t)
+                 (const :tag "Show and kill afterwards" kill)
+                 (const :tag "Don't show" nil))
   :version "24.1")
 
 ;; Header-insertion hair
@@ -2757,7 +2759,7 @@ to the working revision (except for keyword expansion)."
                                       (if (= nfiles 1) "" "s"))))))
            (error "Revert canceled")))
       (when diff-buffer
-       (quit-windows-on diff-buffer)))
+       (quit-windows-on diff-buffer (eq vc-revert-show-diff 'kill))))
     (dolist (file files)
       (message "Reverting %s..." (vc-delistify files))
       (vc-revert-file file)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]