1 ;;; thumbs.el --- Thumbnails previewer for images files
3 ;; Copyright 2004 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."
67 (defcustom thumbs-thumbsdir
68 (expand-file-name "~/.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 reach that size (in bytes), a warning is send."
89 (defcustom thumbs-conversion-program
90 (if (equal 'windows-nt system-type
)
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 wich to resize image."
128 (defcustom thumbs-temp-dir
130 "Temporary directory to use.
131 Leaving it to default '/tmp/' can let another user
132 see some of your images."
136 (defcustom thumbs-temp-prefix
"emacsthumbs"
137 "Prefix to add to temp files."
141 ;; Initialize some variable, for later use.
142 (defvar thumbs-temp-file
143 (concat thumbs-temp-dir thumbs-temp-prefix
)
144 "Temporary filesname for images.")
146 (defvar thumbs-current-tmp-filename
148 "Temporary filename of current image.")
149 (defvar thumbs-current-image-filename
151 "Filename of current image.")
152 (defvar thumbs-current-image-size
154 "Size of current image.")
155 (defvar thumbs-image-num
157 "Number of current image.")
158 (defvar thumbs-current-dir
160 "Current directory.")
161 (defvar thumbs-markedL
163 "List of marked files.")
165 ;; Make sure auto-image-file-mode is ON.
166 (auto-image-file-mode t
)
168 ;; Create the thumbs directory if it does not exists.
169 (setq thumbs-thumbsdir
(expand-file-name thumbs-thumbsdir
))
171 (when (not (file-directory-p thumbs-thumbsdir
))
173 (make-directory thumbs-thumbsdir
)
174 (message "Creating thumbnails directory")))
176 (defvar thumbs-gensym-counter
0)
178 (defun thumbs-gensym (&optional arg
)
179 "Generate a new uninterned symbol.
180 The name is made by appending a number to PREFIX, default \"Thumbs\"."
181 (let ((prefix (if (stringp arg
) arg
"Thumbs"))
182 (num (if (integerp arg
) arg
184 thumbs-gensym-counter
185 (setq thumbs-gensym-counter
(1+ thumbs-gensym-counter
))))))
186 (make-symbol (format "%s%d" prefix num
))))
188 (defun thumbs-cleanup-thumbsdir ()
189 "Clean the thumbnails directory.
190 If the total size of all files in 'thumbs-thumbsdir' is bigger than
191 'thumbs-thumbsdir-max-size', files are deleted until the max size is
197 (let ((fattribsL (file-attributes f
)))
198 `(,(nth 4 fattribsL
) ,(nth 7 fattribsL
) ,f
)))
199 (directory-files thumbs-thumbsdir t
(image-file-name-regexp)))
200 '(lambda (l1 l2
) (time-less-p (car l1
)(car l2
)))))
201 (dirsize (apply '+ (mapcar (lambda (x) (cadr x
)) filesL
))))
202 (while (> dirsize thumbs-thumbsdir-max-size
)
204 (message "Deleting file %s" (cadr (cdar filesL
))))
205 (delete-file (cadr (cdar filesL
)))
206 (setq dirsize
(- dirsize
(car (cdar filesL
))))
207 (setq filesL
(cdr filesL
)))))
209 ;; Check the thumbsnail directory size and clean it if necessary.
210 (when thumbs-thumbsdir-auto-clean
211 (thumbs-cleanup-thumbsdir))
213 (defun thumbs-call-convert (filein fileout action
214 &optional arg output-format action-prefix
)
215 "Call the convert program.
216 FILEIN is the input file,
217 FILEOUT is the output file,
218 ACTION is the command to send to convert.
219 Optional argument are:
220 ARG any arguments to the ACTION command,
221 OUTPUT-FORMAT is the file format to output, default is jpeg
222 ACTION-PREFIX is the symbol to place before the ACTION command
223 (default to '-' but can sometime be '+')."
224 (let ((command (format "%s %s%s %s \"%s\" \"%s:%s\""
225 thumbs-conversion-program
226 (or action-prefix
"-")
230 (or output-format
"jpeg")
232 (shell-command command
)))
234 (defun thumbs-increment-image-size-element (n d
)
235 "Increment number N by D percent."
236 (round (+ n
(/ (* d n
) 100))))
238 (defun thumbs-decrement-image-size-element (n d
)
239 "Decrement number N by D percent."
240 (round (- n
(/ (* d n
) 100))))
242 (defun thumbs-increment-image-size (s)
243 "Increment S (a cons of width x heigh)."
245 (thumbs-increment-image-size-element (car s
)
246 thumbs-image-resizing-step
)
247 (thumbs-increment-image-size-element (cdr s
)
248 thumbs-image-resizing-step
)))
250 (defun thumbs-decrement-image-size (s)
251 "Decrement S (a cons of width x heigh)."
253 (thumbs-decrement-image-size-element (car s
)
254 thumbs-image-resizing-step
)
255 (thumbs-decrement-image-size-element (cdr s
)
256 thumbs-image-resizing-step
)))
258 (defun thumbs-resize-image (&optional increment size
)
259 "Resize image in current buffer.
260 if INCREMENT is set, make the image bigger, else smaller.
261 Or, alternatively, a SIZE may be specified."
263 ;; cleaning of old temp file
270 (let ((buffer-read-only nil
)
274 (thumbs-increment-image-size
275 thumbs-current-image-size
)
276 (thumbs-decrement-image-size
277 thumbs-current-image-size
))))
278 (tmp (format "%s%s.jpg" thumbs-temp-file
(thumbs-gensym))))
280 (thumbs-call-convert thumbs-current-image-filename
282 (concat (number-to-string (car x
)) "x"
283 (number-to-string (cdr x
))))
284 (thumbs-insert-image tmp
'jpeg
0)
285 (setq thumbs-current-tmp-filename tmp
)))
287 (defun thumbs-resize-interactive (width height
)
288 "Resize Image interactively to specified WIDTH and HEIGHT."
289 (interactive "nWidth: \nnHeight: ")
290 (thumbs-resize-image nil
(cons width height
)))
292 (defun thumbs-resize-image-size-down ()
293 "Resize image (smaller)."
295 (thumbs-resize-image nil
))
297 (defun thumbs-resize-image-size-up ()
298 "Resize image (bigger)."
300 (thumbs-resize-image t
))
302 (defun thumbs-thumbname (img)
303 "Return a thumbnail name for the image IMG."
304 (concat thumbs-thumbsdir
"/"
305 (subst-char-in-string
310 (expand-file-name img
) "/")))))
312 (defun thumbs-make-thumb (img)
313 "Create the thumbnail for IMG."
314 (let* ((fn (expand-file-name img
))
315 (tn (thumbs-thumbname img
)))
316 (if (or (not (file-exists-p tn
))
317 ;; This is not the right fix, but I don't understand
318 ;; the external program or why it produces a geometry
319 ;; unequal to the one requested -- rms.
320 ;;; (not (equal (thumbs-file-size tn) thumbs-geometry))
322 (thumbs-call-convert fn tn
"sample" thumbs-geometry
))
325 (defun thumbs-image-type (img)
326 "Return image type from filename IMG."
327 (cond ((string-match ".*\\.jpe?g\\'" img
) 'jpeg
)
328 ((string-match ".*\\.xpm\\'" img
) 'xpm
)
329 ((string-match ".*\\.xbm\\'" img
) 'xbm
)
330 ((string-match ".*\\.gif\\'" img
) 'gif
)
331 ((string-match ".*\\.bmp\\'" img
) 'bmp
)
332 ((string-match ".*\\.png\\'" img
) 'png
)
333 ((string-match ".*\\.tiff?\\'" img
) 'tiff
)))
335 (defun thumbs-file-size (img)
336 (let ((i (image-size (find-image `((:type
,(thumbs-image-type img
) :file
,img
))) t
)))
337 (concat (number-to-string (round (car i
)))
339 (number-to-string (round (cdr i
))))))
342 (defun thumbs-find-thumb (img)
343 "Display the thumbnail for IMG."
345 (find-file (thumbs-make-thumb img
)))
347 (defun thumbs-insert-image (img type relief
&optional marked
)
348 "Insert image IMG at point.
349 TYPE and RELIEF will be used in constructing the image; see `image'
350 in the emacs-lisp manual for further documentation.
351 if MARKED is non-nil, the image is marked."
352 (let ((i `(image :type
,type
355 :conversion
,(if marked
'disabled
)
356 :margin
,thumbs-margin
)))
358 (setq thumbs-current-image-size
361 (defun thumbs-insert-thumb (img &optional marked
)
362 "Insert the thumbnail for IMG at point.
363 if MARKED is non-nil, the image is marked"
365 (thumbs-make-thumb img
) 'jpeg thumbs-relief marked
)
366 (put-text-property (1- (point)) (point)
367 'thumb-image-file img
))
369 (defun thumbs-do-thumbs-insertion (L)
370 "Insert all thumbs in list L."
373 (thumbs-insert-thumb img
374 (member img thumbs-markedL
))
375 (when (= 0 (mod (setq i
(1+ i
)) thumbs-per-line
))
377 (unless (bobp) (newline))))
379 (defun thumbs-show-thumbs-list (L &optional buffer-name same-window
)
380 (when (not (display-images-p))
381 (error "Images are not supported in this Emacs session"))
382 (funcall (if same-window
'switch-to-buffer
'pop-to-buffer
)
383 (or buffer-name
"*THUMB-View*"))
384 (let ((inhibit-read-only t
))
387 (thumbs-do-thumbs-insertion L
)
388 (goto-char (point-min))
389 (setq thumbs-current-dir default-directory
)
390 (make-variable-buffer-local 'thumbs-current-dir
)))
393 (defun thumbs-show-all-from-dir (dir &optional reg same-window
)
394 "Make a preview buffer for all images in DIR.
395 Optional argument REG to select file matching a regexp,
396 and SAME-WINDOW to show thumbs in the same window."
397 (interactive "DDir: ")
398 (thumbs-show-thumbs-list
399 (directory-files dir t
400 (or reg
(image-file-name-regexp)))
401 (concat "*Thumbs: " dir
) same-window
))
404 (defun thumbs-dired-show-marked ()
405 "In Dired, make a thumbs buffer with all marked files."
407 (thumbs-show-thumbs-list (dired-get-marked-files) nil t
))
410 (defun thumbs-dired-show-all ()
411 "In dired, make a thumbs buffer with all files in current directory."
413 (thumbs-show-all-from-dir default-directory nil t
))
416 (defalias 'thumbs
'thumbs-show-all-from-dir
)
418 (defun thumbs-find-image (img &optional num otherwin
)
420 (if otherwin
'switch-to-buffer-other-window
'switch-to-buffer
)
421 (concat "*Image: " (file-name-nondirectory img
) " - "
422 (number-to-string (or num
0)) "*"))
423 (thumbs-view-image-mode)
424 (let ((inhibit-read-only t
))
425 (setq thumbs-current-image-filename img
426 thumbs-current-tmp-filename nil
427 thumbs-image-num
(or num
0))
428 (make-variable-buffer-local 'thumbs-current-image-filename
)
429 (make-variable-buffer-local 'thumbs-current-tmp-filename
)
430 (make-variable-buffer-local 'thumbs-current-image-size
)
431 (make-variable-buffer-local 'thumbs-image-num
)
432 (delete-region (point-min)(point-max))
433 (thumbs-insert-image img
(thumbs-image-type img
) 0)))
435 (defun thumbs-find-image-at-point (&optional img otherwin
)
436 "Display image IMG for thumbnail at point.
437 use another window it OTHERWIN is t."
439 (let* ((i (or img
(thumbs-current-image))))
440 (thumbs-find-image i
(point) otherwin
)))
442 (defun thumbs-find-image-at-point-other-window ()
443 "Display image for thumbnail at point in the preview buffer.
444 Open another window."
446 (thumbs-find-image-at-point nil t
))
448 (defun thumbs-mouse-find-image (event)
449 "Display image for thumbnail at mouse click EVENT."
451 (mouse-set-point event
)
452 (thumbs-find-image-at-point))
454 (defun thumbs-call-setroot-command (img)
455 "Call the setroot program for IMG."
456 (run-hooks 'thumbs-before-setroot-hook
)
457 (shell-command (replace-regexp-in-string
459 (shell-quote-argument (expand-file-name img
))
460 thumbs-setroot-command nil t
))
461 (run-hooks 'thumbs-after-setroot-hook
))
463 (defun thumbs-set-image-at-point-to-root-window ()
464 "Set the image at point as the desktop wallpaper."
466 (thumbs-call-setroot-command
467 (thumbs-current-image)))
469 (defun thumbs-set-root ()
470 "Set the current image as root."
472 (thumbs-call-setroot-command
473 (or thumbs-current-tmp-filename
474 thumbs-current-image-filename
)))
476 (defun thumbs-file-alist ()
477 "Make an alist of elements (POS . FILENAME) for all images in thumb buffer."
480 (goto-char (point-min))
482 (if (thumbs-current-image)
483 (push (cons (point-marker)
484 (thumbs-current-image))
489 (defun thumbs-file-list ()
490 "Make a list of file names for all images in thumb buffer."
493 (goto-char (point-min))
495 (if (thumbs-current-image)
496 (push (thumbs-current-image) list
))
500 (defun thumbs-delete-images ()
501 "Delete the image at point (and it's thumbnail) (or marked files if any)."
503 (let ((files (or thumbs-markedL
(list (thumbs-current-image)))))
504 (if (yes-or-no-p (format "Really delete %d files? " (length files
)))
505 (let ((thumbs-fileL (thumbs-file-alist))
506 (inhibit-read-only t
))
512 (delete-file (thumbs-thumbname x
)))
513 (file-error (setq failure t
)))
515 (when (rassoc x thumbs-fileL
)
516 (goto-char (car (rassoc x thumbs-fileL
)))
517 (delete-region (point) (1+ (point))))
519 (delq x thumbs-markedL
)))))))))
521 (defun thumbs-rename-images (newfile)
522 "Rename the image at point (and it's thumbnail) (or marked files if any)."
523 (interactive "FRename to file or directory: ")
524 (let ((files (or thumbs-markedL
(list (thumbs-current-image))))
526 (if (and (not (file-directory-p newfile
))
528 (if (file-exists-p newfile
)
529 (error "Renaming marked files to file name `%s'" newfile
)
530 (make-directory newfile t
)))
531 (if (yes-or-no-p (format "Really rename %d files? " (length files
)))
532 (let ((thumbs-fileL (thumbs-file-alist))
533 (inhibit-read-only t
))
537 (if (file-directory-p newfile
)
540 (file-name-nondirectory file
)
542 (rename-file file newfile
))
543 (file-error (setq failure t
)
544 (push file failures
)))
546 (when (rassoc file thumbs-fileL
)
547 (goto-char (car (rassoc file thumbs-fileL
)))
548 (delete-region (point) (1+ (point))))
550 (delq file thumbs-markedL
)))))))
552 (display-warning 'file-error
553 (format "Rename failures for %s into %s"
557 (defun thumbs-kill-buffer ()
558 "Kill the current buffer."
560 (let ((buffer (current-buffer)))
562 (delete-window (selected-window))
564 (kill-buffer buffer
)))
566 (defun thumbs-show-image-num (num)
567 "Show the image with number NUM."
568 (let ((image-buffer (get-buffer-create "*Image*")))
569 (let ((i (thumbs-current-image)))
570 (with-current-buffer image-buffer
571 (thumbs-insert-image i
(thumbs-image-type i
) 0))
572 (setq thumbs-image-num num
573 thumbs-current-image-filename i
))))
575 (defun thumbs-next-image ()
578 (let* ((i (1+ thumbs-image-num
))
579 (list (thumbs-file-alist))
581 (while (and (/= i thumbs-image-num
) (not (assoc i list
)))
582 (setq i
(if (>= i l
) 1 (1+ i
))))
583 (thumbs-show-image-num i
)))
585 (defun thumbs-previous-image ()
586 "Show the previous image."
588 (let* ((i (- thumbs-image-num
1))
589 (list (thumbs-file-alist))
591 (while (and (/= i thumbs-image-num
) (not (assoc i list
)))
592 (setq i
(if (<= i
1) l
(1- i
))))
593 (thumbs-show-image-num i
)))
595 (defun thumbs-redraw-buffer ()
596 "Redraw the current thumbs buffer."
598 (inhibit-read-only t
)
599 (files (thumbs-file-list)))
601 (thumbs-do-thumbs-insertion files
)
604 (defun thumbs-mark ()
605 "Mark the image at point."
607 (let ((elt (thumbs-current-image)))
609 (error "No image here"))
610 (push elt thumbs-markedL
)
611 (let ((inhibit-read-only t
))
613 (thumbs-insert-thumb elt t
)))
614 (when (eolp) (forward-char)))
616 (defun thumbs-unmark ()
617 "Unmark the image at point."
619 (let ((elt (thumbs-current-image)))
621 (error "No image here"))
622 (setq thumbs-markedL
(delete elt thumbs-markedL
))
623 (let ((inhibit-read-only t
))
625 (thumbs-insert-thumb elt nil
)))
626 (when (eolp) (forward-char)))
628 ;; Image modification routines
630 (defun thumbs-modify-image (action &optional arg
)
631 "Call convert to do ACTION on image with argument ARG.
632 ACTION and ARG should be legal convert command."
633 (interactive "sAction: \nsValue: ")
634 ;; cleaning of old temp file
640 (let ((buffer-read-only nil
)
641 (tmp (format "%s%s.jpg" thumbs-temp-file
(thumbs-gensym))))
643 (thumbs-call-convert thumbs-current-image-filename
647 (thumbs-insert-image tmp
'jpeg
0)
648 (setq thumbs-current-tmp-filename tmp
)))
650 (defun thumbs-emboss-image (emboss)
651 "Emboss the image with value EMBOSS."
652 (interactive "nEmboss value: ")
653 (if (or (< emboss
3) (> emboss
31) (zerop (% emboss
2)))
654 (error "Arg must be an odd number between 3 and 31"))
655 (thumbs-modify-image "emboss" (number-to-string emboss
)))
657 (defun thumbs-monochrome-image ()
658 "Turn the image to monochrome."
660 (thumbs-modify-image "monochrome"))
662 (defun thumbs-negate-image ()
665 (thumbs-modify-image "negate"))
667 (defun thumbs-rotate-left ()
668 "Rotate the image 90 degrees counter-clockwise."
670 (thumbs-modify-image "rotate" "270"))
672 (defun thumbs-rotate-right ()
673 "Rotate the image 90 degrees clockwise."
675 (thumbs-modify-image "rotate" "90"))
677 (defun thumbs-current-image ()
678 "Return the name of the image file name at point."
679 (get-text-property (point) 'thumb-image-file
))
681 (defun thumbs-forward-char ()
682 "Move forward one image."
685 (while (and (not (eobp)) (not (thumbs-current-image)))
689 (defun thumbs-backward-char ()
690 "Move backward one image."
693 (while (and (not (bobp)) (not (thumbs-current-image)))
697 (defun thumbs-forward-line ()
698 "Move down one line."
703 (defun thumbs-backward-line ()
709 (defun thumbs-show-name ()
710 "Show the name of the current file."
712 (let ((f (thumbs-current-image)))
713 (and f
(message "%s [%s]" f
(thumbs-file-size f
)))))
715 (defun thumbs-save-current-image ()
716 "Save the current image."
718 (let ((f (or thumbs-current-tmp-filename
719 thumbs-current-image-filename
))
720 (sa (read-from-minibuffer "Save image file as: "
721 thumbs-current-image-filename
)))
724 (defun thumbs-dired ()
725 "Use `dired' on the current thumbs directory."
727 (dired thumbs-current-dir
))
731 (defvar thumbs-mode-map
732 (let ((map (make-sparse-keymap)))
733 (define-key map
[return] 'thumbs-find-image-at-point)
734 (define-key map [mouse-2] 'thumbs-mouse-find-image)
735 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window)
736 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window)
737 (define-key map [delete] 'thumbs-delete-images)
738 (define-key map [right] 'thumbs-forward-char)
739 (define-key map [left] 'thumbs-backward-char)
740 (define-key map [up] 'thumbs-backward-line)
741 (define-key map [down] 'thumbs-forward-line)
742 (define-key map "d" 'thumbs-dired)
743 (define-key map "m" 'thumbs-mark)
744 (define-key map "u" 'thumbs-unmark)
745 (define-key map "R" 'thumbs-rename-images)
746 (define-key map "x" 'thumbs-delete-images)
747 (define-key map "s" 'thumbs-show-name)
748 (define-key map "q" 'thumbs-kill-buffer)
750 "Keymap for `thumbs-mode'.")
752 (put 'thumbs-mode 'mode-class 'special)
753 (define-derived-mode thumbs-mode
754 fundamental-mode "thumbs"
755 "Preview images in a thumbnails buffer"
756 (make-variable-buffer-local 'thumbs-markedL)
757 (setq buffer-read-only t)
758 (setq thumbs-markedL nil))
760 (defvar thumbs-view-image-mode-map
761 (let ((map (make-sparse-keymap)))
762 (define-key map [prior] 'thumbs-previous-image)
763 (define-key map [next] 'thumbs-next-image)
764 (define-key map "-" 'thumbs-resize-image-size-down)
765 (define-key map "+" 'thumbs-resize-image-size-up)
766 (define-key map "<" 'thumbs-rotate-left)
767 (define-key map ">" 'thumbs-rotate-right)
768 (define-key map "e" 'thumbs-emboss-image)
769 (define-key map "r" 'thumbs-resize-interactive)
770 (define-key map "s" 'thumbs-save-current-image)
771 (define-key map "q" 'thumbs-kill-buffer)
772 (define-key map "w" 'thunbs-set-root)
774 "Keymap for `thumbs-view-image-mode'.")
776 ;; thumbs-view-image-mode
777 (put 'thumbs-view-image-mode 'mode-class 'special)
778 (define-derived-mode thumbs-view-image-mode
779 fundamental-mode "image-view-mode")
782 (defun thumbs-dired-setroot ()
783 "In dired, Call the setroot program on the image at point."
785 (thumbs-call-setroot-command (dired-get-filename)))
787 ;; Modif to dired mode map
788 (define-key dired-mode-map "\C-ta" 'thumbs-dired-show-all)
789 (define-key dired-mode-map "\C-tm" 'thumbs-dired-show-marked)
790 (define-key dired-mode-map "\C-tw" 'thumbs-dired-setroot)
794 ;;; thumbs.el ends here
797 ;;; arch-tag: f9ac1ef8-83fc-42c0-8069-1fae43fd2e5c