ivy: update doom*counsel-ag-function advice to reflect upstream changes

This commit is contained in:
Henrik Lissner 2016-12-07 00:58:56 -05:00
parent 0a90805fd5
commit 3150bb7c99

View file

@ -109,7 +109,7 @@ DIR specifies the default-directory from which ag is run."
(counsel-ag " (TODO|FIXME|NOTE) " (doom/project-root))) (counsel-ag " (TODO|FIXME|NOTE) " (doom/project-root)))
;;;###autoload ;;;###autoload
(defun doom*counsel-ag-function (string extra-ag-args) (defun doom*counsel-ag-function (string base-cmd extra-ag-args)
"Advice to get rid of the character limit from `counsel-ag-function', which "Advice to get rid of the character limit from `counsel-ag-function', which
interferes with my custom :ag ex command `doom:ivy-ag-search'." interferes with my custom :ag ex command `doom:ivy-ag-search'."
(when (null extra-ag-args) (when (null extra-ag-args)
@ -120,12 +120,14 @@ interferes with my custom :ag ex command `doom:ivy-ag-search'."
(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 ((ag-cmd (format counsel-ag-base-command (let ((ag-cmd (format base-cmd
(concat extra-ag-args (concat extra-ag-args
" -- " " -- "
(shell-quote-argument regex))))) (shell-quote-argument regex)))))
(counsel--async-command ag-cmd)) (if (file-remote-p default-directory)
nil))) (split-string (shell-command-to-string ag-cmd) "\n" t)
(counsel--async-command ag-cmd)
nil)))))
;;;###autoload ;;;###autoload
(defun doom/counsel-ag-occur () (defun doom/counsel-ag-occur ()