]> code.delx.au - gnu-emacs-elpa/commitdiff
Simplify the signature for :dynamic-collection functions
authorOleh Krehel <ohwoeowho@gmail.com>
Sun, 24 Jan 2016 12:25:49 +0000 (13:25 +0100)
committerOleh Krehel <ohwoeowho@gmail.com>
Sun, 24 Jan 2016 12:29:42 +0000 (13:29 +0100)
* ivy.el (ivy--reset-state): When given :dynamic-collection, assume the
  collection function only needs one argument - the string input.

* counsel.el (counsel-ag-function):
(counsel-locate-function):
(counsel-grep-function):
(counsel-recoll-function): Simplify arglist.

counsel.el
ivy.el

index c5ea28828382beb486c1bf22e18495e8fef2aacd..ddf3d4fac6e6fc69865a6c5ef1fbc8b602214126 100644 (file)
@@ -683,7 +683,7 @@ Update the minibuffer with the amount of lines collected every
     "\\\\(" "("
     str)))
 
-(defun counsel-locate-function (str &rest _u)
+(defun counsel-locate-function (str)
   (if (< (length str) 3)
       (counsel-more-chars 3)
     (counsel--async-command
@@ -1166,7 +1166,7 @@ command. %S will be replaced by the regex string. The default is
   :type 'stringp
   :group 'ivy)
 
-(defun counsel-ag-function (string &optional _pred &rest _unused)
+(defun counsel-ag-function (string)
   "Grep in the current directory for STRING."
   (if (< (length string) 3)
       (counsel-more-chars 3)
@@ -1214,7 +1214,7 @@ INITIAL-INPUT can be given as the initial minibuffer input."
                       (swiper--cleanup))
             :caller 'counsel-grep))
 
-(defun counsel-grep-function (string &optional _pred &rest _unused)
+(defun counsel-grep-function (string)
   "Grep in the current directory for STRING."
   (if (< (length string) 3)
       (counsel-more-chars 3)
@@ -1238,7 +1238,7 @@ INITIAL-INPUT can be given as the initial minibuffer input."
           (swiper--cleanup)
           (swiper--add-overlays (ivy--regex ivy-text)))))))
 
-(defun counsel-recoll-function (string &optional _pred &rest _unused)
+(defun counsel-recoll-function (string)
   "Grep in the current directory for STRING."
   (if (< (length string) 3)
       (counsel-more-chars 3)
diff --git a/ivy.el b/ivy.el
index fb251d1488ea6f95bacd3540f8d0e1a2048b1090..9bc5fb39036ef8065983ebc0b0fbc074ff025af6 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1245,6 +1245,8 @@ This is useful for recursive `ivy-read'."
                  (setq initial-input nil))))
             ((eq collection 'internal-complete-buffer)
              (setq coll (ivy--buffer-list "" ivy-use-virtual-buffers)))
+            (dynamic-collection
+             (setq coll (funcall collection ivy-text)))
             ((or (functionp collection)
                  (byte-code-function-p collection)
                  (vectorp collection)