emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8bc6dbe 4/4: Add support for history of image tags and completion


From: Lars Ingebrigtsen
Subject: master 8bc6dbe 4/4: Add support for history of image tags and completion in the minibuffer
Date: Thu, 19 Aug 2021 09:03:30 -0400 (EDT)

branch: master
commit 8bc6dbecd214ff1649edab2258274385ec00a876
Author: Peter Münster <pm@a16n.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/image-dired.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 97fbd7b..cf878ae 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]