unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: E Sabof <esabof@gmail.com>
To: 14548@debbugs.gnu.org
Subject: bug#14548: 24.3.1; [PATCH] image-dired-dired-toggle-marked-thumbs conflicts with other modes using overlays
Date: Mon, 3 Jun 2013 14:28:28 +0100	[thread overview]
Message-ID: <CAEp6DyYwVpruJf9d9AW2tQEDzVXs3CAn652CwyViJnL9DRPybg@mail.gmail.com> (raw)

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

One such mode is stripe-buffer, which can be fonud here:

https://github.com/sabof/stripe-buffer

the definition below fixes the problem.

Evgeni

(ad-unadvise 'image-dired-dired-toggle-marked-thumbs) ; stripe-buffer
monkey-patches the function.

 (defun image-dired-dired-toggle-marked-thumbs (&optional arg)
    "Toggle thumbnails in front of file names in the dired buffer.
If no marked file could be found, insert or hide thumbnails on the
current line.  ARG, if non-nil, specifies the files to use instead
of the marked files.  If ARG is an integer, use the next ARG (or
previous -ARG, if ARG<0) files."
    (interactive "P")
    (dired-map-over-marks
     (let* ((image-pos  (dired-move-to-filename))
            (image-file (dired-get-filename nil t))
            thumb-file
            overlay)
       (when (and image-file
                  (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-ovs (overlays-in (point) (1+ (point))))
                ( thumb-ov (car (cl-remove-if-not
                                 (lambda (ov) (overlay-get ov 'thumb-file))
                                 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
              'image-dired-dired-after-readin-hook nil t))

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

             reply	other threads:[~2013-06-03 13:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 13:28 E Sabof [this message]
2013-06-11 19:08 ` bug#14548: 24.3.1; [PATCH] image-dired-dired-toggle-marked-thumbs conflicts with other modes using overlays 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
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=CAEp6DyYwVpruJf9d9AW2tQEDzVXs3CAn652CwyViJnL9DRPybg@mail.gmail.com \
    --to=esabof@gmail.com \
    --cc=14548@debbugs.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).