branch: master commit 92f54f610a3bdf441fa50688afe9e52f340abc53 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
ivy.el (ivy-configure): Add :grep-p --- counsel.el | 21 +++++++++++---------- ivy.el | 7 +++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/counsel.el b/counsel.el index 3c09384..7b6aaac 100644 --- a/counsel.el +++ b/counsel.el @@ -1514,9 +1514,8 @@ When CMD is non-nil, prompt for a specific \"git grep\" command." :occur #'counsel-git-grep-occur :unwind-fn #'counsel--grep-unwind :index-fn #'ivy-recompute-index-swiper-async - :display-transformer-fn #'counsel-git-grep-transformer) - -(cl-pushnew 'counsel-git-grep ivy-highlight-grep-commands) + :display-transformer-fn #'counsel-git-grep-transformer + :grep-p t) (defun counsel-git-grep-proj-function (str) "Grep for STR in the current Git repository." @@ -2849,7 +2848,8 @@ CALLER is passed to `ivy-read'." (ivy-configure 'counsel-ag :occur #'counsel-ag-occur :unwind-fn #'counsel--grep-unwind - :display-transformer-fn #'counsel-git-grep-transformer) + :display-transformer-fn #'counsel-git-grep-transformer + :grep-p t) (defun counsel-cd () "Change the directory for the currently running Ivy grep-like command. @@ -2860,8 +2860,6 @@ Works for `counsel-git-grep', `counsel-ag', etc." (ivy-quit-and-run (funcall (ivy-state-caller ivy-last) input new-dir)))) -(cl-pushnew 'counsel-ag ivy-highlight-grep-commands) - (defun counsel-grep-like-occur (cmd-template) (unless (eq major-mode 'ivy-occur-grep-mode) (ivy-occur-grep-mode) @@ -2908,7 +2906,11 @@ This uses `counsel-ag' with `counsel-pt-base-command' instead of (let ((counsel-ag-base-command counsel-pt-base-command) (counsel--grep-tool-look-around nil)) (counsel-ag initial-input :caller 'counsel-pt))) -(cl-pushnew 'counsel-pt ivy-highlight-grep-commands) + +(ivy-configure 'counsel-pt + :unwind-fn #'counsel--grep-unwind + :display-transformer-fn #'counsel-git-grep-transformer + :grep-p t) ;;** `counsel-ack' (defcustom counsel-ack-base-command @@ -2984,9 +2986,8 @@ Example input with inclusion and exclusion file patterns: (ivy-configure 'counsel-rg :occur #'counsel-ag-occur :unwind-fn #'counsel--grep-unwind - :display-transformer-fn #'counsel-git-grep-transformer) - -(cl-pushnew 'counsel-rg ivy-highlight-grep-commands) + :display-transformer-fn #'counsel-git-grep-transformer + :grep-p t) ;;** `counsel-grep' (defvar counsel-grep-map diff --git a/ivy.el b/ivy.el index 247e5b2..8ff3464 100644 --- a/ivy.el +++ b/ivy.el @@ -1919,7 +1919,8 @@ May supersede `ivy-initial-inputs-alist'." unwind-fn index-fn display-transformer-fn - more-chars) + more-chars + grep-p) "Configure `ivy-read' params for CALLER." (declare (indent 1)) (when initial-input @@ -1935,7 +1936,9 @@ May supersede `ivy-initial-inputs-alist'." (when display-transformer-fn (ivy-set-display-transformer caller display-transformer-fn)) (when more-chars - (ivy--alist-set 'ivy-more-chars-alist caller more-chars))) + (ivy--alist-set 'ivy-more-chars-alist caller more-chars)) + (when grep-p + (cl-pushnew caller ivy-highlight-grep-commands))) (defcustom ivy-sort-max-size 30000 "Sorting won't be done for collections larger than this."