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

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

[elpa] master 72a827a 373/399: counsel.el (counsel-git-log): Add additio


From: Oleh Krehel
Subject: [elpa] master 72a827a 373/399: counsel.el (counsel-git-log): Add additional action.
Date: Sat, 20 Jul 2019 14:58:02 -0400 (EDT)

branch: master
commit 72a827a338412f3e73195b9934b2d593c7ca184b
Author: Brian Leung <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-git-log): Add additional action.
    
    counsel-git-log-show-commit-action uses Magit to visit the commit
    corresponding to the currently selected log entry.
    
    Fixes #2129
---
 counsel.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/counsel.el b/counsel.el
index a2ccbf1..826462a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1603,6 +1603,18 @@ done") "\n" t)))
   "Add candidate X to kill ring."
   (message "%S" (kill-new x)))
 
+(declare-function magit-show-commit "ext:magit-diff")
+
+(defun counsel-git-log-show-commit-action (log-entry)
+  "Visit the commit corresponding to LOG-ENTRY."
+  (require 'magit-diff)
+  (let ((commit (substring-no-properties log-entry 0 (string-match-p "\n" 
log-entry))))
+    (magit-show-commit commit)))
+
+(ivy-set-actions
+ 'counsel-git-log
+ '(("v" counsel-git-log-show-commit-action "visit commit")))
+
 ;;** `counsel-git-change-worktree'
 (defun counsel-git-change-worktree-action (git-root-dir tree)
   "Find the corresponding file in the worktree located at tree.



reply via email to

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