emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 6905e6c 097/184: counsel.el (counsel--rg-targets): Adjust


From: Oleh Krehel
Subject: [elpa] master 6905e6c 097/184: counsel.el (counsel--rg-targets): Adjust for ivy-occur buffers
Date: Wed, 16 Oct 2019 13:14:58 -0400 (EDT)

branch: master
commit 6905e6cad0042ac673f19e780512530aa36f2a94
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    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
            " "



reply via email to

[Prev in Thread] Current Thread [Next in Thread]