branch: master commit 6905e6cad0042ac673f19e780512530aa36f2a94 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
counsel.el (counsel--rg-targets): Adjust for ivy-occur buffers When nothing is selected in an ivy-occur buffer (of e.g. `counsel-git' or `counsel-find-file'), select all files in that buffer. That's not the same thing as all files in the current directory. --- counsel.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/counsel.el b/counsel.el index a614250..ef559be 100644 --- a/counsel.el +++ b/counsel.el @@ -2915,8 +2915,14 @@ Note: don't use single quotes for the regex." (defun counsel--rg-targets () "Return a list of files to operate on, based on `dired-mode' marks." (if (eq major-mode 'dired-mode) - (let ((files (dired-get-marked-files 'no-dir nil nil t))) - (if (null (cdr files)) + (let ((files + (dired-get-marked-files 'no-dir nil nil t))) + (if (and (null (cdr files)) + (not (when (string-match-p "\\*ivy-occur" (buffer-name)) + (dired-toggle-marks) + (setq files (dired-get-marked-files 'no-dir)) + (dired-toggle-marks) + t))) "" (concat " "