1 ;;; thumbs.el --- Thumbnails previewer for images files
3 ;; Copyright 2004, 2005 Free Software Foundation, Inc
5 ;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca>
6 ;; Keywords: Multimedia
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time
26 ;; The peoples at #emacs@freenode.net for numerous help
27 ;; RMS for emacs and the GNU project.
32 ;; This package create two new mode: thumbs-mode and
33 ;; thumbs-view-image-mode. It is used for images browsing and viewing
34 ;; from within Emacs. Minimal image manipulation functions are also
35 ;; available via external programs.
37 ;; The 'convert' program from 'ImageMagick'
38 ;; [URL:http://www.imagemagick.org/] is required.
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
43 ;; This is version 2.0
47 ;; Type M-x thumbs RET DIR RET to view the directory DIR in Thumbs mode.
48 ;; That should be a directory containing image files.
49 ;; from dired, C-t m enter in thumbs-mode with all marked files
50 ;; C-t a enter in thumbs-mode with all files in current-directory
51 ;; In thumbs-mode, pressing <return> on a image will bring you in image view mode
52 ;; for that image. C-h m will give you a list of available keybinding.
64 "Thumbnails previewer."
68 (defcustom thumbs-thumbsdir
69 (expand-file-name "~/.emacs-thumbs")
70 "*Directory to store thumbnails."
74 (defcustom thumbs-geometry
"100x100"
75 "*Size of thumbnails."
79 (defcustom thumbs-per-line
5
80 "*Number of thumbnails per line to show in directory."
84 (defcustom thumbs-thumbsdir-max-size
50000000
85 "Max size for thumbnails directory.
86 When it reachs that size (in bytes), a warning is sent."
90 (defcustom thumbs-conversion-program
91 (if (equal 'windows-nt system-type
)
93 (or (executable-find "convert")
94 "/usr/X11R6/bin/convert"))
95 "*Name of conversion program for thumbnails generation.
96 It must be 'convert'."
100 (defcustom thumbs-setroot-command
101 "xloadimage -onroot -fullscreen *"
102 "Command to set the root window."
106 (defcustom thumbs-relief
5
107 "*Size of button-like border around thumbnails."
111 (defcustom thumbs-margin
2
112 "*Size of the margin around thumbnails.
113 This is where you see the cursor."
117 (defcustom thumbs-thumbsdir-auto-clean t
118 "If set, delete older file in the thumbnails directory.
119 Deletion is done at load time when the directory size is bigger
120 than 'thumbs-thumbsdir-max-size'."
124 (defcustom thumbs-image-resizing-step
10
125 "Step by wich to resize image."
129 (defcustom thumbs-temp-dir
131 "Temporary directory to use.
132 Leaving it to default '/tmp/' can let another user
133 see some of your images."
137 (defcustom thumbs-temp-prefix
"emacsthumbs"
138 "Prefix to add to temp files."
142 ;; Initialize some variable, for later use.
143 (defvar thumbs-temp-file
144 (concat thumbs-temp-dir thumbs-temp-prefix
)
145 "Temporary filename for images.")
147 (defvar thumbs-current-tmp-filename
149 "Temporary filename of current image.")
150 (defvar thumbs-current-image-filename
152 "Filename of current image.")
153 (defvar thumbs-current-image-size
155 "Size of current image.")
156 (defvar thumbs-image-num
158 "Number of current image.")
159 (defvar thumbs-current-dir
161 "Current directory.")
162 (defvar thumbs-markedL
164 "List of marked files.")
166 ;; Make sure auto-image-file-mode is ON.
167 (auto-image-file-mode t
)
169 ;; Create the thumbs directory if it does not exists.
170 (setq thumbs-thumbsdir
(expand-file-name thumbs-thumbsdir
))
172 (when (not (file-directory-p thumbs-thumbsdir
))
174 (make-directory thumbs-thumbsdir
)
175 (message "Creating thumbnails directory")))
177 (defvar thumbs-gensym-counter
0)
179 (defun thumbs-gensym (&optional arg
)
180 "Generate a new uninterned symbol.
181 The name is made by appending a number to PREFIX, default \"Thumbs\"."
182 (let ((prefix (if (stringp arg
) arg
"Thumbs"))
183 (num (if (integerp arg
) arg
185 thumbs-gensym-counter
186 (setq thumbs-gensym-counter
(1+ thumbs-gensym-counter
))))))
187 (make-symbol (format "%s%d" prefix num
))))
189 (defun thumbs-cleanup-thumbsdir ()
190 "Clean the thumbnails directory.
191 If the total size of all files in `thumbs-thumbsdir' is bigger than
192 `thumbs-thumbsdir-max-size', files are deleted until the max size is
198 (let ((fattribsL (file-attributes f
)))
199 `(,(nth 4 fattribsL
) ,(nth 7 fattribsL
) ,f
)))
200 (directory-files thumbs-thumbsdir t
(image-file-name-regexp)))
201 '(lambda (l1 l2
) (time-less-p (car l1
)(car l2
)))))
202 (dirsize (apply '+ (mapcar (lambda (x) (cadr x
)) filesL
))))
203 (while (> dirsize thumbs-thumbsdir-max-size
)
205 (message "Deleting file %s" (cadr (cdar filesL
))))
206 (delete-file (cadr (cdar filesL
)))
207 (setq dirsize
(- dirsize
(car (cdar filesL
))))
208 (setq filesL
(cdr filesL
)))))
210 ;; Check the thumbsnail directory size and clean it if necessary.
211 (when thumbs-thumbsdir-auto-clean
212 (thumbs-cleanup-thumbsdir))
214 (defun thumbs-call-convert (filein fileout action
215 &optional arg output-format action-prefix
)
216 "Call the convert program.
217 FILEIN is the input file,
218 FILEOUT is the output file,
219 ACTION is the command to send to convert.
220 Optional arguments are:
221 ARG any arguments to the ACTION command,
222 OUTPUT-FORMAT is the file format to output (default is jpeg),
223 ACTION-PREFIX is the symbol to place before the ACTION command
224 (defaults to '-' but can sometimes be '+')."
225 (let ((command (format "%s %s%s %s \"%s\" \"%s:%s\""
226 thumbs-conversion-program
227 (or action-prefix
"-")
231 (or output-format
"jpeg")
233 (shell-command command
)))
235 (defun thumbs-increment-image-size-element (n d
)
236 "Increment number N by D percent."
237 (round (+ n
(/ (* d n
) 100))))
239 (defun thumbs-decrement-image-size-element (n d
)
240 "Decrement number N by D percent."
241 (round (- n
(/ (* d n
) 100))))
243 (defun thumbs-increment-image-size (s)
244 "Increment S (a cons of width x height)."
246 (thumbs-increment-image-size-element (car s
)
247 thumbs-image-resizing-step
)
248 (thumbs-increment-image-size-element (cdr s
)
249 thumbs-image-resizing-step
)))
251 (defun thumbs-decrement-image-size (s)
252 "Decrement S (a cons of width x height)."
254 (thumbs-decrement-image-size-element (car s
)
255 thumbs-image-resizing-step
)
256 (thumbs-decrement-image-size-element (cdr s
)
257 thumbs-image-resizing-step
)))
259 (defun thumbs-resize-image (&optional increment size
)
260 "Resize image in current buffer.
261 if INCREMENT is set, make the image bigger, else smaller.
262 Or, alternatively, a SIZE may be specified."
264 ;; cleaning of old temp file
271 (let ((buffer-read-only nil
)
275 (thumbs-increment-image-size
276 thumbs-current-image-size
)
277 (thumbs-decrement-image-size
278 thumbs-current-image-size
))))
279 (tmp (format "%s%s.jpg" thumbs-temp-file
(thumbs-gensym))))
281 (thumbs-call-convert thumbs-current-image-filename
283 (concat (number-to-string (car x
)) "x"
284 (number-to-string (cdr x
))))
285 (thumbs-insert-image tmp
'jpeg
0)
286 (setq thumbs-current-tmp-filename tmp
)))
288 (defun thumbs-resize-interactive (width height
)
289 "Resize Image interactively to specified WIDTH and HEIGHT."
290 (interactive "nWidth: \nnHeight: ")
291 (thumbs-resize-image nil
(cons width height
)))
293 (defun thumbs-resize-image-size-down ()
294 "Resize image (smaller)."
296 (thumbs-resize-image nil
))
298 (defun thumbs-resize-image-size-up ()
299 "Resize image (bigger)."
301 (thumbs-resize-image t
))
303 (defun thumbs-thumbname (img)
304 "Return a thumbnail name for the image IMG."
305 (convert-standard-filename
306 (let ((filename (expand-file-name img
)))
307 (format "%s/%08x-%s.jpg"
310 (subst-char-in-string
314 (split-string filename
"/")))))))
316 (defun thumbs-make-thumb (img)
317 "Create the thumbnail for IMG."
318 (let ((fn (expand-file-name img
))
319 (tn (thumbs-thumbname img
)))
320 (if (or (not (file-exists-p tn
))
321 ;; This is not the right fix, but I don't understand
322 ;; the external program or why it produces a geometry
323 ;; unequal to the one requested -- rms.
324 ;;; (not (equal (thumbs-file-size tn) thumbs-geometry))
326 (thumbs-call-convert fn tn
"sample" thumbs-geometry
))
329 (defun thumbs-image-type (img)
330 "Return image type from filename IMG."
331 (cond ((string-match ".*\\.jpe?g\\'" img
) 'jpeg
)
332 ((string-match ".*\\.xpm\\'" img
) 'xpm
)
333 ((string-match ".*\\.xbm\\'" img
) 'xbm
)
334 ((string-match ".*\\.gif\\'" img
) 'gif
)
335 ((string-match ".*\\.bmp\\'" img
) 'bmp
)
336 ((string-match ".*\\.png\\'" img
) 'png
)
337 ((string-match ".*\\.tiff?\\'" img
) 'tiff
)))
339 (defun thumbs-file-size (img)
340 (let ((i (image-size (find-image `((:type
,(thumbs-image-type img
) :file
,img
))) t
)))
341 (concat (number-to-string (round (car i
)))
343 (number-to-string (round (cdr i
))))))
346 (defun thumbs-find-thumb (img)
347 "Display the thumbnail for IMG."
349 (find-file (thumbs-make-thumb img
)))
351 (defun thumbs-insert-image (img type relief
&optional marked
)
352 "Insert image IMG at point.
353 TYPE and RELIEF will be used in constructing the image; see `image'
354 in the emacs-lisp manual for further documentation.
355 If MARKED is non-nil, the image is marked."
356 (let ((i `(image :type
,type
359 :conversion
,(if marked
'disabled
)
360 :margin
,thumbs-margin
)))
362 (setq thumbs-current-image-size
365 (defun thumbs-insert-thumb (img &optional marked
)
366 "Insert the thumbnail for IMG at point.
367 If MARKED is non-nil, the image is marked."
369 (thumbs-make-thumb img
) 'jpeg thumbs-relief marked
)
370 (put-text-property (1- (point)) (point)
371 'thumb-image-file img
))
373 (defun thumbs-do-thumbs-insertion (L)
374 "Insert all thumbs in list L."
377 (thumbs-insert-thumb img
378 (member img thumbs-markedL
))
379 (when (= 0 (mod (setq i
(1+ i
)) thumbs-per-line
))
381 (unless (bobp) (newline))))
383 (defun thumbs-show-thumbs-list (L &optional buffer-name same-window
)
384 (unless (and (display-images-p)
385 (image-type-available-p 'jpeg
))
386 (error "Required image type is not supported in this Emacs session"))
387 (funcall (if same-window
'switch-to-buffer
'pop-to-buffer
)
388 (or buffer-name
"*THUMB-View*"))
389 (let ((inhibit-read-only t
))
392 (thumbs-do-thumbs-insertion L
)
393 (goto-char (point-min))
394 (setq thumbs-current-dir default-directory
)
395 (make-variable-buffer-local 'thumbs-current-dir
)))
398 (defun thumbs-show-all-from-dir (dir &optional reg same-window
)
399 "Make a preview buffer for all images in DIR.
400 Optional argument REG to select file matching a regexp,
401 and SAME-WINDOW to show thumbs in the same window."
402 (interactive "DDir: ")
403 (thumbs-show-thumbs-list
404 (directory-files dir t
405 (or reg
(image-file-name-regexp)))
406 (concat "*Thumbs: " dir
) same-window
))
409 (defun thumbs-dired-show-marked ()
410 "In dired, make a thumbs buffer with all marked files."
412 (thumbs-show-thumbs-list (dired-get-marked-files) nil t
))
415 (defun thumbs-dired-show-all ()
416 "In dired, make a thumbs buffer with all files in current directory."
418 (thumbs-show-all-from-dir default-directory nil t
))
421 (defalias 'thumbs
'thumbs-show-all-from-dir
)
423 (defun thumbs-find-image (img &optional num otherwin
)
425 (if otherwin
'switch-to-buffer-other-window
'switch-to-buffer
)
426 (concat "*Image: " (file-name-nondirectory img
) " - "
427 (number-to-string (or num
0)) "*"))
428 (thumbs-view-image-mode)
429 (let ((inhibit-read-only t
))
430 (setq thumbs-current-image-filename img
431 thumbs-current-tmp-filename nil
432 thumbs-image-num
(or num
0))
433 (make-variable-buffer-local 'thumbs-current-image-filename
)
434 (make-variable-buffer-local 'thumbs-current-tmp-filename
)
435 (make-variable-buffer-local 'thumbs-current-image-size
)
436 (make-variable-buffer-local 'thumbs-image-num
)
437 (delete-region (point-min)(point-max))
438 (thumbs-insert-image img
(thumbs-image-type img
) 0)))
440 (defun thumbs-find-image-at-point (&optional img otherwin
)
441 "Display image IMG for thumbnail at point.
442 Use another window if OTHERWIN is t."
444 (let* ((i (or img
(thumbs-current-image))))
445 (thumbs-find-image i
(point) otherwin
)))
447 (defun thumbs-find-image-at-point-other-window ()
448 "Display image for thumbnail at point in the preview buffer.
449 Open another window."
451 (thumbs-find-image-at-point nil t
))
453 (defun thumbs-mouse-find-image (event)
454 "Display image for thumbnail at mouse click EVENT."
456 (mouse-set-point event
)
457 (thumbs-find-image-at-point))
459 (defun thumbs-call-setroot-command (img)
460 "Call the setroot program for IMG."
461 (run-hooks 'thumbs-before-setroot-hook
)
462 (shell-command (replace-regexp-in-string
464 (shell-quote-argument (expand-file-name img
))
465 thumbs-setroot-command nil t
))
466 (run-hooks 'thumbs-after-setroot-hook
))
468 (defun thumbs-set-image-at-point-to-root-window ()
469 "Set the image at point as the desktop wallpaper."
471 (thumbs-call-setroot-command
472 (thumbs-current-image)))
474 (defun thumbs-set-root ()
475 "Set the current image as root."
477 (thumbs-call-setroot-command
478 (or thumbs-current-tmp-filename
479 thumbs-current-image-filename
)))
481 (defun thumbs-file-alist ()
482 "Make an alist of elements (POS . FILENAME) for all images in thumb buffer."
485 (goto-char (point-min))
487 (if (thumbs-current-image)
488 (push (cons (point-marker)
489 (thumbs-current-image))
494 (defun thumbs-file-list ()
495 "Make a list of file names for all images in thumb buffer."
498 (goto-char (point-min))
500 (if (thumbs-current-image)
501 (push (thumbs-current-image) list
))
505 (defun thumbs-delete-images ()
506 "Delete the image at point (and its thumbnail) (or marked files if any)."
508 (let ((files (or thumbs-markedL
(list (thumbs-current-image)))))
509 (if (yes-or-no-p (format "Really delete %d files? " (length files
)))
510 (let ((thumbs-fileL (thumbs-file-alist))
511 (inhibit-read-only t
))
517 (delete-file (thumbs-thumbname x
)))
518 (file-error (setq failure t
)))
520 (when (rassoc x thumbs-fileL
)
521 (goto-char (car (rassoc x thumbs-fileL
)))
522 (delete-region (point) (1+ (point))))
524 (delq x thumbs-markedL
)))))))))
526 (defun thumbs-rename-images (newfile)
527 "Rename the image at point (and its thumbnail) (or marked files if any)."
528 (interactive "FRename to file or directory: ")
529 (let ((files (or thumbs-markedL
(list (thumbs-current-image))))
531 (if (and (not (file-directory-p newfile
))
533 (if (file-exists-p newfile
)
534 (error "Renaming marked files to file name `%s'" newfile
)
535 (make-directory newfile t
)))
536 (if (yes-or-no-p (format "Really rename %d files? " (length files
)))
537 (let ((thumbs-fileL (thumbs-file-alist))
538 (inhibit-read-only t
))
542 (if (file-directory-p newfile
)
545 (file-name-nondirectory file
)
547 (rename-file file newfile
))
548 (file-error (setq failure t
)
549 (push file failures
)))
551 (when (rassoc file thumbs-fileL
)
552 (goto-char (car (rassoc file thumbs-fileL
)))
553 (delete-region (point) (1+ (point))))
555 (delq file thumbs-markedL
)))))))
557 (display-warning 'file-error
558 (format "Rename failures for %s into %s"
562 (defun thumbs-kill-buffer ()
563 "Kill the current buffer."
565 (let ((buffer (current-buffer)))
567 (delete-window (selected-window))
569 (kill-buffer buffer
)))
571 (defun thumbs-show-image-num (num)
572 "Show the image with number NUM."
573 (let ((image-buffer (get-buffer-create "*Image*")))
574 (let ((i (thumbs-current-image)))
575 (with-current-buffer image-buffer
576 (thumbs-insert-image i
(thumbs-image-type i
) 0))
577 (setq thumbs-image-num num
578 thumbs-current-image-filename i
))))
580 (defun thumbs-next-image ()
581 "Show the next image."
583 (let* ((i (1+ thumbs-image-num
))
584 (list (thumbs-file-alist))
586 (while (and (/= i thumbs-image-num
) (not (assoc i list
)))
587 (setq i
(if (>= i l
) 1 (1+ i
))))
588 (thumbs-show-image-num i
)))
590 (defun thumbs-previous-image ()
591 "Show the previous image."
593 (let* ((i (- thumbs-image-num
1))
594 (list (thumbs-file-alist))
596 (while (and (/= i thumbs-image-num
) (not (assoc i list
)))
597 (setq i
(if (<= i
1) l
(1- i
))))
598 (thumbs-show-image-num i
)))
600 (defun thumbs-redraw-buffer ()
601 "Redraw the current thumbs buffer."
603 (inhibit-read-only t
)
604 (files (thumbs-file-list)))
606 (thumbs-do-thumbs-insertion files
)
609 (defun thumbs-mark ()
610 "Mark the image at point."
612 (let ((elt (thumbs-current-image)))
614 (error "No image here"))
615 (push elt thumbs-markedL
)
616 (let ((inhibit-read-only t
))
618 (thumbs-insert-thumb elt t
)))
619 (when (eolp) (forward-char)))
621 (defun thumbs-unmark ()
622 "Unmark the image at point."
624 (let ((elt (thumbs-current-image)))
626 (error "No image here"))
627 (setq thumbs-markedL
(delete elt thumbs-markedL
))
628 (let ((inhibit-read-only t
))
630 (thumbs-insert-thumb elt nil
)))
631 (when (eolp) (forward-char)))
633 ;; Image modification routines
635 (defun thumbs-modify-image (action &optional arg
)
636 "Call convert to do ACTION on image with argument ARG.
637 ACTION and ARG should be a valid convert command."
638 (interactive "sAction: \nsValue: ")
639 ;; cleaning of old temp file
645 (let ((buffer-read-only nil
)
646 (tmp (format "%s%s.jpg" thumbs-temp-file
(thumbs-gensym))))
648 (thumbs-call-convert thumbs-current-image-filename
652 (thumbs-insert-image tmp
'jpeg
0)
653 (setq thumbs-current-tmp-filename tmp
)))
655 (defun thumbs-emboss-image (emboss)
656 "Emboss the image with value EMBOSS."
657 (interactive "nEmboss value: ")
658 (if (or (< emboss
3) (> emboss
31) (zerop (% emboss
2)))
659 (error "Arg must be an odd number between 3 and 31"))
660 (thumbs-modify-image "emboss" (number-to-string emboss
)))
662 (defun thumbs-monochrome-image ()
663 "Turn the image to monochrome."
665 (thumbs-modify-image "monochrome"))
667 (defun thumbs-negate-image ()
670 (thumbs-modify-image "negate"))
672 (defun thumbs-rotate-left ()
673 "Rotate the image 90 degrees counter-clockwise."
675 (thumbs-modify-image "rotate" "270"))
677 (defun thumbs-rotate-right ()
678 "Rotate the image 90 degrees clockwise."
680 (thumbs-modify-image "rotate" "90"))
682 (defun thumbs-current-image ()
683 "Return the name of the image file name at point."
684 (get-text-property (point) 'thumb-image-file
))
686 (defun thumbs-forward-char ()
687 "Move forward one image."
690 (while (and (not (eobp)) (not (thumbs-current-image)))
694 (defun thumbs-backward-char ()
695 "Move backward one image."
698 (while (and (not (bobp)) (not (thumbs-current-image)))
702 (defun thumbs-forward-line ()
703 "Move down one line."
708 (defun thumbs-backward-line ()
714 (defun thumbs-show-name ()
715 "Show the name of the current file."
717 (let ((f (thumbs-current-image)))
718 (and f
(message "%s [%s]" f
(thumbs-file-size f
)))))
720 (defun thumbs-save-current-image ()
721 "Save the current image."
723 (let ((f (or thumbs-current-tmp-filename
724 thumbs-current-image-filename
))
725 (sa (read-from-minibuffer "Save image file as: "
726 thumbs-current-image-filename
)))
729 (defun thumbs-dired ()
730 "Use `dired' on the current thumbs directory."
732 (dired thumbs-current-dir
))
736 (defvar thumbs-mode-map
737 (let ((map (make-sparse-keymap)))
738 (define-key map
[return] 'thumbs-find-image-at-point)
739 (define-key map [mouse-2] 'thumbs-mouse-find-image)
740 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window)
741 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window)
742 (define-key map [delete] 'thumbs-delete-images)
743 (define-key map [right] 'thumbs-forward-char)
744 (define-key map [left] 'thumbs-backward-char)
745 (define-key map [up] 'thumbs-backward-line)
746 (define-key map [down] 'thumbs-forward-line)
747 (define-key map "d" 'thumbs-dired)
748 (define-key map "m" 'thumbs-mark)
749 (define-key map "u" 'thumbs-unmark)
750 (define-key map "R" 'thumbs-rename-images)
751 (define-key map "x" 'thumbs-delete-images)
752 (define-key map "s" 'thumbs-show-name)
753 (define-key map "q" 'thumbs-kill-buffer)
755 "Keymap for `thumbs-mode'.")
757 (put 'thumbs-mode 'mode-class 'special)
758 (define-derived-mode thumbs-mode
759 fundamental-mode "thumbs"
760 "Preview images in a thumbnails buffer"
761 (make-variable-buffer-local 'thumbs-markedL)
762 (setq buffer-read-only t)
763 (setq thumbs-markedL nil))
765 (defvar thumbs-view-image-mode-map
766 (let ((map (make-sparse-keymap)))
767 (define-key map [prior] 'thumbs-previous-image)
768 (define-key map [next] 'thumbs-next-image)
769 (define-key map "-" 'thumbs-resize-image-size-down)
770 (define-key map "+" 'thumbs-resize-image-size-up)
771 (define-key map "<" 'thumbs-rotate-left)
772 (define-key map ">" 'thumbs-rotate-right)
773 (define-key map "e" 'thumbs-emboss-image)
774 (define-key map "r" 'thumbs-resize-interactive)
775 (define-key map "s" 'thumbs-save-current-image)
776 (define-key map "q" 'thumbs-kill-buffer)
777 (define-key map "w" 'thumbs-set-root)
779 "Keymap for `thumbs-view-image-mode'.")
781 ;; thumbs-view-image-mode
782 (put 'thumbs-view-image-mode 'mode-class 'special)
783 (define-derived-mode thumbs-view-image-mode
784 fundamental-mode "image-view-mode"
785 (setq buffer-read-only t))
788 (defun thumbs-dired-setroot ()
789 "In dired, call the setroot program on the image at point."
791 (thumbs-call-setroot-command (dired-get-filename)))
793 ;; Modif to dired mode map
794 (define-key dired-mode-map "\C-ta" 'thumbs-dired-show-all)
795 (define-key dired-mode-map "\C-tm" 'thumbs-dired-show-marked)
796 (define-key dired-mode-map "\C-tw" 'thumbs-dired-setroot)
800 ;;; thumbs.el ends here
803 ;;; arch-tag: f9ac1ef8-83fc-42c0-8069-1fae43fd2e5c