diff options
author | Allen Li <darkfeline@felesatra.moe> | 2022-06-27 09:44:29 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-06-27 09:44:29 +0200 |
commit | 995fb1677d640784f1ca58ef99a71314a3ac9d30 (patch) | |
tree | a3ba8dfceb4d41bcfaf83ec3b24a07c5295f66f5 | |
parent | f7149f73b125ba56494a89e8053f090a215b842e (diff) | |
download | emacs-995fb1677d640784f1ca58ef99a71314a3ac9d30.tar.gz emacs-995fb1677d640784f1ca58ef99a71314a3ac9d30.tar.bz2 emacs-995fb1677d640784f1ca58ef99a71314a3ac9d30.zip |
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.
-rw-r--r-- | lisp/find-dired.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/find-dired.el b/lisp/find-dired.el index 61e626080ea..998ddbc721f 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) |