GNU bug report logs - #49999
27.2; save-mark-and-excursion does not save mark-active

Previous Next

Package: emacs;

Reported by: Peter Münster <pm <at> a16n.net>

Date: Wed, 11 Aug 2021 10:01:02 UTC

Severity: normal

Tags: confirmed

Found in version 27.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 49999 <at> debbugs.gnu.org (full text, mbox):

From: Peter Münster <pm <at> a16n.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49999 <at> debbugs.gnu.org
Subject: Re: bug#49999: 27.2; save-mark-and-excursion does not save mark-active
Date: Fri, 13 Aug 2021 11:19:20 +0200
[Message part 1 (text/plain, inline)]
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
[0001-Minor-enhancements-for-image-dired.el.patch (text/x-patch, inline)]
From 8e0d6c4e787ecb56ef8eede83ea5c5d8ed0db5e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20M=C3=BCnster?= <pm <at> 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

[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 3 years and 286 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.