From: Eli Zaretskii Date: Sat, 24 May 2025 13:25:34 +0000 (+0300) Subject: Fix detection of Dired with files whose name ends in a colon X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d219c53e43b294d378d4a1d70e5e18260829a1c2;p=emacs.git Fix detection of Dired with files whose name ends in a colon * lisp/dired.el (dired-build-subdir-alist): Use a more general regexp to detect file entries whose names end in a colon, when various non-default 'ls' switches are used. (Bug#78493) (cherry picked from commit 463787c4e9a36d9218aaffacbfc85936e0ad86c8) --- diff --git a/lisp/dired.el b/lisp/dired.el index 3b1013ff13f..5e92e18f2f2 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3715,7 +3715,13 @@ instead of `dired-actual-switches'." ;; ange-ftp listings. (and (dired-switches-recursive-p switches) (string-match "\\`/.*:\\(/.*\\)" default-directory) - (concat "\\`" (match-string 1 default-directory))))) + (concat "\\`" (match-string 1 default-directory)))) + ;; Regexp that describes the beginning of line of a + ;; file/directory entry (as opposed to a subdirectory + ;; heading), including the optional mark, inode, and size. + (file-entry-beg-re (concat dired-re-maybe-mark + dired-re-inode-size + dired-re-perms))) (goto-char (point-min)) (setq dired-subdir-alist nil) (while (re-search-forward dired-subdir-regexp nil t) @@ -3724,8 +3730,7 @@ instead of `dired-actual-switches'." (unless (save-excursion (goto-char (match-beginning 0)) (beginning-of-line) - (forward-char 2) - (looking-at-p dired-re-perms)) + (looking-at-p file-entry-beg-re)) (save-excursion (goto-char (match-beginning 1)) (setq new-dir-name