From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Peter =?UTF-8?Q?M=C3=BCnster?= Newsgroups: gmane.emacs.bugs Subject: bug#50000: 27.2; tagging marked thumbnails Date: Mon, 16 Aug 2021 17:33:59 +0200 Message-ID: <87sfz9o13s.fsf@a16n.net> References: <874kbwl2qc.fsf@a16n.net> <87lf58rx3g.fsf@gnus.org> <87r1f0gijc.fsf@a16n.net> <87tujwotow.fsf@gnus.org> <87lf558pik.fsf@a16n.net> <87k0koutv3.fsf@gnus.org> <87o89xsuto.fsf@a16n.net> <8735r9fv9j.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11389"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cc: 50000@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 16 17:35:22 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mFee1-0002eB-Oo for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Aug 2021 17:35:21 +0200 Original-Received: from localhost ([::1]:45758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFee0-000065-Gp for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Aug 2021 11:35:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFedi-00005x-WF for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2021 11:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mFedi-0003of-Op for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2021 11:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mFedi-000714-H9 for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2021 11:35:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <874kbwl2qc.fsf@a16n.net> Resent-From: Peter =?UTF-8?Q?M=C3=BCnster?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Aug 2021 15:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50000 X-GNU-PR-Package: emacs Original-Received: via spool by 50000-submit@debbugs.gnu.org id=B50000.162912805026895 (code B ref 50000); Mon, 16 Aug 2021 15:35:02 +0000 Original-Received: (at 50000) by debbugs.gnu.org; 16 Aug 2021 15:34:10 +0000 Original-Received: from localhost ([127.0.0.1]:50768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFecr-0006zj-K5 for submit@debbugs.gnu.org; Mon, 16 Aug 2021 11:34:10 -0400 Original-Received: from server.a16n.net ([178.33.238.77]:33448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFecp-0006zA-Ei for 50000@debbugs.gnu.org; Mon, 16 Aug 2021 11:34:08 -0400 Original-Received: from ws.localdomain (arennes-662-1-84-172.w2-14.abo.wanadoo.fr [2.14.50.172]) by server.a16n.net (Postfix) with ESMTPSA id B971243E05F3; Mon, 16 Aug 2021 17:34:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=a16n.net; s=a16n; t=1629128040; bh=M46Q/bK2nNwu476sz0rtMfQBzO71AzPI859PQ3ddrZc=; h=From:To:Cc:Subject:References:Date; b=aziNdkzqpY5FpBTPUu3sZV/XlGvAqrHslHhGKMKay4mOAsy1qTpxUHy1cufT+7qAn xGtKgbLwGZbaIVfBfilhCKgvJIba9XX5dqZDtmIXDDUvNSPJP3yY7ltL+0D8bJlvzc +ShTEjbxYcgSL5fWgp1YaH150Pn5R9K2cw442yA8VyEvw+xMERFfkdFtJGWIh0iLYN 2CO1n6z81D9uJSp5LF5usB/660WcnaWmRTg88W+o7UFkRY7gY3plvfI9NhOap49fvY gHG2htKCJYHbUWgCPndbeFQpZWKRJCqP6sA6gnA4oIsx587bmLzWHJ7iyvGhpOPTVH F3PZvRWGWa6gA== Original-Received: by ws.localdomain (Postfix, from userid 1000) id E15377426BB; Mon, 16 Aug 2021 17:33:59 +0200 (CEST) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:212039 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, Aug 16 2021, Lars Ingebrigtsen wrote: > I don't think the renames bring a lot of value here, so I'd rather avoid > them. Ok. Please find attached a new patch. =2D-=20 Peter --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-menu-bindings-to-new-functions-in-image-dired.el.patch Content-Transfer-Encoding: quoted-printable From=202bee2a5a92a4d3593a60ded577731966c09c68cb Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Peter=3D20M=3DC3=3DBCnster?=3D Date: Fri, 13 Aug 2021 15:02:03 +0200 Subject: [PATCH] Add menu bindings to new functions in image-dired.el * lisp/image-dired.el (image-dired--with-marked): New macro for cycling over marked thumbnails. (image-dired-tag-thumbnail, image-dired-tag-thumbnail-remove): Can handle now also all marked thumbnails. (image-dired-tag-marked-thumbnails): Remove it, because it's obsoleted by `image-dired-tag-thumbnail' now. (image-dired-delete-marked): Use new macro `image-dired--with-marked', and add command to menu. =2D-- etc/NEWS | 7 +++-- lisp/image-dired.el | 70 ++++++++++++++++++++++++++------------------- 2 files changed, 45 insertions(+), 32 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 26ede71523..6aa574eda3 100644 =2D-- a/etc/NEWS +++ b/etc/NEWS @@ -2415,10 +2415,8 @@ This command, called interactively, toggles the loca= l value of If non-nil (the default), use 'image-dired-thumb-mark' to say what images are marked. =20 =2D*** New command 'image-dired-tag-marked-thumbnails'. =2D *** New command 'image-dired-delete-marked'. =20 ** Miscellaneous =20 --- diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 7092f758db..520d8cdb34 100644 =2D-- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -797,6 +797,21 @@ Queued items live in `image-dired-queue'." (list (list original-file thumbnail-file)))) (run-at-time 0 nil #'image-dired-thumb-queue-run)) =20 +(defmacro image-dired--with-marked (&rest body) + "Eval BODY with point on each marked thumbnail. If no marked file could +be found, execute BODY on the current thumbnail." + `(with-current-buffer image-dired-thumbnail-buffer + (let (found) + (save-mark-and-excursion + (goto-char (point-min)) + (while (not (eobp)) + (when (image-dired-thumb-file-marked-p) + (setq found t) + ,@body) + (forward-char))) + (unless found + ,@body)))) + ;;;###autoload (defun image-dired-dired-toggle-marked-thumbs (&optional arg) "Toggle thumbnails in front of file names in the dired buffer. @@ -1145,20 +1160,15 @@ FILE-TAGS is an alist in the following form: (cons x tag)) files)))) =20 =2D(defun image-dired-tag-marked-thumbnails () =2D "Tag marked thumbnails." =2D (interactive) =2D (when-let ((dired-buf (image-dired-associated-dired-buffer))) =2D (with-current-buffer dired-buf =2D (image-dired-tag-files nil)))) =2D =2D(defun image-dired-tag-thumbnail () =2D "Tag current thumbnail." +(defun image-dired-tag-thumbnail () + "Tag current or marked thumbnails." (interactive) (let ((tag (read-string "Tags to add (separate tags with a semicolon): "= ))) =2D (image-dired-write-tags (list (cons (image-dired-original-file-name)= tag)))) =2D (image-dired-update-property =2D 'tags (image-dired-list-tags (image-dired-original-file-name)))) + (image-dired--with-marked + (image-dired-write-tags + (list (cons (image-dired-original-file-name) tag))) + (image-dired-update-property + 'tags (image-dired-list-tags (image-dired-original-file-name)))))) =20 ;;;###autoload (defun image-dired-delete-tag (arg) @@ -1172,13 +1182,14 @@ With prefix argument ARG, remove tag from file at p= oint." (setq files (dired-get-marked-files))) (image-dired-remove-tag files tag))) =20 =2D(defun image-dired-tag-thumbnail-remove () =2D "Remove tag from thumbnail." +(defun image-dired-tag-thumbnail-remove () + "Remove tag from current or marked thumbnails." (interactive) (let ((tag (read-string "Tag to remove: "))) =2D (image-dired-remove-tag (image-dired-original-file-name) tag)) =2D (image-dired-update-property =2D 'tags (image-dired-list-tags (image-dired-original-file-name)))) + (image-dired--with-marked + (image-dired-remove-tag (image-dired-original-file-name) tag) + (image-dired-update-property + 'tags (image-dired-list-tags (image-dired-original-file-name)))))) =20 (defun image-dired-original-file-name () "Get original file name for thumbnail or display image at point." @@ -1518,8 +1529,10 @@ You probably want to use this together with '("Image-Dired" ["Quit" quit-window] ["Delete thumbnail from buffer" image-dired-delete-char] =2D ["Remove tag from thumbnail" image-dired-tag-thumbnail-remove] =2D ["Tag thumbnail" image-dired-tag-thumbnail] + ["Delete marked images" image-dired-delete-marked] + ["Remove tag from current or marked thumbnails" + image-dired-tag-thumbnail-remove] + ["Tag current or marked thumbnails" image-dired-tag-thumbnail] ["Comment thumbnail" image-dired-comment-thumbnail] ["Refresh thumb" image-dired-refresh-thumb] ["Dynamic line up" image-dired-line-up-dynamic] @@ -2301,15 +2314,12 @@ non-nil." (defun image-dired-delete-marked () "Delete marked thumbnails and associated images." (interactive) =2D (goto-char (point-min)) =2D (let ((dired-buf (image-dired-associated-dired-buffer))) =2D (while (not (eobp)) =2D (if (image-dired-thumb-file-marked-p) =2D (image-dired-delete-char) =2D (forward-char))) =2D (image-dired--line-up-with-method) =2D (with-current-buffer dired-buf =2D (dired-do-delete)))) + (image-dired--with-marked + (image-dired-delete-char) + (backward-char)) + (image-dired--line-up-with-method) + (with-current-buffer (image-dired-associated-dired-buffer) + (dired-do-delete))) =20 (defun image-dired-thumb-update-marks () "Update the marks in the thumbnail buffer." =2D-=20 2.26.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iGoEARECACoWIQS/5hHRBUjla4uZVXU6jitvQ7HLaAUCYRqFZwwccG1AYTE2bi5u ZXQACgkQOo4rb0Oxy2gQkwCeLGyKdU1FGGQcK+709Flb11P0vqEAn0I/Pky056PN DEotzusuUBcV2bsv =9t+n -----END PGP SIGNATURE----- --==-=-=--