2

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).

Input:

/foo/IMG_2022.JPG;art;oil;wip
/foo/IMG_2023.JPG;oil;art;

Output needed:

/foo/IMG_2023.JPG;oil;art;

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

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

(image-dired-mark-tagged-files)

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.

3
  • 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 at 20:26
  • Thanks. Marking another time with wip just marks wip. The steps seem orthogonal – 412p9wej Mar 11 at 21:40
  • I said UNmark the wip, not mark. I've added an answer that elaborates. – Drew Mar 11 at 22:25
2

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'."
  (interactive)
  (let ((dired-marker-char  ?\    ))
    (image-dired-mark-tagged-files)))

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, privacy policy and cookie policy

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