[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5fcdfb4 65/90: Add better positioning to counsel-git-grep
From: |
Oleh Krehel |
Subject: |
[elpa] master 5fcdfb4 65/90: Add better positioning to counsel-git-grep finalizer |
Date: |
Tue, 30 Jun 2015 07:29:02 +0000 |
branch: master
commit 5fcdfb4e13899b2ba6d0848a747d14c441a8ac6b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add better positioning to counsel-git-grep finalizer
counsel.el (counsel-git-grep-action): Use a regex instead of just
splitting the string on ":". Additionally, goto match, not just the line
of the match.
Fixes #153
---
counsel.el | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/counsel.el b/counsel.el
index 3c9fa1f..3f82275 100644
--- a/counsel.el
+++ b/counsel.el
@@ -241,14 +241,17 @@
(recenter-top-bottom)))
(defun counsel-git-grep-action (x)
- (let ((lst (split-string x ":")))
- (find-file (expand-file-name (car lst) counsel--git-grep-dir))
- (goto-char (point-min))
- (forward-line (1- (string-to-number (cadr lst))))
- (unless (eq ivy-exit 'done)
- (setq swiper--window (selected-window))
- (swiper--cleanup)
- (swiper--add-overlays (ivy--regex ivy-text)))))
+ (when (string-match "\\`\\(.*?\\):\\([0-9]+\\):\\(.*\\)\\'" x)
+ (let ((file-name (match-string-no-properties 1 x))
+ (line-number (match-string-no-properties 2 x)))
+ (find-file (expand-file-name file-name counsel--git-grep-dir))
+ (goto-char (point-min))
+ (forward-line (1- (string-to-number line-number)))
+ (re-search-forward (ivy--regex ivy-text t) (line-end-position) t)
+ (unless (eq ivy-exit 'done)
+ (setq swiper--window (selected-window))
+ (swiper--cleanup)
+ (swiper--add-overlays (ivy--regex ivy-text))))))
;;;###autoload
(defun counsel-git-grep (&optional initial-input)
- [elpa] master 1dbdcdc 55/90: counsel.el (counsel-M-x): Fixup, (continued)
- [elpa] master 1dbdcdc 55/90: counsel.el (counsel-M-x): Fixup, Oleh Krehel, 2015/06/30
- [elpa] master bcc5f45 56/90: counsel.el (counsel-M-x): Fixup smex interaction, Oleh Krehel, 2015/06/30
- [elpa] master e238286 57/90: "M-n", "M-p", "M-i" should switch directories when needed, Oleh Krehel, 2015/06/30
- [elpa] master 3f41ce6 58/90: Put the file instead of partial input on history, Oleh Krehel, 2015/06/30
- [elpa] master 5e3c635 59/90: Add a set of commands for resizing minibuffer height, Oleh Krehel, 2015/06/30
- [elpa] master 7b91a39 60/90: ivy.el (ivy-kill-line): Add and bind to "C-k", Oleh Krehel, 2015/06/30
- [elpa] master dcf0f64 61/90: Add "^" as initial input to "C-h f" and "C-h v", Oleh Krehel, 2015/06/30
- [elpa] master 1ef7e18 62/90: "M-i" should not switch directories, Oleh Krehel, 2015/06/30
- [elpa] master 46695ac 63/90: Fix non-file completions ability to enter tramp completion, Oleh Krehel, 2015/06/30
- [elpa] master a5e49ff 64/90: Make counsel-M-x respect ivy-format-function, Oleh Krehel, 2015/06/30
- [elpa] master 5fcdfb4 65/90: Add better positioning to counsel-git-grep finalizer,
Oleh Krehel <=
- [elpa] master 581d8c0 66/90: Don't cut off "/ssh:foo" input, Oleh Krehel, 2015/06/30
- [elpa] master 513a77e 67/90: ivy.el (ivy-alt-done): Find file if given a full tramp path, Oleh Krehel, 2015/06/30
- [elpa] master 972036c 68/90: ivy.el (ivy-alt-done): Enable recursive minibuffers, Oleh Krehel, 2015/06/30
- [elpa] master d9c4427 69/90: Improve performance for "^" initial input, Oleh Krehel, 2015/06/30
- [elpa] master 2c8ad2a 70/90: Add support for Windows drive letters, Oleh Krehel, 2015/06/30
- [elpa] master d466ade 71/90: Match drive letter at start of current directory, Oleh Krehel, 2015/06/30
- [elpa] master cdb2b1a 72/90: Fix the case where file name can contain ~, Oleh Krehel, 2015/06/30
- [elpa] master 7f97ded 74/90: ivy-hydra.el (hydra-ivy): Bind "C-g", Oleh Krehel, 2015/06/30
- [elpa] master 5c09439 75/90: Re-scale the text height to default in the minibuffer, Oleh Krehel, 2015/06/30
- [elpa] master 321f277 76/90: Fix color blending for composite faces, Oleh Krehel, 2015/06/30