From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: thumbs.el and transparency Date: Sun, 29 Jan 2006 18:13:22 -0500 Message-ID: <87irs2iq5p.fsf@stupidchicken.com> References: <17366.53124.274532.548329@kahikatea.snap.net.nz> <87y814vhxj.fsf@jurta.org> <17367.17105.271024.157799@kahikatea.snap.net.nz> <17369.17978.521026.397616@kahikatea.snap.net.nz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1138576466 20288 80.91.229.2 (29 Jan 2006 23:14:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2006 23:14:26 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 30 00:14:23 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F3LkT-0002Xr-LL for ged-emacs-devel@m.gmane.org; Mon, 30 Jan 2006 00:14:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F3LnH-0008JJ-0F for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2006 18:17:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F3Lmi-0007wG-PC for emacs-devel@gnu.org; Sun, 29 Jan 2006 18:16:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F3Lmg-0007tG-TI for emacs-devel@gnu.org; Sun, 29 Jan 2006 18:16:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F3LmT-0007dW-1o for emacs-devel@gnu.org; Sun, 29 Jan 2006 18:16:25 -0500 Original-Received: from [18.95.5.111] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F3Lkf-0001HN-Po for emacs-devel@gnu.org; Sun, 29 Jan 2006 18:14:33 -0500 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 991801E4329; Sun, 29 Jan 2006 18:13:22 -0500 (EST) Original-To: Mathias Dahl In-Reply-To: (Mathias Dahl's message of "Sun, 29 Jan 2006 23:04:42 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:49719 Archived-At: > I see. Another configuration that I set up manually sometimes, is > this: > > > +--------------+ > | D | > +------+-------+ > | TB | DB | > | | | > +------+-------+ > > It has the advantage of not truncating the dired information. For the little job that tumme does, it's unreasonable for it to perform such invasive changes on my window configuration, or to demand all the Emacs screen "real estate". But there's no need to reinvent the wheel for tumme.el -- just use the speedbar! See the attached preliminary patch. Do (setq tumme-use-speedbar t), turn on the speedbar, and open any dired buffer containing images. Apart from saving real estate, you don't need a keybinding to display a thumbnail --- the speedbar timer allows you to display the image at point automatically. One other thing that this patch demonstrates is the usefulness of a `tumme-get-thumbnail-image' function, that just takes the original filename and returns a thumbnail image descriptor. Then third-party libraries won't have to muck around with tumme.el's internal functions like `thumme-thumb-name', `tumme-create-thumb', etc. You probably want to add this function to tumme.el in any case. *** emacs/lisp/tumme.el.~1.3.~ 2006-01-27 19:16:46.000000000 -0500 --- emacs/lisp/tumme.el 2006-01-29 17:50:09.000000000 -0500 *************** *** 821,826 **** --- 821,838 ---- :type 'string :group 'tumme) + (defun tumme-get-thumbnail-image (file) + "Return the image descriptor for a thumbnail of image file FILE." + (unless (string-match (image-file-name-regexp) file) + (error "%s is not a valid image file.")) + (let ((thumb-file (tumme-thumb-name file))) + (unless (and (file-exists-p thumb-file) + (<= (float-time (nth 5 (file-attributes file))) + (float-time (nth 5 (file-attributes thumb-file))))) + (tumme-create-thumb file thumb-file)) + (list 'image :type 'jpeg :file thumb-file + :relief tumme-thumb-relief :margin tumme-thumb-margin))) + (defun tumme-insert-image (file type relief margin) "Insert image FILE of image TYPE, using RELIEF and MARGIN, at point." *** emacs/lisp/dired.el.~1.331.~ 2006-01-20 10:05:38.000000000 -0500 --- emacs/lisp/dired.el 2006-01-29 17:52:26.000000000 -0500 *************** *** 3266,3271 **** --- 3266,3284 ---- '(dired-mode . dired-restore-desktop-buffer)) + (defun dired-speedbar-buttons (dired-buffer) + (when (and (boundp 'tumme-use-speedbar) + tumme-use-speedbar) + (let ((filename (with-current-buffer dired-buffer + (dired-get-filename)))) + (when (and (not (string-equal filename (buffer-string))) + (string-match (image-file-name-regexp) filename)) + (erase-buffer) + (insert (propertize + filename + 'display + (tumme-get-thumbnail-image filename))))))) + (if (eq system-type 'vax-vms) (load "dired-vms"))