]> git.eshelyaron.com Git - emacs.git/commitdiff
Quote files that start with - in dired
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 20 Feb 2022 13:49:41 +0000 (14:49 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 20 Feb 2022 13:50:59 +0000 (14:50 +0100)
* lisp/dired-aux.el (dired-shell-stuff-it): Add ./ to file names
that start with - (bug#10458).

lisp/dired-aux.el

index 41c45b4e514e0d31f828659063a10f82c09bd063..2449d11c0720259bcccbcc74173603ece30722f8 100644 (file)
@@ -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