]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix detection of Dired with files whose name ends in a colon
authorEli Zaretskii <eliz@gnu.org>
Sat, 24 May 2025 13:25:34 +0000 (16:25 +0300)
committerEshel Yaron <me@eshelyaron.com>
Tue, 27 May 2025 14:32:29 +0000 (16:32 +0200)
* 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)

lisp/dired.el

index 3b1013ff13f7afe26fbd057b4472c2cafb2474da..5e92e18f2f2152c6c533542992a78b6cc1477372 100644 (file)
@@ -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