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

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

[elpa] externals/counsel 545b564f58 3/3: Merge branch 'master' into exte


From: Basil L. Contovounesios
Subject: [elpa] externals/counsel 545b564f58 3/3: Merge branch 'master' into externals/counsel
Date: Sun, 31 Mar 2024 17:13:43 -0400 (EDT)

branch: externals/counsel
commit 545b564f58af11d56abc18c7ea4ff6924610fb4f
Merge: 75006bc42d ee56399de6
Author: Basil L. Contovounesios <basil@contovou.net>
Commit: Basil L. Contovounesios <basil@contovou.net>

    Merge branch 'master' into externals/counsel
---
 counsel.el | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/counsel.el b/counsel.el
index 67f93f5b7b..4f46106382 100644
--- a/counsel.el
+++ b/counsel.el
@@ -179,6 +179,10 @@ Return a list or string depending on input."
                        formatter)))
    (t (apply #'format formatter args))))
 
+(defalias 'counsel--null-device
+  (if (fboundp 'null-device) #'null-device (lambda () null-device))
+  "Compatibility shim for Emacs 28 function `null-device'.")
+
 ;;* Async Utility
 (defvar counsel--async-time nil
   "Store the time when a new process was started.
@@ -2651,7 +2655,9 @@ library, which see."
 (defun counsel-locate-cmd-mdfind (input)
   "Return a `mdfind' shell command based on INPUT."
   (counsel-require-program "mdfind")
-  (format "mdfind -name %s" (shell-quote-argument input)))
+  (format "mdfind -name %s 2>%s"
+          (shell-quote-argument input)
+          (shell-quote-argument (counsel--null-device))))
 
 (defun counsel-locate-cmd-es (input)
   "Return a `es' shell command based on INPUT."
@@ -3368,14 +3374,12 @@ relative to the last position stored here.")
             (swiper--add-overlays (ivy--regex ivy-text))))))))
 
 (defun counsel-grep-occur (&optional _cands)
-  "Generate a custom occur buffer for `counsel-grep'."
-  (counsel-grep-like-occur
-   (format
-    "grep -niE %%s %s /dev/null"
-    (shell-quote-argument
-     (file-name-nondirectory
-      (buffer-file-name
-       (ivy-state-buffer ivy-last)))))))
+  "Generate a custom Occur buffer for `counsel-grep'."
+  (let ((file (buffer-file-name (ivy-state-buffer ivy-last))))
+    (counsel-grep-like-occur
+     (format "grep -niE %%s %s %s"
+             (if file (shell-quote-argument (file-name-nondirectory file)) "")
+             (shell-quote-argument (counsel--null-device))))))
 
 (defvar counsel-grep-history nil
   "History for `counsel-grep'.")



reply via email to

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