Subject: bug#68637: 30.0.50; image-dired-mark-tagged-files and ls -F

From: Manuel Giraud <[email-masked]>
Date: Sun, 21 Jan 2024 22:44:28 +0100

"Basil L. Contovounesios" via "Bug reports for GNU Emacs, the Swiss army
knife of text editors" <[email-masked]> writes:

[...]

> At first glance it looks like the
>
>   (search-forward-regexp (format "\\s %s$" curr-file) nil t)
>
> in image-dired-mark-tagged-files doesn't take into account any of the
> indicators that 'ls -F' may append to file names.

Thanks for this insight.  The following patch seems to do the trick.  I
think we can limit ourselves to executable and symlink since I can't see
how directories, pipes, sockets or doors(?) could be regular image
files.

diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el
index f4778d8e121..7219a106ca8 100644
--- a/lisp/image/image-dired-dired.el
+++ b/lisp/image/image-dired-dired.el
@@ -383,7 +383,7 @@ image-dired-mark-tagged-files
                       (file-name-directory curr-file)))
         (setq curr-file (file-name-nondirectory curr-file))
         (goto-char (point-min))
-        (when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
+        (when (search-forward-regexp (format "\\s %s[*@]?$" curr-file) nil t)
           (setq hits (+ hits 1))
           (dired-mark 1))))
     (message "%d files with matching tag marked" hits)))

> The commentary suggests using dired-mark-files-regexp would be too slow.
> I wonder if that's still the case, or if there are any faster
> alternatives without loss of generality?

I did not try this alternative.
-- 
Manuel Giraud