all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: Juri Linkov <juri@jurta.org>
Cc: 5270@debbugs.gnu.org
Subject: bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.
Date: Mon, 24 May 2010 21:53:47 +0200	[thread overview]
Message-ID: <878w79vzxw.fsf@tux.homenetwork> (raw)
In-Reply-To: <20091006184604.9A5B2EFE6F@sonic02.math.uni-bielefeld.de>

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


> Each time you hit C-t t, it show or hide thumbs.

> Thierry, could you please send the latest version of your patch here
> to 5270@debbugs.gnu.org?  It seems a good change to install to Emacs.


changeset:   108790:edb0d0e61eb8
tag:         qtip
tag:         patch-r108790
tag:         tip
tag:         qbase
user:        Thierry Volpiatto <thierry.volpiatto@gmail.com>
date:        Mon May 24 21:40:52 2010 +0200
summary:     * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 108790.patch --]
[-- Type: text/x-patch, Size: 2957 bytes --]

# HG changeset patch
# User Thierry Volpiatto <thierry.volpiatto@gmail.com>
# Date 1274730052 -7200
# Node ID edb0d0e61eb8dcd4d0123a86da15019e21f20d27
# Parent  bb924695adbf1ee08fc983ca83ff1ad3fb4c7c67
* lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer.

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -632,26 +632,31 @@
     (call-process shell-file-name nil nil nil shell-command-switch command)))
 
 ;;;###autoload
-(defun image-dired-dired-insert-marked-thumbs ()
-  "Insert thumbnails before file names of marked files in the dired buffer."
-  (interactive)
+(defun image-dired-dired-insert-marked-thumbs (arg)
+  "Insert or hide thumbnails before file names of marked files in the dired buffer.
+With numeric prefix arg, insert or hide thumbnails on ARG next/prec files depending ARG\
+is positive or negative."
+  (interactive "p")
+  (when (eq arg 1) (setq arg nil)) ; No prefix arg.
   (dired-map-over-marks
-   (let* ((image-pos (dired-move-to-filename))
-          (image-file (dired-get-filename))
-          (thumb-file (image-dired-get-thumbnail-image image-file))
+   (let* ((image-pos  (dired-move-to-filename))
+          (image-file (dired-get-filename 'no-dir t))
+          thumb-file
           overlay)
-     ;; If image is not already added, then add it.
-     (unless (delq nil (mapcar (lambda (o) (overlay-get o 'put-image))
-                               ;; Can't use (overlays-at (point)), BUG?
-                               (overlays-in (point) (1+ (point)))))
-       (put-image thumb-file image-pos)
-       (setq
-	overlay
-	(car (delq nil (mapcar (lambda (o) (and (overlay-get o 'put-image) o))
-			       (overlays-in (point) (1+ (point)))))))
-       (overlay-put overlay 'image-file image-file)
-       (overlay-put overlay 'thumb-file thumb-file)))
-   nil)
+     (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-ov (overlays-in (point) (1+ (point)))))
+         (if cur-ov
+             (delete-overlay (car cur-ov))
+             (put-image thumb-file image-pos)
+             (setq overlay (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))
 
 (defun image-dired-dired-after-readin-hook ()

  parent reply	other threads:[~2010-05-24 19:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jwv3a2eiia3.fsf-monnier+emacs@gnu.org>
2009-10-06 18:46 ` bug#4655: 23.1.50; buffer-swap-text oddity Markus Rost
2009-10-07  4:01   ` Juanma Barranquero
2009-10-07  5:41     ` Stefan Monnier
2009-10-07  8:53       ` Markus Rost
2009-10-07 10:07       ` Juanma Barranquero
2009-10-07 14:29         ` Stefan Monnier
2009-10-08 16:48           ` Markus Rost
2011-07-13 14:08           ` Lars Magne Ingebrigtsen
2016-07-11  1:58             ` npostavs
2016-07-11 14:37               ` Eli Zaretskii
2016-07-11 18:50                 ` Markus Rost
2016-07-11 19:07                   ` Dmitry Gutov
2016-07-12  1:58                     ` npostavs
2016-07-12  5:16                       ` Eli Zaretskii
2016-07-13 23:50                         ` npostavs
2016-07-14 15:03                           ` Eli Zaretskii
2016-07-15  0:05                             ` npostavs
2010-01-10  7:36   ` bug#5273: marked as done (23.1; format-alist encode vs write-region-post-annotation-function) Emacs bug Tracking System
2010-01-13  0:45   ` bug#5256: marked as done (conjunct formation should follow input sequence when inserting text) Emacs bug Tracking System
2010-01-13  0:49   ` bug#5265: marked as done (23.1.90; vc - can't reread redirected stdin for log message) Emacs bug Tracking System
2010-01-14  1:22   ` bug#5276: marked as done (23.1; Doc string of bookmark-bmenu-execute-deletions) Emacs bug Tracking System
2010-01-16 20:05   ` bug#5267: 23.1; doc string of defstruct Chong Yidong
2010-01-16 21:39   ` bug#5279: 23.1; VC: should set LC_MESSAGES to C (with patch) Chong Yidong
2010-05-13 19:20   ` bug#5284: 23.1; gnus-summary-expire-thread does not work Glenn Morris
2010-05-24 19:53   ` Thierry Volpiatto [this message]
2010-05-25 15:49     ` bug#5270: [PATCH] * lisp/image-dired.el (image-dired-dired-insert-marked-thumbs) Insert thumbnails before file names of marked files in the dired buffer Juri Linkov
2010-05-25 16:59       ` Thierry Volpiatto
2010-05-25 17:46         ` Juri Linkov
2010-06-30 20:35   ` bug#5281: 23.1; xml-parse-region causes infinite loops if the region is not well-formed XML Chong Yidong
2009-12-29 18:19 bug#5284: 23.1; gnus-summary-expire-thread does not work Tom Tromey
2010-05-11  6:04 ` Andreas Seltenreich
     [not found]   ` <mailman.7.1273778942.8369.bug-gnu-emacs@gnu.org>
2010-06-30 21:35     ` Ted Zlatanov

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

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

  git send-email \
    --in-reply-to=878w79vzxw.fsf@tux.homenetwork \
    --to=thierry.volpiatto@gmail.com \
    --cc=5270@debbugs.gnu.org \
    --cc=juri@jurta.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.