branch: externals/agitate commit 5a1b31fe09ceb3900eab05c585aac2dd2504bc2f Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add agitate-log-view-kill-revision command --- agitate.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/agitate.el b/agitate.el index c4c83cc432..7f36ab93c8 100644 --- a/agitate.el +++ b/agitate.el @@ -32,12 +32,33 @@ ;;; Code: (require 'log-edit) +(require 'log-view) (require 'vc-git) (defgroup agitate () "Work-in-progress." :group 'vc) +;;;; Commands for log-view (listings of commits) + +;;;###autoload +(defun agitate-log-view-kill-revision () + "Append to `kill-ring' log-view revision at or around point. + +When the log-view is in the short format (one compact line per +revision), the revision is the one on the current line. If the +revision is expanded with `log-view-expanded-log-entry-function' +and point is somewhere inside the expanded text, the revision is +still the same. + +When the log-view is in the long format (detailed view where each +revision spans several lines), the revision is the one pertinent +to the text at point." + (interactive) + (when-let ((revision (cadr (log-view-current-entry (point) t)))) + (kill-new (format "%s" revision)) + (message "Copied: %s" revision))) + ;;;; Commands for log-edit (commit messages) (defun agitate--log-edit-extract-file (with-file-extension)