In image-dired I use M-x image-dired-mark-tagged-files to mark files containing a tag using regexp. e.g. oil.

What regex do I need to mark oil but not wip (work in progress).



Output needed:


M-x image-dired-mark-tagged-files

image-dired-mark-tagged-files is an autoloaded interactive compiled Lisp function in ‘image-dired.el’.


Use regexp to mark files with matching tag. A ‘tag’ is a keyword, a piece of meta data, associated with an image file and stored in image-dired’s database file. This command lets you input a regexp and this will be matched against all tags on all image files in the database file. The files that have a matching tag will be marked in the dired buffer.

  • An Elisp regexp can't express this, AFAIK. But you can do it in two steps: (1) match oil marking all such matches, (2) match wip to UNmark all of those matches. If no one contradicts this, by proposing a single-regexp answer, then I can add this comment as an answer.
    – Drew
    Mar 11, 2021 at 20:26
  • Thanks. Marking another time with wip just marks wip. The steps seem orthogonal
    – jjk
    Mar 11, 2021 at 21:40
  • I said UNmark the wip, not mark. I've added an answer that elaborates.
    – Drew
    Mar 11, 2021 at 22:25

1 Answer 1


An Elisp regexp can't express this, AFAIK. (Some regexp dialects can.)

But you can do it in two steps:

  1. Mark oil matches, which will include some wip matches.
  2. UNmark wip matches.

There seems to be no command image-dired-unmark-tagged-files. But you can define one, just by binding dired-marker-char to a space char and "marking" with that. Like this (untested):

(defun my-image-dired-unmark-tagged-files ()
  "Use regexp to unmark files with matching tag.
See `image-dired-mark-tagged-files'."
  (let ((dired-marker-char  ?\    ))

Alternatively, after marking the oil files you can:

  1. Use * c * Q, to change all * marks to Q (or any other char).
  2. Use image-dired-mark-tagged-files to mark the wip files.
  3. Use M-DEL * to remove all * marks, unmarking the wip files.

In Dired, you can mark lines with any char, and you can change marks easily. And a line that is "unmarked" is just a line that's marked with a space-char mark.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.