unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14548: 24.3.1; [PATCH] image-dired-dired-toggle-marked-thumbs conflicts with other modes using overlays
@ 2013-06-03 13:28 E Sabof
  2013-06-11 19:08 ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: E Sabof @ 2013-06-03 13:28 UTC (permalink / raw)
  To: 14548

[-- 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 --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-06-13 14:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).