completion/ivy: update for upstream changes (fix ag/rg/pt commands)

This commit is contained in:
Henrik Lissner 2018-02-26 22:11:41 -05:00
parent cdedbb114e
commit 36f903d029
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -156,35 +156,22 @@ search current file. See `+ivy-task-tags' to customize what this searches for."
:caller '+ivy/tasks)) :caller '+ivy/tasks))
;;;###autoload ;;;###autoload
(defun +ivy*counsel-ag-function (string base-cmd extra-ag-args) (defun +ivy*counsel-ag-function (string)
"Advice to 1) get rid of the character limit from `counsel-ag-function' and 2) "Advice to 1) get rid of the character limit from `counsel-ag-function' and 2)
disable ivy's over-zealous parentheses quoting behavior (if i want literal disable ivy's over-zealous parentheses quoting behavior (if i want literal
parentheses, I'll escape them myself). parentheses, I'll escape them myself).
NOTE This may need to be updated frequently, to meet changes upstream (in NOTE This may need to be updated frequently, to meet changes upstream (in
counsel-rg)." counsel-rg)."
(when (null extra-ag-args)
(setq extra-ag-args ""))
(if (< (length string) 1) ; <-- modified the character limit (if (< (length string) 1) ; <-- modified the character limit
(counsel-more-chars 1) ; <-- (counsel-more-chars 1) ; <--
(let ((default-directory (ivy-state-directory ivy-last)) (let ((default-directory (ivy-state-directory ivy-last))
(regex (counsel-unquote-regex-parens (regex (counsel-unquote-regex-parens
(setq ivy--old-re (setq ivy--old-re
(ivy--regex string))))) (ivy--regex string)))))
(let* ((args-end (string-match " -- " extra-ag-args)) (counsel--async-command (format counsel-ag-command
(file (if args-end (shell-quote-argument regex)))
(substring-no-properties extra-ag-args (+ args-end 3)) nil)))
""))
(extra-ag-args (if args-end
(substring-no-properties extra-ag-args 0 args-end)
extra-ag-args))
(ag-cmd (format base-cmd
(concat extra-ag-args
" -- "
(shell-quote-argument regex)
file))))
(counsel--async-command ag-cmd)
nil))))
;;;###autoload ;;;###autoload
(defun +ivy/wgrep-occur () (defun +ivy/wgrep-occur ()