emacs-diffs
[Top][All Lists]
Advanced

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

master 995fb1677d 1/2: find-dired: Factor out find-dired--escaped-ls-opt


From: Lars Ingebrigtsen
Subject: master 995fb1677d 1/2: find-dired: Factor out find-dired--escaped-ls-option
Date: Mon, 27 Jun 2022 03:47:22 -0400 (EDT)

branch: master
commit 995fb1677d640784f1ca58ef99a71314a3ac9d30
Author: Allen Li <darkfeline@felesatra.moe>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    find-dired: Factor out find-dired--escaped-ls-option
    
    Deduplicate this logic for other future find-dired commands.
    
    * lisp/find-dired.el (find-dired--escaped-ls-option): New function.
    (find-dired): Use find-dired--escaped-ls-option.
---
 lisp/find-dired.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 61e626080e..998ddbc721 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -209,13 +209,7 @@ it finishes, type \\[kill-find]."
                          " " args " "
                          (shell-quote-argument ")")
                          " "))
-                      (if (string-match "\\`\\(.*\\) {} \\(\\\\;\\|\\+\\)\\'"
-                                        (car find-ls-option))
-                          (format "%s %s %s"
-                                  (match-string 1 (car find-ls-option))
-                                  (shell-quote-argument "{}")
-                                  find-exec-terminator)
-                        (car find-ls-option))))
+                      (find-dired--escaped-ls-option)))
     ;; Start the find process.
     (shell-command (concat args "&") (current-buffer))
     (dired-mode dir (cdr find-ls-option))
@@ -256,6 +250,16 @@ it finishes, type \\[kill-find]."
       (move-marker (process-mark proc) (point) (current-buffer)))
     (setq mode-line-process '(":%s"))))
 
+(defun find-dired--escaped-ls-option ()
+  "Return the car of `find-ls-option' escaped for a shell command."
+  (if (string-match "\\`\\(.*\\) {} \\(\\\\;\\|\\+\\)\\'"
+                   (car find-ls-option))
+      (format "%s %s %s"
+             (match-string 1 (car find-ls-option))
+             (shell-quote-argument "{}")
+             find-exec-terminator)
+    (car find-ls-option)))
+
 (defun kill-find ()
   "Kill the `find' process running in the current buffer."
   (interactive)



reply via email to

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