Skip to content

Commit

Permalink
counsel.el (counsel-ag-function): allow to override the minimum searc…
Browse files Browse the repository at this point in the history
…h term length.

Fixes #1780
  • Loading branch information
mookid authored and abo-abo committed Nov 18, 2018
1 parent 08f8139 commit c0a7efb
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions counsel.el
Original file line number Diff line number Diff line change
Expand Up @@ -2493,17 +2493,17 @@ NEEDLE is the search string."
(let ((command-args (counsel--split-command-args string)))
(let ((switches (car command-args))
(search-term (cdr command-args)))
(if (< (length search-term) 3)
(let ((ivy-text search-term))
(ivy-more-chars))
(let ((default-directory (ivy-state-directory ivy-last))
(regex (counsel-unquote-regex-parens
(setq ivy--old-re
(ivy--regex search-term)))))
(counsel--async-command (counsel--format-ag-command
switches
(shell-quote-argument regex)))
nil)))))
(or
(let ((ivy-text search-term))
(ivy-more-chars))
(let ((default-directory (ivy-state-directory ivy-last))
(regex (counsel-unquote-regex-parens
(setq ivy--old-re
(ivy--regex search-term)))))
(counsel--async-command (counsel--format-ag-command
switches
(shell-quote-argument regex)))
nil)))))

;;;###autoload
(defun counsel-ag (&optional initial-input initial-directory extra-ag-args ag-prompt)
Expand Down

0 comments on commit c0a7efb

Please sign in to comment.