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

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

[elpa] master 721db4c 244/348: counsel.el (counsel-grep-post-action-hook


From: Oleh Krehel
Subject: [elpa] master 721db4c 244/348: counsel.el (counsel-grep-post-action-hook): New hook for counsel-ag/grep/pt
Date: Sat, 8 Apr 2017 11:04:06 -0400 (EDT)

branch: master
commit 721db4c5509ee65929e5926d5d2ec16d81a2117d
Author: kimim <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-grep-post-action-hook): New hook for counsel-ag/grep/pt
    
    Fixes #800
---
 counsel.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/counsel.el b/counsel.el
index 0febe1e..2d7bdc3 100644
--- a/counsel.el
+++ b/counsel.el
@@ -920,6 +920,12 @@ Describe the selected candidate."
   (list counsel-git-grep-cmd-default)
   "History for `counsel-git-grep' shell commands.")
 
+(defcustom counsel-grep-post-action-hook nil
+  "Hook that runs after the point moves to the next candidate.
+Typical value: '(recenter)."
+  :type 'hook
+  :group 'ivy)
+
 (defun counsel-prompt-function-dir ()
   "Return prompt appended with the parent directory."
   (ivy-add-prompt-count
@@ -956,6 +962,7 @@ Describe the selected candidate."
         (forward-line (1- (string-to-number line-number)))
         (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
         (swiper--ensure-visible)
+        (run-hooks 'counsel-grep-post-action-hook)
         (unless (eq ivy-exit 'done)
           (swiper--cleanup)
           (swiper--add-overlays (ivy--regex ivy-text)))))))
@@ -1823,6 +1830,7 @@ the command."
           (forward-line (- line-number counsel-grep-last-line))
           (setq counsel-grep-last-line line-number))
         (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
+        (run-hooks 'counsel-grep-post-action-hook)
         (if (eq ivy-exit 'done)
             (swiper--ensure-visible)
           (isearch-range-invisible (line-beginning-position)



reply via email to

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