[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master fd27465 014/272: counsel.el (counsel-git): Fix window sele
From: |
Oleh Krehel |
Subject: |
[elpa] master fd27465 014/272: counsel.el (counsel-git): Fix window selection |
Date: |
Mon, 25 Apr 2016 10:13:14 +0000 |
branch: master
commit fd27465819b085290ca172cc3ac11401dd082d80
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-git): Fix window selection
* counsel.el (counsel--git-dir): New defvar.
(counsel-git): Update.
(counsel-git-action): New defun. Use `with-ivy-window', so that each new
file chosen with e.g. "C-M-n" is selected in the same window.
---
counsel.el | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/counsel.el b/counsel.el
index 062d95c..69b43a7 100644
--- a/counsel.el
+++ b/counsel.el
@@ -331,22 +331,29 @@
#'cl-caddr
(cider-sync-request:complete str ":same")))))
+(defvar counsel--git-dir nil
+ "Store the base git directory.")
+
;;;###autoload
(defun counsel-git ()
"Find file in the current Git repository."
(interactive)
- (let* ((default-directory (locate-dominating-file
- default-directory ".git"))
+ (setq counsel--git-dir (expand-file-name
+ (locate-dominating-file
+ default-directory ".git")))
+ (let* ((default-directory counsel--git-dir)
(cands (split-string
(shell-command-to-string
"git ls-files --full-name --")
"\n"
- t))
- (action `(lambda (x)
- (let ((default-directory ,default-directory))
- (find-file x)))))
+ t)))
(ivy-read "Find file: " cands
- :action action)))
+ :action #'counsel-git-action)))
+
+(defun counsel-git-action (x)
+ (with-ivy-window
+ (let ((default-directory counsel--git-dir))
+ (find-file x))))
(defvar counsel--git-grep-dir nil
"Store the base git directory.")
- [elpa] master updated (03d2b00 -> 39a458e), Oleh Krehel, 2016/04/25
- [elpa] master 8306be1 006/272: Fix compilation warnings, Oleh Krehel, 2016/04/25
- [elpa] master a4317f9 002/272: ivy.el (ivy--get-window): Return a valid window, Oleh Krehel, 2016/04/25
- [elpa] master 83f89d8 003/272: Improve swiper for multiple occurrences on one line, Oleh Krehel, 2016/04/25
- [elpa] master db283d3 005/272: Fix recursive minibuffer exit with "C-g", Oleh Krehel, 2016/04/25
- [elpa] master cabab4b 012/272: swiper.el (swiper-font-lock-ensure): Add bongo-library-mode, Oleh Krehel, 2016/04/25
- [elpa] master 2c50031 004/272: Fix ivy-reverse-i-search broken by recursive update, Oleh Krehel, 2016/04/25
- [elpa] master 6951eba 001/272: Make ivy--regex-plus recognize ! at the beginning of the str, Oleh Krehel, 2016/04/25
- [elpa] master d74fab4 010/272: counsel.el (counsel-M-x): Let-bind this-command, Oleh Krehel, 2016/04/25
- [elpa] master fd27465 014/272: counsel.el (counsel-git): Fix window selection,
Oleh Krehel <=
- [elpa] master 6bf72fd 008/272: counsel.el (counsel-imenu): Work when given positions are overlays, Oleh Krehel, 2016/04/25
- [elpa] master 63be079 009/272: ivy.el (ivy-re-builders-alist): Allow this-command to be a key, Oleh Krehel, 2016/04/25
- [elpa] master 09848ca 013/272: Add cousel-ag-base-command var, Oleh Krehel, 2016/04/25
- [elpa] master adfad96 007/272: support imenu, Oleh Krehel, 2016/04/25
- [elpa] master d09a16b 011/272: swiper.el (swiper-font-lock-ensure): Add bongo-playlist-mode, Oleh Krehel, 2016/04/25
- [elpa] master a0f1e25 021/272: ivy.el (ivy-completion-in-region): Fix log 0 issue, Oleh Krehel, 2016/04/25
- [elpa] master df1dc78 019/272: counsel.el (counsel-find-file): Add initial-input, Oleh Krehel, 2016/04/25
- [elpa] master 2ea56ec 027/272: ivy.el (ivy-occur): Fix when ivy--old-re isn't a string, Oleh Krehel, 2016/04/25
- [elpa] master db3e7ff 015/272: Ensure the return result of `ivy-read', Oleh Krehel, 2016/04/25
- [elpa] master e070f4c 022/272: ivy.el (ivy-add-face-text-property): New defun, Oleh Krehel, 2016/04/25