From 8d1dfb2af38de590244e30d3a9553679b47b3dd0 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Sun, 20 Feb 2022 14:49:41 +0100 Subject: [PATCH] Quote files that start with - in dired * lisp/dired-aux.el (dired-shell-stuff-it): Add ./ to file names that start with - (bug#10458). --- lisp/dired-aux.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 41c45b4e514..2449d11c072 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -954,6 +954,13 @@ prompted for the shell command to use interactively." (setq retval (replace-match x t t retval 2))) retval)) (lambda (x) (concat cmd-prefix command dired-mark-separator x))))) + ;; If a file name starts with "-", add a "./" to avoid the command + ;; interpreting it as a command line switch. + (setq file-list (mapcar (lambda (file) + (if (string-match "\\`-" file) + (concat "./" file) + file)) + file-list)) (concat (cond (on-each -- 2.39.5