From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs 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 Organization: ThierryVolpiatto Message-ID: <878w79vzxw.fsf@tux.homenetwork> References: <20091006184604.9A5B2EFE6F@sonic02.math.uni-bielefeld.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1274735406 8100 80.91.229.12 (24 May 2010 21:10:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 24 May 2010 21:10:06 +0000 (UTC) Cc: 5270@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 24 23:10:04 2010 connect(): No such file or directory Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OGeuQ-0002K9-30 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 May 2010 23:10:02 +0200 Original-Received: from localhost ([127.0.0.1]:40129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGeuP-00030I-9r for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 May 2010 17:10:01 -0400 Original-Received: from [140.186.70.92] (port=50653 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGeFH-0001Mq-Et for bug-gnu-emacs@gnu.org; Mon, 24 May 2010 16:27:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGeF0-000253-TM for bug-gnu-emacs@gnu.org; Mon, 24 May 2010 16:27:30 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57643) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGeF0-00024w-R1 for bug-gnu-emacs@gnu.org; Mon, 24 May 2010 16:27:14 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OGdmj-0004J4-Ta; Mon, 24 May 2010 15:58:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <20091006184604.9A5B2EFE6F@sonic02.math.uni-bielefeld.de> Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 May 2010 19:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5270 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 5270-submit@debbugs.gnu.org id=B5270.127473103716536 (code B ref 5270); Mon, 24 May 2010 19:58:01 +0000 Original-Received: (at 5270) by debbugs.gnu.org; 24 May 2010 19:57:17 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGdm1-0004If-Ir for submit@debbugs.gnu.org; Mon, 24 May 2010 15:57:17 -0400 Original-Received: from mail-ww0-f44.google.com ([74.125.82.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGdly-0004IS-AJ for 5270@debbugs.gnu.org; Mon, 24 May 2010 15:57:15 -0400 Original-Received: by wwb39 with SMTP id 39so15077wwb.17 for <5270@debbugs.gnu.org>; Mon, 24 May 2010 12:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject :organization:date:message-id:user-agent:mime-version:content-type; bh=iSAKxDEHYePsdRRnB0B5E478FJkP0R6/RvVyJ6c+Upo=; b=nttz7/kE7sF32JSdVkUnEYms7s/LTIIwkyZWw/WA+b2lCnsOKGI5PhcIz+08+QRunK aaxeO4QUXvx7XSdDJ584nSgA/CEnCBg2XmujVGkaPedFJJPUFft/unGYyT+M45AwlykZ mOGhAcTcjxrSF4qL9wvvc8gA/iuvfY2XFj3Uw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:date:message-id:user-agent :mime-version:content-type; b=LdjapFWkAOyqQI36KsKu42LxyxHWzQgM1WBVNzlXsfad8GfOKUKqlUKMP3GU9gprvc k81DHNgIC/ZDkp7htQKF16AiSf9nX7y4TomYZ1I2Nj7PMDvSqzArKzt8h9oNqq78V6o+ OE9rF/KaH8+nLiRn3V28iv9WyXN8xPKCG2QKc= Original-Received: by 10.227.137.134 with SMTP id w6mr5999689wbt.100.1274731029532; Mon, 24 May 2010 12:57:09 -0700 (PDT) Original-Received: from tux.homenetwork (170.77.197-77.rev.gaoland.net [77.197.77.170]) by mx.google.com with ESMTPS id t20sm33727803wbc.16.2010.05.24.12.57.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 24 May 2010 12:57:08 -0700 (PDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 24 May 2010 15:58:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:37239 Archived-At: --=-=-= > 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 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=108790.patch # HG changeset patch # User Thierry Volpiatto # 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 () --=-=-=--