[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2ed4416 165/184: ivy.el (ivy-configure): Add :exit-codes
From: |
Oleh Krehel |
Subject: |
[elpa] master 2ed4416 165/184: ivy.el (ivy-configure): Add :exit-codes |
Date: |
Wed, 16 Oct 2019 13:15:15 -0400 (EDT) |
branch: master
commit 2ed4416f50136ae0a748f9de6b98705493e202a6
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-configure): Add :exit-codes
---
counsel.el | 30 ++++++++++++------------------
ivy.el | 12 ++++++++++--
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/counsel.el b/counsel.el
index 2df98cc..a43ae0b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1334,8 +1334,6 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
(define-key map (kbd "C-x C-d") 'counsel-cd)
map))
-(counsel-set-async-exit-code 'counsel-git-grep 1 "No matches found")
-
(defvar counsel-git-grep-cmd-default "git --no-pager grep --full-name -n
--no-color -i -I -e \"%s\""
"Initial command for `counsel-git-grep'.")
@@ -1522,7 +1520,8 @@ When CMD is non-nil, prompt for a specific \"git grep\"
command."
:unwind-fn #'counsel--grep-unwind
:index-fn #'ivy-recompute-index-swiper-async
:display-transformer-fn #'counsel-git-grep-transformer
- :grep-p t)
+ :grep-p t
+ :exit-codes '(1 "No matches found"))
(defun counsel-git-grep-proj-function (str)
"Grep for STR in the current Git repository."
@@ -2418,8 +2417,6 @@ string - the full shell command to run."
("r" counsel-find-file-as-root "open as root")
("d" counsel-locate-action-dired "dired")))
-(counsel-set-async-exit-code 'counsel-locate 1 "Nothing found")
-
(defvar counsel-locate-history nil
"History for `counsel-locate'.")
@@ -2519,7 +2516,8 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
:caller 'counsel-locate))
(ivy-configure 'counsel-locate
- :unwind-fn #'counsel-delete-process)
+ :unwind-fn #'counsel-delete-process
+ :exit-codes '(1 "Nothing found"))
;;** `counsel-fzf'
(defvar counsel-fzf-cmd "fzf -f \"%s\""
@@ -2573,7 +2571,8 @@ FZF-PROMPT, if non-nil, is passed as `ivy-read' prompt
argument."
(ivy-configure 'counsel-fzf
:occur #'counsel-fzf-occur
- :unwind-fn #'counsel-delete-process)
+ :unwind-fn #'counsel-delete-process
+ :exit-codes '(1 "Nothing found"))
(defun counsel-fzf-action (x)
"Find file X in current fzf directory."
@@ -2595,8 +2594,6 @@ FZF-PROMPT, if non-nil, is passed as `ivy-read' prompt
argument."
'(("x" counsel-locate-action-extern "xdg-open")
("d" counsel-locate-action-dired "dired")))
-(counsel-set-async-exit-code 'counsel-fzf 1 "Nothing found")
-
;;** `counsel-dpkg'
;;;###autoload
(defun counsel-dpkg ()
@@ -2760,8 +2757,6 @@ regex string."
(defvar counsel--regex-look-around nil)
-(counsel-set-async-exit-code 'counsel-ag 1 "No matches found")
-
(defconst counsel--command-args-separator "-- ")
(defun counsel--split-command-args (arguments)
@@ -2858,7 +2853,8 @@ CALLER is passed to `ivy-read'."
:occur #'counsel-ag-occur
:unwind-fn #'counsel--grep-unwind
:display-transformer-fn #'counsel-git-grep-transformer
- :grep-p t)
+ :grep-p t
+ :exit-codes '(1 "No matches found"))
(defun counsel-cd ()
"Change the directory for the currently running Ivy grep-like command.
@@ -2952,8 +2948,6 @@ This uses `counsel-ag' with `counsel-ack-base-command'
replacing
Note: don't use single quotes for the regex."
:type 'string)
-(counsel-set-async-exit-code 'counsel-rg 1 "No matches found")
-
(defun counsel--rg-targets ()
"Return a list of files to operate on, based on `dired-mode' marks."
(if (eq major-mode 'dired-mode)
@@ -2996,7 +2990,8 @@ Example input with inclusion and exclusion file patterns:
:occur #'counsel-ag-occur
:unwind-fn #'counsel--grep-unwind
:display-transformer-fn #'counsel-git-grep-transformer
- :grep-p t)
+ :grep-p t
+ :exit-codes '(1 "No matches found"))
;;** `counsel-grep'
(defvar counsel-grep-map
@@ -3077,8 +3072,6 @@ relative to the last position stored here.")
(buffer-file-name
(ivy-state-buffer ivy-last)))))))
-(counsel-set-async-exit-code 'counsel-grep 1 "")
-
(defvar counsel-grep-history nil
"History for `counsel-grep'.")
@@ -3125,7 +3118,8 @@ When non-nil, INITIAL-INPUT is the initial search
pattern."
:index-fn #'ivy-recompute-index-swiper-async
:occur #'counsel-grep-occur
:more-chars 2
- :grep-p t)
+ :grep-p t
+ :exit-codes '(1 ""))
;;;###autoload
(defun counsel-grep-backward (&optional initial-input)
diff --git a/ivy.el b/ivy.el
index 99f9d2e..c589147 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1910,6 +1910,8 @@ May supersede `ivy-initial-inputs-alist'."
(set alist-sym (cons (cons key val)
(symbol-value alist-sym))))))
+(declare-function counsel-set-async-exit-code "counsel")
+
(cl-defun ivy-configure (caller
&key
initial-input
@@ -1922,7 +1924,8 @@ May supersede `ivy-initial-inputs-alist'."
format-fn
display-transformer-fn
more-chars
- grep-p)
+ grep-p
+ exit-codes)
"Configure `ivy-read' params for CALLER."
(declare (indent 1))
(when initial-input
@@ -1946,7 +1949,12 @@ May supersede `ivy-initial-inputs-alist'."
(when more-chars
(ivy--alist-set 'ivy-more-chars-alist caller more-chars))
(when grep-p
- (cl-pushnew caller ivy-highlight-grep-commands)))
+ (cl-pushnew caller ivy-highlight-grep-commands))
+ (when exit-codes
+ (let (code msg)
+ (while (and (setq code (pop exit-codes))
+ (setq msg (pop exit-codes)))
+ (counsel-set-async-exit-code caller code msg)))))
(defcustom ivy-sort-max-size 30000
"Sorting won't be done for collections larger than this."
- [elpa] master 7854d03 129/184: counsel.el (counsel-google): Add, (continued)
- [elpa] master 7854d03 129/184: counsel.el (counsel-google): Add, Oleh Krehel, 2019/10/16
- [elpa] master cd634c6 183/184: doc/Changelog.org: Release 0.13.0, Oleh Krehel, 2019/10/16
- [elpa] master 0dfd70d 135/184: counsel.el (counsel-google-function): Require json, Oleh Krehel, 2019/10/16
- [elpa] master eed1f06 138/184: counsel.el (counsel--py-action): Don't auto-insert parens, Oleh Krehel, 2019/10/16
- [elpa] master 52295c4 137/184: swiper.el (swiper-isearch): Fix searching for "$^", Oleh Krehel, 2019/10/16
- [elpa] master 80c2669 142/184: ivy.el (ivy--alist-set): Work-around emacs-24.3 not having alist-get, Oleh Krehel, 2019/10/16
- [elpa] master 8b07572 149/184: ivy.el (ivy-configure): Add :display-transformer-fn, Oleh Krehel, 2019/10/16
- [elpa] master 9da8003 158/184: counsel.el (counsel-M-x): Don't sort by default, Oleh Krehel, 2019/10/16
- [elpa] master 8f08f38 155/184: counsel.el (counsel--grep-last-pos): Refactor from counsel-grep-last-line, Oleh Krehel, 2019/10/16
- [elpa] master 6b40d40 156/184: ivy.el (ivy--occur-press-update-window): Re-use ivy-highlight-grep-commands, Oleh Krehel, 2019/10/16
- [elpa] master 2ed4416 165/184: ivy.el (ivy-configure): Add :exit-codes,
Oleh Krehel <=
- [elpa] master 2ce5450 177/184: counsel.el (counsel-find-file): Bind "M-o R" to find-file-read-only, Oleh Krehel, 2019/10/16
- [elpa] master c82b852 174/184: ivy.el (ivy-occur-revert-buffer): Simplify, Oleh Krehel, 2019/10/16
- [elpa] master 8bc23e6 104/184: counsel.el (counsel-compile): delete duplicates, Oleh Krehel, 2019/10/16
- [elpa] master 966525c 118/184: counsel.el (counsel-cd): Fix for counsel-ag, Oleh Krehel, 2019/10/16
- [elpa] master f628569 127/184: Make ivy--magic-file-slash less aggressive, Oleh Krehel, 2019/10/16
- [elpa] master efdee7a 172/184: swiper.el (swiper--occur-insert-lines): Extract, Oleh Krehel, 2019/10/16