From f800f2300bf810f907e20ea5a21243a3325890af Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 24 Jan 2026 15:39:11 +0200 Subject: [PATCH] Fix support of listing switches with whitespace in Dired * lisp/dired.el (dired-sort-by-date-regexp) (dired-sort-by-name-regexp): Allow quoted arguments with embedded whitespace, per the doc string of 'dired-listing-switches'. (Bug#80200) --- lisp/dired.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/dired.el b/lisp/dired.el index b987b85c3c7..7f598433a9d 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -5038,12 +5038,16 @@ format, use `\\[universal-argument] \\[dired]'.") ;; `dired-ls-sorting-switches' after -t overrides -t. "[^ " dired-ls-sorting-switches "]*" "\\(\\(\\`\\| +\\)\\(--[^ ]+\\|-[^- t" - dired-ls-sorting-switches "]+\\)\\)* *$") + dired-ls-sorting-switches "]+\\|" + ;; Allow quoted strings + "\"[^\"]*\"\\)\\)* *$") "Regexp recognized by Dired to set `by date' mode.") (defvar dired-sort-by-name-regexp (concat "\\`\\(\\(\\`\\| +\\)\\(--[^ ]+\\|" - "-[^- t" dired-ls-sorting-switches "]+\\)\\)* *$") + "-[^- t" dired-ls-sorting-switches "]+[^- tSXU]+\\|" + ;; Allow quoted strings + "\"[^\"]*\"\\)\\)* *$") "Regexp recognized by Dired to set `by name' mode.") (defvar dired-sort-inhibit nil