From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.devel Subject: Re: thumbs.el and transparency Date: Sun, 29 Jan 2006 17:01:11 +0100 Message-ID: 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 1138556524 25221 80.91.229.2 (29 Jan 2006 17:42:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2006 17:42:04 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 29 18:42:02 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 1F3GYo-0003zs-9r for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2006 18:41:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F3Gbd-0002Xu-RX for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2006 12:44:53 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F3F2W-0004J3-D3 for emacs-devel@gnu.org; Sun, 29 Jan 2006 11:04:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F3F2T-0004Ij-Rd for emacs-devel@gnu.org; Sun, 29 Jan 2006 11:04:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F3F2T-0004IY-8F for emacs-devel@gnu.org; Sun, 29 Jan 2006 11:04:29 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1F3F0c-0003gR-C2 for emacs-devel@gnu.org; Sun, 29 Jan 2006 11:02:34 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1F3EzP-0002pr-GW for emacs-devel@gnu.org; Sun, 29 Jan 2006 17:01:19 +0100 Original-Received: from 1-1-3-38a.gml.gbg.bostream.se ([82.182.110.147]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 29 Jan 2006 17:01:19 +0100 Original-Received: from brakjoller by 1-1-3-38a.gml.gbg.bostream.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 29 Jan 2006 17:01:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 121 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 1-1-3-38a.gml.gbg.bostream.se User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:hRMs+Mhg7gpI9M6mFKNU8oTBdXc= 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:49679 Archived-At: "Richard M. Stallman" 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