[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/agitate 93b2674f70 07/67: Add agitate-diff-refine-cycle
From: |
ELPA Syncer |
Subject: |
[elpa] externals/agitate 93b2674f70 07/67: Add agitate-diff-refine-cycle command |
Date: |
Wed, 28 Sep 2022 16:57:25 -0400 (EDT) |
branch: externals/agitate
commit 93b2674f70820dc0b8d099cc06511bb9347b4bc5
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add agitate-diff-refine-cycle command
---
agitate.el | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/agitate.el b/agitate.el
index 7f36ab93c8..10c5f9148b 100644
--- a/agitate.el
+++ b/agitate.el
@@ -31,6 +31,7 @@
;;; Code:
+(require 'diff)
(require 'log-edit)
(require 'log-view)
(require 'vc-git)
@@ -39,6 +40,39 @@
"Work-in-progress."
:group 'vc)
+;;;; Commands for diffs
+
+(defvar-local agitate--refine-diff-state nil
+ "Current state of `agitate-diff-refine-cycle'.")
+
+;;;###autoload
+(defun agitate-diff-refine-cycle ()
+ "Cycle current, all, or no refined (word-wise) diff highlighting.
+
+Upon first invocation, refine the diff hunk at point or, when
+none exists, the one closest to it. On second call, operate on
+the entire buffer. And on the third time, remove all word-wise
+fontification."
+ (interactive nil diff-mode)
+ (let ((point (point)))
+ (pcase agitate--refine-diff-state
+ ('current
+ (setq-local diff-refine 'font-lock)
+ (font-lock-flush)
+ (goto-char point)
+ (setq agitate--refine-diff-state 'all)
+ (message "Diff refine %s" (propertize "all" 'face 'success)))
+ ('all
+ (revert-buffer)
+ (goto-char point)
+ (recenter)
+ (setq agitate--refine-diff-state nil)
+ (message "Diff refine %s" (propertize "none" 'face 'success)))
+ (_
+ (diff-refine-hunk)
+ (setq agitate--refine-diff-state 'current)
+ (message "Diff refine %s" (propertize "current" 'face 'success))))))
+
;;;; Commands for log-view (listings of commits)
;;;###autoload
- [elpa] branch externals/agitate created (now f736eb51a7), ELPA Syncer, 2022/09/28
- [elpa] externals/agitate a3ee8251d4 01/67: Start recording file history, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 93b2674f70 07/67: Add agitate-diff-refine-cycle command,
ELPA Syncer <=
- [elpa] externals/agitate 16a2ea1cfe 13/67: Simplify agitate-diff-refine-cycle messages, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 6604612c32 05/67: Add agitate-git-grep command, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 0ee85a971b 11/67: Add agitate-diff-buffer-or-file command, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate d6aaced969 10/67: Actually depend on Emacs 27.1, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate e7b6acb8f7 12/67: Limit agitate-diff-refine-cycle to diff-mode, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 43027aefb9 16/67: Add agitate-diff-narrow-dwim command, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 4baa368ffd 02/67: Depend on Emacs 29, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 417539dc73 03/67: Add agitate-log-edit-insert-file-name command, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 1f35cecc20 17/67: Add agitate-diff-kill-dwim prototype, ELPA Syncer, 2022/09/28
- [elpa] externals/agitate 839892328b 28/67: Add missing backronym, ELPA Syncer, 2022/09/28