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#49988: 27.2; visible marks in the thumbnail buffer Date: Tue, 10 Aug 2021 23:04:30 +0200 Message-ID: <87fsvhko4h.fsf@a16n.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37020"; mail-complaints-to="usenet@ciao.gmane.io" To: 49988@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 10 23:05:15 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 1mDYvz-0009KX-CA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Aug 2021 23:05:15 +0200 Original-Received: from localhost ([::1]:56900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDYvy-0001Kq-1M for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Aug 2021 17:05:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDYvn-0001KQ-3E for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 17:05:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49384) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mDYvm-0005HQ-LP for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 17:05:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mDYvm-00005i-B2 for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 17:05:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Peter =?UTF-8?Q?M=C3=BCnster?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Aug 2021 21:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49988 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1628629486315 (code B ref -1); Tue, 10 Aug 2021 21:05:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Aug 2021 21:04:46 +0000 Original-Received: from localhost ([127.0.0.1]:60930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDYvS-00004w-G4 for submit@debbugs.gnu.org; Tue, 10 Aug 2021 17:04:46 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:43702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mDYvM-0008WQ-Oi for submit@debbugs.gnu.org; Tue, 10 Aug 2021 17:04:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDYvM-0000oH-HP for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 17:04:36 -0400 Original-Received: from server.a16n.net ([178.33.238.77]:37724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDYvJ-0004v8-SJ for bug-gnu-emacs@gnu.org; Tue, 10 Aug 2021 17:04:36 -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 8D59A43E09BD for ; Tue, 10 Aug 2021 23:04:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=a16n.net; s=a16n; t=1628629471; bh=RvHTVktlQLhxD+J8dANJFQM2am5fDgmG2WeOaNQ+9os=; h=From:To:Subject:Date; b=gMZDEoa7ljBodTMj2G9GaTXTfmwLd2syDQbZffx9CQxD9A54sitjyN/SkQnnEFpNE dn1nipIp8os2sHMq9/d4m2+wGSFZEvU8vWdqN7cIpw+8wN8XblhEmDhiIvH3pUregx pk6LtqIUcli6EZZNcpqtreyFuIkP+7dPjsSumw3FxBWMIskFQBjGY9/JdNU6tHcbff fvhvf+/J2n2Vfo9SGc3+KdpYw4LdfBP/BQpbr40g3BhQUH9iAa+A+SZKQ0ax//Nv0f WiwRRwwBc/zzmI6Pqqmr8FRzEMkmX6tAmutaoxv9aStqsrKe4ZoXlGHQhT9lFed7Lu fZceDgxBR8Lbg== Original-Received: by ws.localdomain (Postfix, from userid 1000) id B78A374235E; Tue, 10 Aug 2021 23:04:30 +0200 (CEST) Received-SPF: pass client-ip=178.33.238.77; envelope-from=pm@a16n.net; helo=server.a16n.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:211541 Archived-At: Hi, It would be nice, if the marks were visible in image-dired-thumbnail-mode. Here is a patch, that uses a background color for the thumbnails: * lisp/image-dired.el (image-dired-thumb-update-marks): New function that makes the marks visible in the thumbnail buffer. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 8a065f2e6f..eb2b092059 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -460,6 +460,17 @@ This is where you see the cursor." :type 'integer :group 'image-dired) +(defcustom image-dired-thumb-visible-marks nil + "Make marks visible in thumbnail buffer. +If non-nil, apply `image-dired-thumb-mark-color' to background of marked images." + :type 'boolean + :group 'image-dired) + +(defcustom image-dired-thumb-mark-color "orange" + "Background-color for marked images in thumbnail buffer." + :type 'string + :group 'image-dired) + (defcustom image-dired-line-up-method 'dynamic "Default method for line-up of thumbnails in thumbnail buffer. Used by `image-dired-display-thumbs' and other functions that needs @@ -2311,6 +2322,32 @@ non-nil." (image-dired-track-original-file)) (image-dired-display-thumb-properties)) +(defun image-dired-thumb-file-marked-p () + "Check if file is marked in associated dired buffer." + (let ((file-name (image-dired-original-file-name)) + (dired-buf (image-dired-associated-dired-buffer))) + (if (and dired-buf file-name) + (with-current-buffer dired-buf + (if (dired-goto-file file-name) + (image-dired-dired-file-marked-p)))))) + +(defun image-dired-thumb-update-marks () + "Update the marks in the thumbnail buffer." + ;; TODO: only called by image-dired-mouse-toggle-mark but there are + ;; certainly other places, where it should be called too. + (when image-dired-thumb-visible-marks + (with-current-buffer image-dired-thumbnail-buffer + (save-excursion + (goto-char (point-min)) + (let ((inhibit-read-only t)) + (while (not (eobp)) + (if (image-dired-thumb-file-marked-p) + (add-face-text-property + (point) (1+ (point)) + (list :background image-dired-thumb-mark-color)) + (remove-text-properties (point) (1+ (point)) '(face nil))) + (forward-char))))))) + (defun image-dired-mouse-toggle-mark-1 () "Toggle dired mark for current thumbnail. Track this in associated dired buffer if `image-dired-track-movement' is @@ -2335,7 +2372,8 @@ non-nil." (forward-char)))) (mouse-set-point event) (goto-char (posn-point (event-end event))) - (image-dired-mouse-toggle-mark-1))) + (image-dired-mouse-toggle-mark-1)) + (image-dired-thumb-update-marks)) (defun image-dired-dired-display-properties () "Display properties for dired file in the echo area." What do think about that? -- Peter