unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: E Sabof <esabof@gmail.com>
To: Glenn Morris <rgm@gnu.org>
Cc: 14548@debbugs.gnu.org
Subject: bug#14548: 24.3.1; [PATCH] image-dired-dired-toggle-marked-thumbs conflicts with other modes using overlays
Date: Wed, 12 Jun 2013 13:01:09 +0100	[thread overview]
Message-ID: <CAEp6DyasJDKqOiJvrWdHKsk2mcmp4zndtqB-P=7Eedy4O7xfhw@mail.gmail.com> (raw)
In-Reply-To: <CAEp6DyYibC7U7V77s4qJFO97aT5mF8ETT5Q2eAfv-LQdirJb7w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

Bellow is the patch for the trunk version, without cl-remove-if-not

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index bbb41d4..2e169ed 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -657,16 +657,24 @@ previous -ARG, if ARG<0) files."
                 (string-match-p (image-file-name-regexp) image-file))
        (setq thumb-file (image-dired-get-thumbnail-image image-file))
        ;; If image is not already added, then add it.
-       (let ((cur-ov (overlays-in (point) (1+ (point)))))
-         (if cur-ov
-             (delete-overlay (car cur-ov))
-   (put-image thumb-file image-pos)
-   (setq overlay
-                 (cl-loop for o in (overlays-in (point) (1+ (point)))
-                          when (overlay-get o 'put-image) collect o into ov
-                          finally return (car ov)))
-   (overlay-put overlay 'image-file image-file)
-   (overlay-put overlay 'thumb-file thumb-file)))))
+       (let (( cur-ovs (overlays-in (point) (1+ (point))))
+             thumb-ov)
+         (while (and cur-ovs
+                     (if (overlay-get (car cur-ovs) 'thumb-file)
+                         (progn
+                           (setq thumb-ov (car cur-ovs))
+                           nil)
+                         (pop cur-ovs))))
+         (if thumb-ov
+             (delete-overlay thumb-ov)
+             (progn
+               (put-image thumb-file image-pos)
+               (setq overlay
+                     (cl-loop for o in (overlays-in (point) (1+ (point)))
+                              when (overlay-get o 'put-image) collect o
into ov
+                              finally return (car ov)))
+               (overlay-put overlay 'image-file image-file)
+               (overlay-put overlay 'thumb-file thumb-file))))))
    arg             ; Show or hide image on ARG next files.
    'show-progress) ; Update dired display after each image is updated.
   (add-hook 'dired-after-readin-hook

[-- Attachment #2: Type: text/html, Size: 2664 bytes --]

  reply	other threads:[~2013-06-12 12:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 13:28 bug#14548: 24.3.1; [PATCH] image-dired-dired-toggle-marked-thumbs conflicts with other modes using overlays E Sabof
2013-06-11 19:08 ` Glenn Morris
2013-06-11 21:56   ` Stefan Monnier
2013-06-11 22:12     ` Glenn Morris
2013-06-11 23:00       ` E Sabof
2013-06-12 12:01         ` E Sabof [this message]
2013-06-12 19:25           ` Stefan Monnier
2013-06-13  5:11   ` Glenn Morris
2013-06-13 14:18     ` Stefan Monnier
2013-06-13 14:39       ` E Sabof

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='CAEp6DyasJDKqOiJvrWdHKsk2mcmp4zndtqB-P=7Eedy4O7xfhw@mail.gmail.com' \
    --to=esabof@gmail.com \
    --cc=14548@debbugs.gnu.org \
    --cc=rgm@gnu.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).