emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/agitate 0ee85a971b 11/67: Add agitate-diff-buffer-or-fi


From: ELPA Syncer
Subject: [elpa] externals/agitate 0ee85a971b 11/67: Add agitate-diff-buffer-or-file command
Date: Wed, 28 Sep 2022 16:57:25 -0400 (EDT)

branch: externals/agitate
commit 0ee85a971bf358d1fa0bf66864a04a037022f078
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add agitate-diff-buffer-or-file command
---
 agitate.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/agitate.el b/agitate.el
index 808a96ff55..8f83c663e9 100644
--- a/agitate.el
+++ b/agitate.el
@@ -74,6 +74,21 @@ fontification."
        (setq agitate--refine-diff-state 'current)
        (message "Diff refine %s" (propertize "current" 'face 'success))))))
 
+;;;###autoload
+(defun agitate-diff-buffer-or-file ()
+  "Produce a diff against the file or latest revision.
+
+If the buffer is modified, produce a diff that compares its state
+to that of the corresponding file.  In simple terms, show the
+latest unsaved changes.
+
+If the buffer is not modified, produce a diff of the file
+relative to its latest revision."
+  (interactive)
+    (if (buffer-modified-p)
+          (diff-buffer-with-file (current-buffer))
+      (vc-diff)))
+
 ;;;; Commands for log-view (listings of commits)
 
 ;;;###autoload



reply via email to

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