[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 08d5578 137/272: counsel.el (counsel-git-log): New command
From: |
Oleh Krehel |
Subject: |
[elpa] master 08d5578 137/272: counsel.el (counsel-git-log): New command |
Date: |
Mon, 25 Apr 2016 10:13:21 +0000 |
branch: master
commit 08d55787516e959bf4b48e0671361e89143f810b
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-git-log): New command
* counsel.el (counsel-git-log-function): New defun.
(counsel-git-log-action): New defun.
---
counsel.el | 42 +++++++++++++++++++++++++++++++++++++-----
1 file changed, 37 insertions(+), 5 deletions(-)
diff --git a/counsel.el b/counsel.el
index e534601..cf6eb01 100644
--- a/counsel.el
+++ b/counsel.el
@@ -934,6 +934,43 @@ done") "\n" t)))
(ivy-read "git stash: " cands
:action 'counsel-git-stash-kill-action
:caller 'counsel-git-stash)))))
+;;** `counsel-git-log'
+(defun counsel-git-log-function (input)
+ (if (< (length input) 3)
+ (counsel-more-chars 3)
+ ;; `counsel--yank-pop-format-function' uses this
+ (setq ivy--old-re (funcall ivy--regex-function input))
+ (counsel--async-command
+ ;; "git log --grep" likes to have groups quoted e.g. \(foo\).
+ ;; But it doesn't like the non-greedy ".*?".
+ (format "GIT_PAGER=cat git log --grep '%s'"
+ (replace-regexp-in-string
+ "\\.\\*\\?" ".*"
+ ivy--old-re)))
+ nil))
+
+(defun counsel-git-log-action (x)
+ (message "%S" (kill-new x)))
+
+(defcustom counsel-yank-pop-truncate-radius 2
+ "When non-nil, truncate the display of long strings."
+ :type 'integer
+ :group 'ivy)
+
+;;;###autoload
+(defun counsel-git-log ()
+ "Call the \"git log --grep\" shell command."
+ (interactive)
+ (let ((counsel-async-split-string-re "\ncommit ")
+ (counsel-yank-pop-truncate-radius 5)
+ (ivy-format-function #'counsel--yank-pop-format-function)
+ (ivy-height 4))
+ (ivy-read "Grep log: " #'counsel-git-log-function
+ :dynamic-collection t
+ :action #'counsel-git-log-action
+ :unwind #'counsel-delete-process
+ :caller 'counsel-git-log)))
+
;;* File
;;** `counsel-find-file'
(defvar counsel-find-file-map
@@ -1435,11 +1472,6 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
(counsel-tmm-prompt (tmm-get-keybind [menu-bar])))
;;** `counsel-yank-pop'
-(defcustom counsel-yank-pop-truncate-radius 2
- "When non-nil, truncate the display of long strings."
- :type 'integer
- :group 'ivy)
-
(defun counsel--yank-pop-truncate (str)
(condition-case nil
(let* ((lines (split-string str "\n" t))
- [elpa] master d71b5c5 081/272: swiper.el (swiper--action): Update regexp-search-ring, (continued)
- [elpa] master d71b5c5 081/272: swiper.el (swiper--action): Update regexp-search-ring, Oleh Krehel, 2016/04/25
- [elpa] master e1c156b 074/272: ivy.el (ivy--resize-minibuffer-to-fit): Check frame-root-window-p, Oleh Krehel, 2016/04/25
- [elpa] master ebd3e29 089/272: swiper.el (swiper--update-input-ivy): Fix a bug, Oleh Krehel, 2016/04/25
- [elpa] master de0e541 234/272: Speed up counsel-grep by up to 40 times, Oleh Krehel, 2016/04/25
- [elpa] master 299bc13 097/272: Fix initial-input not set to nil for 'read-file-name-internal, Oleh Krehel, 2016/04/25
- [elpa] master bab5aab 269/272: doc/Changelog.org: Prepare for the 0.8.0 release, Oleh Krehel, 2016/04/25
- [elpa] master 0efbf6e 055/272: Simplify the signature for :dynamic-collection functions, Oleh Krehel, 2016/04/25
- [elpa] master 6a5a688 201/272: counsel.el: Improve counsel-grep, Oleh Krehel, 2016/04/25
- [elpa] master 65cf724 247/272: Make ivy--regex work with "[^ ]", Oleh Krehel, 2016/04/25
- [elpa] master f72cea2 253/272: swiper.el (swiper-mc): Restore interactive, Oleh Krehel, 2016/04/25
- [elpa] master 08d5578 137/272: counsel.el (counsel-git-log): New command,
Oleh Krehel <=
- [elpa] master 00f08f7 073/272: Improve Ivy documentation UI, Oleh Krehel, 2016/04/25
- [elpa] master 8f527d7 149/272: ivy.el (ivy-next-history-element): No "\\_<" for dynamic-collection, Oleh Krehel, 2016/04/25
- [elpa] master 265bf49 251/272: counsel.el: Fix compile warning, Oleh Krehel, 2016/04/25
- [elpa] master 7cf13a7 186/272: counsel.el (counsel-linux-app): New command, Oleh Krehel, 2016/04/25
- [elpa] master 31a2f86 238/272: counsel.el (counsel-expression-history): enable-recursive-minibuffers, Oleh Krehel, 2016/04/25
- [elpa] master 5299c0a 099/272: doc/ivy.texi: Re-export from previous commit, Oleh Krehel, 2016/04/25
- [elpa] master a50f668 111/272: counsel.el (counsel-locate-options): Make obsolete, Oleh Krehel, 2016/04/25
- [elpa] master 327b85a 239/272: counsel.el (counsel-expression-history): Add docstring, Oleh Krehel, 2016/04/25
- [elpa] master b6f3e45 271/272: Rename swiper -> ivy, Oleh Krehel, 2016/04/25
- [elpa] master 9aa1f5c 156/272: counsel.el (counsel-mode-map): Add counsel-M-x, Oleh Krehel, 2016/04/25