[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 587526e 138/272: counsel.el (counsel-git-grep-transformer)
From: |
Oleh Krehel |
Subject: |
[elpa] master 587526e 138/272: counsel.el (counsel-git-grep-transformer): New defun |
Date: |
Mon, 25 Apr 2016 10:13:21 +0000 |
branch: master
commit 587526e00bc68c6610fee53146b6a176d190ad9c
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-git-grep-transformer): New defun
* counsel.el (ivy-set-display-transformer):
'counsel-git-grep-transformer to 'counsel-git-grep .
Fixes #399
---
counsel.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/counsel.el b/counsel.el
index cf6eb01..e8597a6 100644
--- a/counsel.el
+++ b/counsel.el
@@ -686,6 +686,7 @@ Describe the selected candidate."
map))
(ivy-set-occur 'counsel-git-grep 'counsel-git-grep-occur)
+(ivy-set-display-transformer 'counsel-git-grep 'counsel-git-grep-transformer)
(defvar counsel-git-grep-cmd "git --no-pager grep --full-name -n --no-color -i
-e %S"
"Store the command for `counsel-git-grep'.")
@@ -753,6 +754,19 @@ Describe the selected candidate."
candidates))
(setq ivy--old-re regexp))))
+(defun counsel-git-grep-transformer (str)
+ "Higlight file and line number in STR."
+ (when (string-match "\\`\\([^:]+\\):\\([^:]+\\):" str)
+ (set-text-properties (match-beginning 1)
+ (match-end 1)
+ '(face compilation-info)
+ str)
+ (set-text-properties (match-beginning 2)
+ (match-end 2)
+ '(face compilation-line-number)
+ str))
+ str)
+
;;;###autoload
(defun counsel-git-grep (&optional cmd initial-input)
"Grep for a string in the current git repository.
- [elpa] master 220fd38 079/272: doc/ivy.org: Improve the markup, (continued)
- [elpa] master 220fd38 079/272: doc/ivy.org: Improve the markup, Oleh Krehel, 2016/04/25
- [elpa] master 50f3092 169/272: counsel.el (counsel--async-sentinel): Start refactor, Oleh Krehel, 2016/04/25
- [elpa] master 41b8b0d 113/272: ivy.el (ivy-occur): Add a warning, Oleh Krehel, 2016/04/25
- [elpa] master b39e449 228/272: counsel.el (counsel-ag-map): Add, Oleh Krehel, 2016/04/25
- [elpa] master 79f9cda 165/272: counsel-ag: Fix escaping problem, Oleh Krehel, 2016/04/25
- [elpa] master f1c7233 164/272: swiper.el (swiper-occur): Bind ivy--regex-function, Oleh Krehel, 2016/04/25
- [elpa] master 1de78f3 160/272: Improve window handling for ivy-occur, Oleh Krehel, 2016/04/25
- [elpa] master c90784d 087/272: doc/ivy.org: Update, Oleh Krehel, 2016/04/25
- [elpa] master d085765 146/272: ivy.el (ivy-switch-buffer): Don't fall back to switch-to-buffer, Oleh Krehel, 2016/04/25
- [elpa] master be06ae0 163/272: swiper.el: Add docstring, Oleh Krehel, 2016/04/25
- [elpa] master 587526e 138/272: counsel.el (counsel-git-grep-transformer): New defun,
Oleh Krehel <=
- [elpa] master d40bdab 134/272: doc/ivy.org: Fix typo, Oleh Krehel, 2016/04/25
- [elpa] master 1c45b29 150/272: ivy-occur-mode: new commands on "j", "k", "c", Oleh Krehel, 2016/04/25
- [elpa] master c68d2cc 189/272: ivy.el (ivy-thing-at-point): Try ffap-file-at-point, Oleh Krehel, 2016/04/25
- [elpa] master d6b18f0 151/272: ivy.el (ivy-occur-press): Pulse no longer, Oleh Krehel, 2016/04/25
- [elpa] master b3ca886 133/272: counsel.el (counsel--generic): Improve, Oleh Krehel, 2016/04/25
- [elpa] master c8013c7 053/272: counsel.el (ivy-ffap-url-functions): Add Emacs git repo, Oleh Krehel, 2016/04/25
- [elpa] master 1d3f080 263/272: ivy.el (ivy--magic-file-slash): Allow "non-existing-dir//", Oleh Krehel, 2016/04/25
- [elpa] master 37d52cc 120/272: swiper.el (swiper--update-input-ivy): Replace "\t", Oleh Krehel, 2016/04/25
- [elpa] master 07624b3 180/272: Fix compilation warnings, Oleh Krehel, 2016/04/25
- [elpa] master f3b2640 124/272: swiper.el (swiper--ivy): Update signature, Oleh Krehel, 2016/04/25