[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thumbs.el and transparency
From: |
Mathias Dahl |
Subject: |
Re: thumbs.el and transparency |
Date: |
Sun, 29 Jan 2006 17:01:11 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"Richard M. Stallman" <address@hidden> writes:
> Thumbs operation on the other hand is er, pretty obvious and
> straight-forward, and it seems reasonably useful for what it does...
> At the least, I got a buffer full of thumbnails with the first command
> I tried. I never did figure out how to make tumme do that.
>
> We need to make it tumme simpler to invoke.
Here is an example of such a command. It tries to mirror the way the
`thumbs' command works. I added a new defcustom, a new defun with a
defalias and made a slight change to `tumme-display-thumbs'. Basic
code proudly copied from thumbs.el:
(defcustom tumme-show-all-from-dir-max-files 50
"*Maximum number of files to show using`tumme-show-all-from-dir'.
before warning the user."
:type 'integer
:group 'tumme)
;;;###autoload
(defun tumme-show-all-from-dir (dir)
"Make a preview buffer for all images in DIR and display it.
If the number of files in DIR that matches
`image-file-name-regexp' exceeds
`tumme-show-all-from-dir-max-files', a warning will be
displayed.
Note: you won't get the same integration (movement tracking,
marking, automatic jumping to the correct dired buffer etc) using
this command as if you had used `tumme-display-thumbs' directly
from a dired buffer, but for basic thumbnail and image viewing it
works well."
(interactive "DDir: ")
(let* ((files (directory-files
dir t (image-file-name-regexp))))
(if (or (<= (length files) tumme-show-all-from-dir-max-files)
(and (> (length files) tumme-show-all-from-dir-max-files)
(y-or-n-p
(format "Directory contains more than %d files. Proceed? "
tumme-show-all-from-dir-max-files))))
(progn
(tumme-display-thumbs nil nil files)
(switch-to-buffer tumme-thumbnail-buffer))
(message "Cancelled."))))
;;;###autoload
(defalias 'tumme 'tumme-show-all-from-dir)
(defun tumme-display-thumbs (&optional arg append files)
"Display thumbnails of all marked files, in `tumme-thumbnail-buffer'.
If a thumbnail image does not exist for a file, it is created on
the fly. With prefix argument ARG, display only thumbnail for
file at point (this is useful if you have marked some files but
want to show another one).
Optional argument FILES is a list of file names that will be used
instead of using file names from dired.
With optional argument APPEND, append thumbnail to thumbnail buffer
instead of erasing it first.
Recommended usage is to split the current frame horizontally so
that you have the dired buffer in the left window and the
`tumme-thumbnail-buffer' buffer in the right window."
(interactive "P")
(let ((buf (tumme-create-thumbnail-buffer))
curr-file thumb-name file-list count dired-buf beg)
(if files
(progn
(setq file-list files)
(setq dired-buf nil))
(setq dired-buf (current-buffer))
(if arg
(setq files (list (dired-get-filename)))
(setq files (dired-get-marked-files))))
(save-excursion
(set-buffer buf)
(let ((inhibit-read-only t))
(if (not append)
(erase-buffer)
(goto-char (point-max)))
(mapcar
(lambda (curr-file)
(setq thumb-name (tumme-thumb-name curr-file))
(if (and (not (file-exists-p thumb-name))
(not (= 0 (tumme-create-thumb curr-file thumb-name))))
(message "Thumb could not be created for file %s" curr-file)
(tumme-insert-thumbnail thumb-name curr-file dired-buf)))
file-list))
(cond ((eq 'dynamic tumme-line-up-method)
(tumme-line-up-dynamic))
((eq 'fixed tumme-line-up-method)
(tumme-line-up))
((eq 'interactive tumme-line-up-method)
(tumme-line-up-interactive))
((eq 'none tumme-line-up-method)
nil)
(t
(tumme-line-up-dynamic))))))
Combined with one of the example defuns I posted earlier I think that this
would indeed be quite easy to use for a beginner, or at least match
the easiness (?) of thumbs:
(defun tumme-display-thumbnail-original-image-and-buffer (&optional arg)
"Call `tumme-display-thumbnail-original-image' and display display buffer.
See command `tumme-display-thumbnail-original-image' for
details."
(interactive "P")
(tumme-display-thumbnail-original-image arg)
(display-buffer tumme-display-image-buffer))
Rebind RET:
(define-key tumme-thumbnail-mode-map "\C-m"
'tumme-display-thumbnail-original-image-and-buffer)
It would be great if someone could test the usefullness of this.
/Mathias
- Re: thumbs.el and transparency, (continued)
- Re: thumbs.el and transparency, Mathias Dahl, 2006/01/29
- Re: thumbs.el and transparency, Chong Yidong, 2006/01/29
- 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 <=
- 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
- Re: thumbs.el and transparency, Miles Bader, 2006/01/26
- Re: thumbs.el and transparency, Nick Roberts, 2006/01/26
Re: thumbs.el and transparency, Xavier Maillard, 2006/01/29