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)
This commit is contained in:
Eli Zaretskii 2026-01-24 15:39:11 +02:00
parent e1d65b3c22
commit f800f2300b

View file

@ -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