X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/6757030a5b1c7b2fa80863ae08c06a73d88ad1e9..3f4f0809de70703fc3706c541d3fc27c5fc49a11:/counsel.el diff --git a/counsel.el b/counsel.el index cce85dc27..54729699b 100644 --- a/counsel.el +++ b/counsel.el @@ -1337,11 +1337,14 @@ INITIAL-INPUT can be given as the initial minibuffer input." (defun counsel-ag-occur () "Generate a custom occur buffer for `counsel-ag'." - (ivy-occur-grep-mode) + (unless (eq major-mode 'ivy-occur-grep-mode) + (ivy-occur-grep-mode)) (setq default-directory counsel--git-grep-dir) (let* ((regex (counsel-unquote-regex-parens (setq ivy--old-re - (ivy--regex ivy-text)))) + (ivy--regex + (progn (string-match "\"\\(.*\\)\"" (buffer-name)) + (match-string 1 (buffer-name))))))) (cands (split-string (shell-command-to-string (format counsel-ag-base-command (shell-quote-argument regex)))