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
"~/.emacs-thumbs"
69 "*Directory to store thumbnails."
73 (defcustom thumbs-geometry
"100x100"
74 "*Size of thumbnails."
78 (defcustom thumbs-per-line
5
79 "*Number of thumbnails per line to show in directory."
83 (defcustom thumbs-thumbsdir-max-size
50000000
84 "Max size for thumbnails directory.
85 When it reaches that size (in bytes), a warning is sent."
89 (defcustom thumbs-conversion-program
90 (if (eq system-type
'windows-nt
)
92 (or (executable-find "convert")
93 "/usr/X11R6/bin/convert"))
94 "*Name of conversion program for thumbnails generation.
95 It must be 'convert'."
99 (defcustom thumbs-setroot-command
100 "xloadimage -onroot -fullscreen *"
101 "Command to set the root window."
105 (defcustom thumbs-relief
5
106 "*Size of button-like border around thumbnails."
110 (defcustom thumbs-margin
2
111 "*Size of the margin around thumbnails.
112 This is where you see the cursor."
116 (defcustom thumbs-thumbsdir-auto-clean t
117 "If set, delete older file in the thumbnails directory.
118 Deletion is done at load time when the directory size is bigger
119 than `thumbs-thumbsdir-max-size'."
123 (defcustom thumbs-image-resizing-step
10
124 "Step by which to resize image."
128 (defcustom thumbs-temp-dir temporary-file-directory
129 "Temporary directory to use.
130 Defaults to `temporary-file-directory'. Leaving it to
131 this value can let another user see some of your images."
135 (defcustom thumbs-temp-prefix
"emacsthumbs"
136 "Prefix to add to temp files."
140 ;; Initialize some variable, for later use.
141 (defvar thumbs-current-tmp-filename
143 "Temporary filename of current image.")
144 (defvar thumbs-current-image-filename
146 "Filename of current image.")
147 (defvar thumbs-current-image-size
149 "Size of current image.")
150 (defvar thumbs-image-num
152 "Number of current image.")
153 (defvar thumbs-current-dir
155 "Current directory.")
156 (defvar thumbs-markedL
158 "List of marked files.")
160 (defalias 'thumbs-gensym
161 (if (fboundp 'gensym
)
163 ;; Copied from cl-macs.el
164 (defvar thumbs-gensym-counter
0)
165 (lambda (&optional prefix
)
166 "Generate a new uninterned symbol.
167 The name is made by appending a number to PREFIX, default \"G\"."
168 (let ((pfix (if (stringp prefix
) prefix
"G"))
169 (num (if (integerp prefix
) prefix
170 (prog1 thumbs-gensym-counter
171 (setq thumbs-gensym-counter
172 (1+ thumbs-gensym-counter
))))))
173 (make-symbol (format "%s%d" pfix num
))))))
175 (defun thumbs-temp-file ()
176 "Return a unique temporary filename for an image."
177 (format "%s%s-%s.jpg"
178 (expand-file-name thumbs-temp-dir
)
180 (thumbs-gensym "T")))
182 (defun thumbs-thumbsdir ()
183 "Return the current thumbnails directory (from `thumbs-thumbsdir').
184 Create the thumbnails directory if it does not exist."
185 (let ((thumbs-thumbsdir (expand-file-name thumbs-thumbsdir
)))
186 (unless (file-directory-p thumbs-thumbsdir
)
187 (make-directory thumbs-thumbsdir
)
188 (message "Creating thumbnails directory"))
191 (defun thumbs-cleanup-thumbsdir ()
192 "Clean the thumbnails directory.
193 If the total size of all files in `thumbs-thumbsdir' is bigger than
194 `thumbs-thumbsdir-max-size', files are deleted until the max size is
200 (let ((fattribsL (file-attributes f
)))
201 `(,(nth 4 fattribsL
) ,(nth 7 fattribsL
) ,f
)))
202 (directory-files (thumbs-thumbsdir) t
(image-file-name-regexp)))
203 '(lambda (l1 l2
) (time-less-p (car l1
) (car l2
)))))
204 (dirsize (apply '+ (mapcar (lambda (x) (cadr x
)) filesL
))))
205 (while (> dirsize thumbs-thumbsdir-max-size
)
207 (message "Deleting file %s" (cadr (cdar filesL
))))
208 (delete-file (cadr (cdar filesL
)))
209 (setq dirsize
(- dirsize
(car (cdar filesL
))))
210 (setq filesL
(cdr filesL
)))))
212 ;; Check the thumbsnail directory size and clean it if necessary.
213 (when thumbs-thumbsdir-auto-clean
214 (thumbs-cleanup-thumbsdir))
216 (defun thumbs-call-convert (filein fileout action
217 &optional arg output-format action-prefix
)
218 "Call the convert program.
219 FILEIN is the input file,
220 FILEOUT is the output file,
221 ACTION is the command to send to convert.
222 Optional arguments are:
223 ARG any arguments to the ACTION command,
224 OUTPUT-FORMAT is the file format to output (default is jpeg),
225 ACTION-PREFIX is the symbol to place before the ACTION command
226 (defaults to '-' but can sometimes be '+')."
227 (let ((command (format "%s %s%s %s \"%s\" \"%s:%s\""
228 thumbs-conversion-program
229 (or action-prefix
"-")
233 (or output-format
"jpeg")
235 (shell-command command
)))
237 (defun thumbs-increment-image-size-element (n d
)
238 "Increment number N by D percent."
239 (round (+ n
(/ (* d n
) 100))))
241 (defun thumbs-decrement-image-size-element (n d
)
242 "Decrement number N by D percent."
243 (round (- n
(/ (* d n
) 100))))
245 (defun thumbs-increment-image-size (s)
246 "Increment S (a cons of width x height)."
248 (thumbs-increment-image-size-element (car s
)
249 thumbs-image-resizing-step
)
250 (thumbs-increment-image-size-element (cdr s
)
251 thumbs-image-resizing-step
)))
253 (defun thumbs-decrement-image-size (s)
254 "Decrement S (a cons of width x height)."
256 (thumbs-decrement-image-size-element (car s
)
257 thumbs-image-resizing-step
)
258 (thumbs-decrement-image-size-element (cdr s
)
259 thumbs-image-resizing-step
)))
261 (defun thumbs-resize-image (&optional increment size
)
262 "Resize image in current buffer.
263 If INCREMENT is set, make the image bigger, else smaller.
264 Or, alternatively, a SIZE may be specified."
266 ;; cleaning of old temp file
273 (let ((buffer-read-only nil
)
277 (thumbs-increment-image-size
278 thumbs-current-image-size
)
279 (thumbs-decrement-image-size
280 thumbs-current-image-size
))))
281 (tmp (thumbs-temp-file)))
283 (thumbs-call-convert thumbs-current-image-filename
285 (concat (number-to-string (car x
)) "x"
286 (number-to-string (cdr x
))))
287 (thumbs-insert-image tmp
'jpeg
0)
288 (setq thumbs-current-tmp-filename tmp
)))
290 (defun thumbs-resize-interactive (width height
)
291 "Resize image interactively to specified WIDTH and HEIGHT."
292 (interactive "nWidth: \nnHeight: ")
293 (thumbs-resize-image nil
(cons width height
)))
295 (defun thumbs-resize-image-size-down ()
296 "Resize image (smaller)."
298 (thumbs-resize-image nil
))
300 (defun thumbs-resize-image-size-up ()
301 "Resize image (bigger)."
303 (thumbs-resize-image t
))
305 (defun thumbs-thumbname (img)
306 "Return a thumbnail name for the image IMG."
307 (convert-standard-filename
308 (let ((filename (expand-file-name img
)))
309 (format "%s/%08x-%s.jpg"
312 (subst-char-in-string
316 (split-string filename
"/")))))))
318 (defun thumbs-make-thumb (img)
319 "Create the thumbnail for IMG."
320 (let ((fn (expand-file-name img
))
321 (tn (thumbs-thumbname img
)))
322 (if (or (not (file-exists-p tn
))
323 ;; This is not the right fix, but I don't understand
324 ;; the external program or why it produces a geometry
325 ;; unequal to the one requested -- rms.
326 ;;; (not (equal (thumbs-file-size tn) thumbs-geometry))
328 (thumbs-call-convert fn tn
"sample" thumbs-geometry
))
331 (defun thumbs-image-type (img)
332 "Return image type from filename IMG."
333 (cond ((string-match ".*\\.jpe?g\\'" img
) 'jpeg
)
334 ((string-match ".*\\.xpm\\'" img
) 'xpm
)
335 ((string-match ".*\\.xbm\\'" img
) 'xbm
)
336 ((string-match ".*\\.gif\\'" img
) 'gif
)
337 ((string-match ".*\\.bmp\\'" img
) 'bmp
)
338 ((string-match ".*\\.png\\'" img
) 'png
)
339 ((string-match ".*\\.tiff?\\'" img
) 'tiff
)))
341 (defun thumbs-file-size (img)
342 (let ((i (image-size (find-image `((:type
,(thumbs-image-type img
) :file
,img
))) t
)))
343 (concat (number-to-string (round (car i
)))
345 (number-to-string (round (cdr i
))))))
348 (defun thumbs-find-thumb (img)
349 "Display the thumbnail for IMG."
351 (find-file (thumbs-make-thumb img
)))
353 (defun thumbs-insert-image (img type relief
&optional marked
)
354 "Insert image IMG at point.
355 TYPE and RELIEF will be used in constructing the image; see `image'
356 in the emacs-lisp manual for further documentation.
357 If MARKED is non-nil, the image is marked."
358 (let ((i `(image :type
,type
361 :conversion
,(if marked
'disabled
)
362 :margin
,thumbs-margin
)))
364 (setq thumbs-current-image-size
367 (defun thumbs-insert-thumb (img &optional marked
)
368 "Insert the thumbnail for IMG at point.
369 If MARKED is non-nil, the image is marked."
371 (thumbs-make-thumb img
) 'jpeg thumbs-relief marked
)
372 (put-text-property (1- (point)) (point)
373 'thumb-image-file img
))
375 (defun thumbs-do-thumbs-insertion (L)
376 "Insert all thumbs in list L."
379 (thumbs-insert-thumb img
380 (member img thumbs-markedL
))
381 (when (= 0 (mod (setq i
(1+ i
)) thumbs-per-line
))
383 (unless (bobp) (newline))))
385 (defun thumbs-show-thumbs-list (L &optional buffer-name same-window
)
386 (unless (and (display-images-p)
387 (image-type-available-p 'jpeg
))
388 (error "Required image type is not supported in this Emacs session"))
389 (funcall (if same-window
'switch-to-buffer
'pop-to-buffer
)
390 (or buffer-name
"*THUMB-View*"))
391 (let ((inhibit-read-only t
))
394 (thumbs-do-thumbs-insertion L
)
395 (goto-char (point-min))
396 (setq thumbs-current-dir default-directory
)
397 (make-variable-buffer-local 'thumbs-current-dir
)))
400 (defun thumbs-show-all-from-dir (dir &optional reg same-window
)
401 "Make a preview buffer for all images in DIR.
402 Optional argument REG to select file matching a regexp,
403 and SAME-WINDOW to show thumbs in the same window."
404 (interactive "DDir: ")
405 (thumbs-show-thumbs-list
406 (directory-files dir t
407 (or reg
(image-file-name-regexp)))
408 (concat "*Thumbs: " dir
) same-window
))
411 (defun thumbs-dired-show-marked ()
412 "In dired, make a thumbs buffer with all marked files."
414 (thumbs-show-thumbs-list (dired-get-marked-files) nil t
))
417 (defun thumbs-dired-show-all ()
418 "In dired, make a thumbs buffer with all files in current directory."
420 (thumbs-show-all-from-dir default-directory nil t
))
423 (defalias 'thumbs
'thumbs-show-all-from-dir
)
425 (defun thumbs-find-image (img &optional num otherwin
)
427 (if otherwin
'switch-to-buffer-other-window
'switch-to-buffer
)
428 (concat "*Image: " (file-name-nondirectory img
) " - "
429 (number-to-string (or num
0)) "*"))
430 (thumbs-view-image-mode)
431 (let ((inhibit-read-only t
))
432 (setq thumbs-current-image-filename img
433 thumbs-current-tmp-filename nil
434 thumbs-image-num
(or num
0))
435 (make-variable-buffer-local 'thumbs-current-image-filename
)
436 (make-variable-buffer-local 'thumbs-current-tmp-filename
)
437 (make-variable-buffer-local 'thumbs-current-image-size
)
438 (make-variable-buffer-local 'thumbs-image-num
)
439 (delete-region (point-min)(point-max))
440 (thumbs-insert-image img
(thumbs-image-type img
) 0)))
442 (defun thumbs-find-image-at-point (&optional img otherwin
)
443 "Display image IMG for thumbnail at point.
444 Use another window if OTHERWIN is t."
446 (let* ((i (or img
(thumbs-current-image))))
447 (thumbs-find-image i
(point) otherwin
)))
449 (defun thumbs-find-image-at-point-other-window ()
450 "Display image for thumbnail at point in the preview buffer.
451 Open another window."
453 (thumbs-find-image-at-point nil t
))
455 (defun thumbs-mouse-find-image (event)
456 "Display image for thumbnail at mouse click EVENT."
458 (mouse-set-point event
)
459 (thumbs-find-image-at-point))
461 (defun thumbs-call-setroot-command (img)
462 "Call the setroot program for IMG."
463 (run-hooks 'thumbs-before-setroot-hook
)
464 (shell-command (replace-regexp-in-string
466 (shell-quote-argument (expand-file-name img
))
467 thumbs-setroot-command nil t
))
468 (run-hooks 'thumbs-after-setroot-hook
))
470 (defun thumbs-set-image-at-point-to-root-window ()
471 "Set the image at point as the desktop wallpaper."
473 (thumbs-call-setroot-command
474 (thumbs-current-image)))
476 (defun thumbs-set-root ()
477 "Set the current image as root."
479 (thumbs-call-setroot-command
480 (or thumbs-current-tmp-filename
481 thumbs-current-image-filename
)))
483 (defun thumbs-file-alist ()
484 "Make an alist of elements (POS . FILENAME) for all images in thumb buffer."
487 (goto-char (point-min))
489 (if (thumbs-current-image)
490 (push (cons (point-marker)
491 (thumbs-current-image))
496 (defun thumbs-file-list ()
497 "Make a list of file names for all images in thumb buffer."
500 (goto-char (point-min))
502 (if (thumbs-current-image)
503 (push (thumbs-current-image) list
))
507 (defun thumbs-delete-images ()
508 "Delete the image at point (and its thumbnail) (or marked files if any)."
510 (let ((files (or thumbs-markedL
(list (thumbs-current-image)))))
511 (if (yes-or-no-p (format "Really delete %d files? " (length files
)))
512 (let ((thumbs-fileL (thumbs-file-alist))
513 (inhibit-read-only t
))
519 (delete-file (thumbs-thumbname x
)))
520 (file-error (setq failure t
)))
522 (when (rassoc x thumbs-fileL
)
523 (goto-char (car (rassoc x thumbs-fileL
)))
524 (delete-region (point) (1+ (point))))
526 (delq x thumbs-markedL
)))))))))
528 (defun thumbs-rename-images (newfile)
529 "Rename the image at point (and its thumbnail) (or marked files if any)."
530 (interactive "FRename to file or directory: ")
531 (let ((files (or thumbs-markedL
(list (thumbs-current-image))))
533 (if (and (not (file-directory-p newfile
))
535 (if (file-exists-p newfile
)
536 (error "Renaming marked files to file name `%s'" newfile
)
537 (make-directory newfile t
)))
538 (if (yes-or-no-p (format "Really rename %d files? " (length files
)))
539 (let ((thumbs-fileL (thumbs-file-alist))
540 (inhibit-read-only t
))
544 (if (file-directory-p newfile
)
547 (file-name-nondirectory file
)
549 (rename-file file newfile
))
550 (file-error (setq failure t
)
551 (push file failures
)))
553 (when (rassoc file thumbs-fileL
)
554 (goto-char (car (rassoc file thumbs-fileL
)))
555 (delete-region (point) (1+ (point))))
557 (delq file thumbs-markedL
)))))))
559 (display-warning 'file-error
560 (format "Rename failures for %s into %s"
564 (defun thumbs-kill-buffer ()
565 "Kill the current buffer."
567 (quit-window t
(selected-window)))
569 (defun thumbs-show-image-num (num)
570 "Show the image with number NUM."
571 (let ((image-buffer (get-buffer-create "*Image*")))
572 (let ((i (thumbs-current-image)))
573 (with-current-buffer image-buffer
574 (thumbs-insert-image i
(thumbs-image-type i
) 0))
575 (setq thumbs-image-num num
576 thumbs-current-image-filename i
))))
578 (defun thumbs-next-image ()
579 "Show the next image."
581 (let* ((i (1+ thumbs-image-num
))
582 (list (thumbs-file-alist))
584 (while (and (/= i thumbs-image-num
) (not (assoc i list
)))
585 (setq i
(if (>= i l
) 1 (1+ i
))))
586 (thumbs-show-image-num i
)))
588 (defun thumbs-previous-image ()
589 "Show the previous image."
591 (let* ((i (- thumbs-image-num
1))
592 (list (thumbs-file-alist))
594 (while (and (/= i thumbs-image-num
) (not (assoc i list
)))
595 (setq i
(if (<= i
1) l
(1- i
))))
596 (thumbs-show-image-num i
)))
598 (defun thumbs-redraw-buffer ()
599 "Redraw the current thumbs buffer."
601 (inhibit-read-only t
)
602 (files (thumbs-file-list)))
604 (thumbs-do-thumbs-insertion files
)
607 (defun thumbs-mark ()
608 "Mark the image at point."
610 (let ((elt (thumbs-current-image)))
612 (error "No image here"))
613 (push elt thumbs-markedL
)
614 (let ((inhibit-read-only t
))
616 (thumbs-insert-thumb elt t
)))
617 (when (eolp) (forward-char)))
619 (defun thumbs-unmark ()
620 "Unmark the image at point."
622 (let ((elt (thumbs-current-image)))
624 (error "No image here"))
625 (setq thumbs-markedL
(delete elt thumbs-markedL
))
626 (let ((inhibit-read-only t
))
628 (thumbs-insert-thumb elt nil
)))
629 (when (eolp) (forward-char)))
631 ;; Image modification routines
633 (defun thumbs-modify-image (action &optional arg
)
634 "Call convert to do ACTION on image with argument ARG.
635 ACTION and ARG should be a valid convert command."
636 (interactive "sAction: \nsValue: ")
637 ;; cleaning of old temp file
643 (let ((buffer-read-only nil
)
644 (tmp (thumbs-temp-file)))
646 (thumbs-call-convert thumbs-current-image-filename
650 (thumbs-insert-image tmp
'jpeg
0)
651 (setq thumbs-current-tmp-filename tmp
)))
653 (defun thumbs-emboss-image (emboss)
654 "Emboss the image with value EMBOSS."
655 (interactive "nEmboss value: ")
656 (if (or (< emboss
3) (> emboss
31) (zerop (% emboss
2)))
657 (error "Arg must be an odd number between 3 and 31"))
658 (thumbs-modify-image "emboss" (number-to-string emboss
)))
660 (defun thumbs-monochrome-image ()
661 "Turn the image to monochrome."
663 (thumbs-modify-image "monochrome"))
665 (defun thumbs-negate-image ()
668 (thumbs-modify-image "negate"))
670 (defun thumbs-rotate-left ()
671 "Rotate the image 90 degrees counter-clockwise."
673 (thumbs-modify-image "rotate" "270"))
675 (defun thumbs-rotate-right ()
676 "Rotate the image 90 degrees clockwise."
678 (thumbs-modify-image "rotate" "90"))
680 (defun thumbs-current-image ()
681 "Return the name of the image file name at point."
682 (get-text-property (point) 'thumb-image-file
))
684 (defun thumbs-forward-char ()
685 "Move forward one image."
688 (while (and (not (eobp)) (not (thumbs-current-image)))
692 (defun thumbs-backward-char ()
693 "Move backward one image."
696 (while (and (not (bobp)) (not (thumbs-current-image)))
700 (defun thumbs-forward-line ()
701 "Move down one line."
706 (defun thumbs-backward-line ()
712 (defun thumbs-show-name ()
713 "Show the name of the current file."
715 (let ((f (thumbs-current-image)))
716 (and f
(message "%s [%s]" f
(thumbs-file-size f
)))))
718 (defun thumbs-save-current-image ()
719 "Save the current image."
721 (let ((f (or thumbs-current-tmp-filename
722 thumbs-current-image-filename
))
723 (sa (read-from-minibuffer "Save image file as: "
724 thumbs-current-image-filename
)))
727 (defun thumbs-dired ()
728 "Use `dired' on the current thumbs directory."
730 (dired thumbs-current-dir
))
734 (defvar thumbs-mode-map
735 (let ((map (make-sparse-keymap)))
736 (define-key map
[return] 'thumbs-find-image-at-point)
737 (define-key map [mouse-2] 'thumbs-mouse-find-image)
738 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window)
739 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window)
740 (define-key map [delete] 'thumbs-delete-images)
741 (define-key map [right] 'thumbs-forward-char)
742 (define-key map [left] 'thumbs-backward-char)
743 (define-key map [up] 'thumbs-backward-line)
744 (define-key map [down] 'thumbs-forward-line)
745 (define-key map "d" 'thumbs-dired)
746 (define-key map "m" 'thumbs-mark)
747 (define-key map "u" 'thumbs-unmark)
748 (define-key map "R" 'thumbs-rename-images)
749 (define-key map "x" 'thumbs-delete-images)
750 (define-key map "s" 'thumbs-show-name)
751 (define-key map "q" 'thumbs-kill-buffer)
753 "Keymap for `thumbs-mode'.")
755 (put 'thumbs-mode 'mode-class 'special)
756 (define-derived-mode thumbs-mode
757 fundamental-mode "thumbs"
758 "Preview images in a thumbnails buffer"
759 (setq buffer-read-only t)
760 (set (make-local-variable 'thumbs-markedL) nil))
762 (defvar thumbs-view-image-mode-map
763 (let ((map (make-sparse-keymap)))
764 (define-key map [prior] 'thumbs-previous-image)
765 (define-key map [next] 'thumbs-next-image)
766 (define-key map "-" 'thumbs-resize-image-size-down)
767 (define-key map "+" 'thumbs-resize-image-size-up)
768 (define-key map "<" 'thumbs-rotate-left)
769 (define-key map ">" 'thumbs-rotate-right)
770 (define-key map "e" 'thumbs-emboss-image)
771 (define-key map "r" 'thumbs-resize-interactive)
772 (define-key map "s" 'thumbs-save-current-image)
773 (define-key map "q" 'thumbs-kill-buffer)
774 (define-key map "w" 'thumbs-set-root)
776 "Keymap for `thumbs-view-image-mode'.")
778 ;; thumbs-view-image-mode
779 (put 'thumbs-view-image-mode 'mode-class 'special)
780 (define-derived-mode thumbs-view-image-mode
781 fundamental-mode "image-view-mode"
782 (setq buffer-read-only t))
785 (defun thumbs-dired-setroot ()
786 "In dired, call the setroot program on the image at point."
788 (thumbs-call-setroot-command (dired-get-filename)))
790 ;; Modif to dired mode map
791 (define-key dired-mode-map "\C-ta" 'thumbs-dired-show-all)
792 (define-key dired-mode-map "\C-tm" 'thumbs-dired-show-marked)
793 (define-key dired-mode-map "\C-tw" 'thumbs-dired-setroot)
797 ;; arch-tag: f9ac1ef8-83fc-42c0-8069-1fae43fd2e5c
798 ;;; thumbs.el ends here