[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/agitate 723c9b072b 6/6: Add agitate--log-view-on-revisi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/agitate 723c9b072b 6/6: Add agitate--log-view-on-revision-p and use it |
Date: |
Thu, 29 Sep 2022 07:57:19 -0400 (EDT) |
branch: externals/agitate
commit 723c9b072b37eadf7cbc887aa47188ba5822669a
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add agitate--log-view-on-revision-p and use it
---
README.org | 4 ++--
agitate.el | 29 ++++++++++++++++++++++-------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/README.org b/README.org
index 97938ffc6d..7bb123a9fe 100644
--- a/README.org
+++ b/README.org
@@ -145,8 +145,8 @@ commits" are documented here:
<https://www.conventionalcommits.org/en/v1.0.0/>.
point.
#+findex: agitate-log-view-kill-revision-expanded
-+ ~agitate-log-view-kill-revision-expanded~ :: PROTOTYPE. Append to
- ~kill-ring~ expanded message of log-view revision at point.
++ ~agitate-log-view-kill-revision-expanded~ :: Append to ~kill-ring~
+ expanded message of log-view revision at point.
** Extras for vc-git
:PROPERTIES:
diff --git a/agitate.el b/agitate.el
index 6b73d46c5a..7510910712 100644
--- a/agitate.el
+++ b/agitate.el
@@ -243,6 +243,15 @@ to the text at point."
(kill-new (format "%s" revision))
(message "Copied: %s" revision)))
+(defun agitate--log-view-on-revision-p (&optional pos)
+ "Return non-nil if optional POS is on a revision line.
+When POS is nil, use `point'."
+ (when-let ((point (or pos (point)))
+ ((not (log-view-inside-comment-p point))))
+ (save-excursion
+ (goto-char (line-beginning-position))
+ (looking-at log-view-message-re))))
+
(defun agitate--log-view-revision-expanded-bounds (&optional back)
"Return position of expanded log-view message.
With optional BACK, find the beginning, else the end."
@@ -261,18 +270,24 @@ With optional BACK, find the beginning, else the end."
;;;###autoload
(defun agitate-log-view-kill-revision-expanded ()
- "PROTOTYPE Append to `kill-ring' expanded message of log-view revision at
point."
+ "Append to `kill-ring' expanded message of log-view revision at point."
(interactive nil log-view-mode)
(let ((pos (point)))
- ;; TODO 2022-09-28: Also test when we are on the line of the
- ;; revision, with the expanded entry right below.
- (when (log-view-inside-comment-p pos)
+ ;; TODO 2022-09-29: Rewrite this to avoid repetition...
+ (cond
+ ((log-view-inside-comment-p pos)
+ (kill-new
+ (buffer-substring-no-properties
+ (agitate--log-view-revision-expanded-bounds :back)
+ (agitate--log-view-revision-expanded-bounds))))
+ ((agitate--log-view-on-revision-p pos)
+ (forward-line 1)
(kill-new
(buffer-substring-no-properties
(agitate--log-view-revision-expanded-bounds :back)
- (agitate--log-view-revision-expanded-bounds)))
- (message "Copied message of `%s' revision"
- (cadr (log-view-current-entry pos t))))))
+ (agitate--log-view-revision-expanded-bounds)))))
+ (message "Copied message of `%s' revision"
+ (cadr (log-view-current-entry pos t)))))
;;;; Commands for vc-git (Git backend for the Version Control framework)
- [elpa] externals/agitate updated (905e921029 -> 723c9b072b), ELPA Syncer, 2022/09/29
- [elpa] externals/agitate 5fbe6e3f85 2/6: Always go to point-min in agitate-vc-git-show, ELPA Syncer, 2022/09/29
- [elpa] externals/agitate a04f65e8bc 4/6: Remove unused variable, ELPA Syncer, 2022/09/29
- [elpa] externals/agitate 73299258f4 5/6: Make agitate-diff-refine-cycle NONE state explicit, ELPA Syncer, 2022/09/29
- [elpa] externals/agitate 629423345e 3/6: Add revert-buffer-function to agitate-vc-git-show, ELPA Syncer, 2022/09/29
- [elpa] externals/agitate f91849b996 1/6: Add completion table to disable sorting of commits, ELPA Syncer, 2022/09/29
- [elpa] externals/agitate 723c9b072b 6/6: Add agitate--log-view-on-revision-p and use it,
ELPA Syncer <=