[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thumbs.el and transparency
From: |
Chong Yidong |
Subject: |
Re: thumbs.el and transparency |
Date: |
Sun, 29 Jan 2006 18:13:22 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> 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"))
- Re: thumbs.el and transparency, (continued)
- Re: thumbs.el and transparency, Robert J. Chassell, 2006/01/29
- Re: thumbs.el and transparency, Chong Yidong, 2006/01/29
- Re: thumbs.el and transparency, Nick Roberts, 2006/01/29
- Re: thumbs.el and transparency, Robert J. Chassell, 2006/01/29
- Re: thumbs.el and transparency, Nick Roberts, 2006/01/29
- Re: thumbs.el and transparency, Robert J. Chassell, 2006/01/30
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/29
- Re: thumbs.el and transparency,
Chong Yidong <=
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/30
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/30
- Re: thumbs.el and transparency, Robert J. Chassell, 2006/01/29
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/30
- Re: thumbs.el and transparency, Richard M. Stallman, 2006/01/28
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/29
- Re: thumbs.el and transparency, Richard M. Stallman, 2006/01/30
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/30
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/30
- Re: thumbs.el and transparency, Richard M. Stallman, 2006/01/31