1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Add support for history of image tags and completion in the minibuffer

* lisp/image-dired.el (image-dired-tag-history): New variable holding the
tag history.
(image-dired-tag-files, image-dired-tag-thumbnail, image-dired-delete-tag)
(image-dired-tag-thumbnail-remove): Use it for the user input.
This commit is contained in:
Peter Münster 2021-08-18 11:21:51 +02:00 committed by Lars Ingebrigtsen
parent 63d6e1ffa1
commit 8bc6dbecd2

View file

@ -652,6 +652,8 @@ Each item has the form (ORIGINAL-FILE TARGET-FILE).")
"Maximum number of concurrent jobs permitted for generating images.
Increase at own risk.")
(defvar image-dired-tag-history nil "Variable holding the tag history.")
(defun image-dired-pngnq-thumb (spec)
"Quantize thumbnail described by format SPEC with pngnq(1)."
(let ((process
@ -1147,7 +1149,9 @@ FILE-TAGS is an alist in the following form:
(defun image-dired-tag-files (arg)
"Tag marked file(s) in dired. With prefix ARG, tag file at point."
(interactive "P")
(let ((tag (read-string "Tags to add (separate tags with a semicolon): "))
(let ((tag (completing-read
"Tags to add (separate tags with a semicolon): "
image-dired-tag-history nil nil nil 'image-dired-tag-history))
files)
(if arg
(setq files (list (dired-get-filename)))
@ -1161,7 +1165,9 @@ FILE-TAGS is an alist in the following form:
(defun image-dired-tag-thumbnail ()
"Tag current or marked thumbnails."
(interactive)
(let ((tag (read-string "Tags to add (separate tags with a semicolon): ")))
(let ((tag (completing-read
"Tags to add (separate tags with a semicolon): "
image-dired-tag-history nil nil nil 'image-dired-tag-history)))
(image-dired--with-marked
(image-dired-write-tags
(list (cons (image-dired-original-file-name) tag)))
@ -1173,7 +1179,8 @@ FILE-TAGS is an alist in the following form:
"Remove tag for selected file(s).
With prefix argument ARG, remove tag from file at point."
(interactive "P")
(let ((tag (read-string "Tag to remove: "))
(let ((tag (completing-read "Tag to remove: " image-dired-tag-history
nil nil nil 'image-dired-tag-history))
files)
(if arg
(setq files (list (dired-get-filename)))
@ -1183,7 +1190,8 @@ With prefix argument ARG, remove tag from file at point."
(defun image-dired-tag-thumbnail-remove ()
"Remove tag from current or marked thumbnails."
(interactive)
(let ((tag (read-string "Tag to remove: ")))
(let ((tag (completing-read "Tag to remove: " image-dired-tag-history
nil nil nil 'image-dired-tag-history)))
(image-dired--with-marked
(image-dired-remove-tag (image-dired-original-file-name) tag)
(image-dired-update-property