unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Peter Münster" <pm@a16n.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 49999@debbugs.gnu.org
Subject: bug#49999: 27.2; save-mark-and-excursion does not save mark-active
Date: Fri, 13 Aug 2021 11:19:20 +0200	[thread overview]
Message-ID: <875yw9aehz.fsf@a16n.net> (raw)
In-Reply-To: <87bl64l2sm.fsf@a16n.net>


[-- Attachment #1.1: Type: text/plain, Size: 325 bytes --]

On Wed, Aug 11 2021, Lars Ingebrigtsen wrote:

> So `save-mark-and-excursion' works exactly as it should.  But if you
> don't want transient-mark-mode to switch itself off, you have to say
> something like:

Thanks for your explanation. Please find attached a patch, that uses
your solution.

-- 
           Peter

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Minor-enhancements-for-image-dired.el.patch --]
[-- Type: text/x-patch, Size: 2153 bytes --]

From 8e0d6c4e787ecb56ef8eede83ea5c5d8ed0db5e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20M=C3=BCnster?= <pm@a16n.net>
Date: Fri, 13 Aug 2021 11:13:43 +0200
Subject: [PATCH] Minor enhancements for image-dired.el

* lisp/image-dired.el (image-dired-thumb-visible-marks): Add the group.
(image-dired-thumb-update-marks): Keep the mark state when changing faces.
---
 lisp/image-dired.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 76c7ae91f0..34bf1d02a9 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -465,6 +465,7 @@ This is where you see the cursor."
 If non-nil, apply the `image-dired-thumb-mark' face to marked
 images."
   :type 'boolean
+  :group 'image-dired
   :version "28.1")
 
 (defface image-dired-thumb-mark
@@ -2360,20 +2361,18 @@ non-nil."
 
 (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
+      (save-mark-and-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))
-                 'image-dired-thumb-mark)
-              (remove-text-properties (point) (1+ (point))
-                                      '(face image-dired-thumb-mark)))
+            (with-silent-modifications
+              (if (image-dired-thumb-file-marked-p)
+                  (add-face-text-property (point) (1+ (point))
+                                          'image-dired-thumb-mark)
+                (remove-text-properties (point) (1+ (point))
+                                        '(face image-dired-thumb-mark))))
             (forward-char)))))))
 
 (defun image-dired-mouse-toggle-mark-1 ()
-- 
2.26.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

  reply	other threads:[~2021-08-13  9:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11  9:59 bug#49999: 27.2; save-mark-and-excursion does not save mark-active Peter Münster
2021-08-11 12:19 ` Lars Ingebrigtsen
2021-08-11 15:46   ` Lars Ingebrigtsen
2021-08-13  9:19     ` Peter Münster [this message]
2021-08-13 10:30       ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yw9aehz.fsf@a16n.net \
    --to=pm@a16n.net \
    --cc=49999@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).