annotate lisp/thumbs.el @ 57393:3493253e6b69

(lisp-fill-paragraph): Change paragraph-start regexp so we don't fill code starting with #'(
author Eli Zaretskii <eliz@gnu.org>
date Fri, 08 Oct 2004 17:54:43 +0000
parents ff141f26a0cb
children 5e17e1a1eacf cce1c0ee76ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; thumbs.el --- Thumbnails previewer for images files
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
2
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
3 ;; Copyright 2004 Free Software Foundation, Inc
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
4
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca>
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Keywords: Multimedia
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; any later version.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
24 ;;
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
25 ;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
26 ;; The peoples at #emacs@freenode.net for numerous help
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
27 ;; RMS for emacs and the GNU project.
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
28 ;;
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;;; Commentary:
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; This package create two new mode: thumbs-mode and
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; thumbs-view-image-mode. It is used for images browsing and viewing
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; from within emacs. Minimal image manipulation functions are also
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; available via external programs.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; The 'convert' program from 'ImageMagick'
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; [URL:http://www.imagemagick.org/] is required.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;;
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; CHANGELOG
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;;
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; This is version 2.0
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;;
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; USAGE
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;;
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; Type M-x thumbs RET DIR RET to view the directory DIR in Thumbs mode.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; That should be a directory containing image files.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; from dired, C-t m enter in thumbs-mode with all marked files
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; C-t a enter in thumbs-mode with all files in current-directory
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; In thumbs-mode, pressing <return> on a image will bring you in image view mode
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; for that image. C-h m will give you a list of available keybinding.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;;; History:
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
55 ;;
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;;; Code:
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 (require 'dired)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; CUSTOMIZATIONS
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (defgroup thumbs nil
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 "Thumbnails previewer."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 :group 'multimedia)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (defcustom thumbs-thumbsdir
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (expand-file-name "~/.emacs-thumbs")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 "*Directory to store thumbnails."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 :type 'directory
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 (defcustom thumbs-geometry "100x100"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 "*Size of thumbnails."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (defcustom thumbs-per-line 5
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 "*Number of thumbnails per line to show in directory."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (defcustom thumbs-thumbsdir-max-size 50000000
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 "Max size for thumbnails directory.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 When it reach that size (in bytes), a warning is send."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (defcustom thumbs-conversion-program
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (if (equal 'windows-nt system-type)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 "convert.exe"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (or (executable-find "convert")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 "/usr/X11R6/bin/convert"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 "*Name of conversion program for thumbnails generation.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 It must be 'convert'."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (defcustom thumbs-setroot-command
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 "xloadimage -onroot -fullscreen *"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 "Command to set the root window."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (defcustom thumbs-relief 5
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 "*Size of button-like border around thumbnails."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (defcustom thumbs-margin 2
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 "*Size of the margin around thumbnails.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 This is where you see the cursor."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (defcustom thumbs-thumbsdir-auto-clean t
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 "If set, delete older file in the thumbnails directory.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 Deletion is done at load time when the directory size is bigger
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 than 'thumbs-thumbsdir-max-size'."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 :type 'boolean
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 (defcustom thumbs-image-resizing-step 10
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 "Step by wich to resize image."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (defcustom thumbs-temp-dir
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 "/tmp/"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 "Temporary directory to use.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 Leaving it to default '/tmp/' can let another user
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 see some of your images."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 :type 'directory
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 (defcustom thumbs-temp-prefix "emacsthumbs"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 "Prefix to add to temp files."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 :type 'string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 :group 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 ;; Initialize some variable, for later use.
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
142 (defvar thumbs-temp-file
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
143 (concat thumbs-temp-dir thumbs-temp-prefix)
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 "Temporary filesname for images.")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
146 (defvar thumbs-current-tmp-filename
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
147 nil
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 "Temporary filename of current image.")
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
149 (defvar thumbs-current-image-filename
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 nil
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 "Filename of current image.")
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
152 (defvar thumbs-current-image-size
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 nil
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 "Size of current image.")
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
155 (defvar thumbs-image-num
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 nil
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 "Number of current image.")
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
158 (defvar thumbs-current-dir
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 nil
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 "Current directory.")
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
161 (defvar thumbs-markedL
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 nil
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 "List of marked files.")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 ;; Make sure auto-image-file-mode is ON.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (auto-image-file-mode t)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 ;; Create the thumbs directory if it does not exists.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 (setq thumbs-thumbsdir (expand-file-name thumbs-thumbsdir))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 (when (not (file-directory-p thumbs-thumbsdir))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (progn
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 (make-directory thumbs-thumbsdir)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 (message "Creating thumbnails directory")))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 (defvar thumbs-gensym-counter 0)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (defun thumbs-gensym (&optional arg)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 "Generate a new uninterned symbol.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 The name is made by appending a number to PREFIX, default \"Thumbs\"."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 (let ((prefix (if (stringp arg) arg "Thumbs"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 (num (if (integerp arg) arg
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
183 (prog1
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 thumbs-gensym-counter
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (setq thumbs-gensym-counter (1+ thumbs-gensym-counter))))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 (make-symbol (format "%s%d" prefix num))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 (defun thumbs-cleanup-thumbsdir ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 "Clean the thumbnails directory.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 If the total size of all files in 'thumbs-thumbsdir' is bigger than
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 'thumbs-thumbsdir-max-size', files are deleted until the max size is
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 reached."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 (let* ((filesL
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (sort
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (mapcar
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (lambda (f)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (let ((fattribsL (file-attributes f)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 `(,(nth 4 fattribsL) ,(nth 7 fattribsL) ,f)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 (directory-files thumbs-thumbsdir t (image-file-name-regexp)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 '(lambda (l1 l2) (time-less-p (car l1)(car l2)))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) filesL))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 (while (> dirsize thumbs-thumbsdir-max-size)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 (progn
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
204 (message "Deleting file %s" (cadr (cdar filesL))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
205 (delete-file (cadr (cdar filesL)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
206 (setq dirsize (- dirsize (car (cdar filesL))))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (setq filesL (cdr filesL)))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 ;; Check the thumbsnail directory size and clean it if necessary.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 (when thumbs-thumbsdir-auto-clean
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 (thumbs-cleanup-thumbsdir))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (defun thumbs-call-convert (filein fileout action
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 &optional arg output-format action-prefix)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 "Call the convert program.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 FILEIN is the input file,
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 FILEOUT is the output file,
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 ACTION is the command to send to convert.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 Optional argument are:
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 ARG any arguments to the ACTION command,
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 OUTPUT-FORMAT is the file format to output, default is jpeg
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 ACTION-PREFIX is the symbol to place before the ACTION command
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 (default to '-' but can sometime be '+')."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 (let ((command (format "%s %s%s %s \"%s\" \"%s:%s\""
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 thumbs-conversion-program
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 (or action-prefix "-")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 action
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 (or arg "")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 filein
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 (or output-format "jpeg")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 fileout)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (shell-command command)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 (defun thumbs-increment-image-size-element (n d)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 "Increment number N by D percent."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (round (+ n (/ (* d n) 100))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 (defun thumbs-decrement-image-size-element (n d)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 "Decrement number N by D percent."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (round (- n (/ (* d n) 100))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 (defun thumbs-increment-image-size (s)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 "Increment S (a cons of width x heigh)."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 (cons
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 (thumbs-increment-image-size-element (car s)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 thumbs-image-resizing-step)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 (thumbs-increment-image-size-element (cdr s)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 thumbs-image-resizing-step)))
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
249
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 (defun thumbs-decrement-image-size (s)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 "Decrement S (a cons of width x heigh)."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 (cons
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 (thumbs-decrement-image-size-element (car s)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 thumbs-image-resizing-step)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 (thumbs-decrement-image-size-element (cdr s)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 thumbs-image-resizing-step)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (defun thumbs-resize-image (&optional increment size)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 "Resize image in current buffer.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 if INCREMENT is set, make the image bigger, else smaller.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 Or, alternatively, a SIZE may be specified."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 ;; cleaning of old temp file
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
264 (condition-case nil
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (apply 'delete-file
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (directory-files
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 thumbs-temp-dir t
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
268 thumbs-temp-prefix))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
269 (error nil))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (let ((buffer-read-only nil)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 (x (if size
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 size
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (if increment
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 (thumbs-increment-image-size
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 thumbs-current-image-size)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (thumbs-decrement-image-size
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 thumbs-current-image-size))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (tmp (format "%s%s.jpg" thumbs-temp-file (thumbs-gensym))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 (erase-buffer)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (thumbs-call-convert thumbs-current-image-filename
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 tmp "sample"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (concat (number-to-string (car x)) "x"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (number-to-string (cdr x))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (thumbs-insert-image tmp 'jpeg 0)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (setq thumbs-current-tmp-filename tmp)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (defun thumbs-resize-interactive (width height)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 "Resize Image interactively to specified WIDTH and HEIGHT."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (interactive "nWidth: \nnHeight: ")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (thumbs-resize-image nil (cons width height)))
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
291
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (defun thumbs-resize-image-size-down ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 "Resize image (smaller)."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (thumbs-resize-image nil))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (defun thumbs-resize-image-size-up ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 "Resize image (bigger)."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (thumbs-resize-image t))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (defun thumbs-thumbname (img)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 "Return a thumbnail name for the image IMG."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (concat thumbs-thumbsdir "/"
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
305 (subst-char-in-string
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 ?\ ?\_
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (apply
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 'concat
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 (split-string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (expand-file-name img) "/")))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (defun thumbs-make-thumb (img)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 "Create the thumbnail for IMG."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (let* ((fn (expand-file-name img))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (tn (thumbs-thumbname img)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (if (or (not (file-exists-p tn))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
317 ;; This is not the right fix, but I don't understand
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
318 ;; the external program or why it produces a geometry
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
319 ;; unequal to the one requested -- rms.
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
320 ;;; (not (equal (thumbs-file-size tn) thumbs-geometry))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
321 )
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 (thumbs-call-convert fn tn "sample" thumbs-geometry))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 tn))
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
324
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (defun thumbs-image-type (img)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 "Return image type from filename IMG."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 (cond ((string-match ".*\\.jpe?g\\'" img) 'jpeg)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 ((string-match ".*\\.xpm\\'" img) 'xpm)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 ((string-match ".*\\.xbm\\'" img) 'xbm)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 ((string-match ".*\\.gif\\'" img) 'gif)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 ((string-match ".*\\.bmp\\'" img) 'bmp)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 ((string-match ".*\\.png\\'" img) 'png)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 ((string-match ".*\\.tiff?\\'" img) 'tiff)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 (defun thumbs-file-size (img)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 (let ((i (image-size (find-image `((:type ,(thumbs-image-type img) :file ,img))) t)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 (concat (number-to-string (round (car i)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 "x"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 (number-to-string (round (cdr i))))))
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
340
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 ;;;###autoload
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (defun thumbs-find-thumb (img)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 "Display the thumbnail for IMG."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (interactive "f")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (find-file (thumbs-make-thumb img)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (defun thumbs-insert-image (img type relief &optional marked)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 "Insert image IMG at point.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 TYPE and RELIEF will be used in constructing the image; see `image'
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 in the emacs-lisp manual for further documentation.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 if MARKED is non-nil, the image is marked."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 (let ((i `(image :type ,type
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 :file ,img
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 :relief ,relief
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 :conversion ,(if marked 'disabled)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 :margin ,thumbs-margin)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (insert-image i)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (setq thumbs-current-image-size
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (image-size i t))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (defun thumbs-insert-thumb (img &optional marked)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 "Insert the thumbnail for IMG at point.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 if MARKED is non-nil, the image is marked"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 (thumbs-insert-image
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
365 (thumbs-make-thumb img) 'jpeg thumbs-relief marked)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
366 (put-text-property (1- (point)) (point)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
367 'thumb-image-file img))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 (defun thumbs-do-thumbs-insertion (L)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 "Insert all thumbs in list L."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (let ((i 0))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
372 (dolist (img L)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
373 (thumbs-insert-thumb img
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
374 (member img thumbs-markedL))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 (when (= 0 (mod (setq i (1+ i)) thumbs-per-line))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
376 (newline)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
377 (unless (bobp) (newline))))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 (defun thumbs-show-thumbs-list (L &optional buffer-name same-window)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
380 (when (not (display-images-p))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
381 (error "Images are not supported in this Emacs session"))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (funcall (if same-window 'switch-to-buffer 'pop-to-buffer)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (or buffer-name "*THUMB-View*"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (let ((inhibit-read-only t))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 (erase-buffer)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 (thumbs-mode)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 (thumbs-do-thumbs-insertion L)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 (goto-char (point-min))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (setq thumbs-current-dir default-directory)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (make-variable-buffer-local 'thumbs-current-dir)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 ;;;###autoload
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (defun thumbs-show-all-from-dir (dir &optional reg same-window)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 "Make a preview buffer for all images in DIR.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 Optional argument REG to select file matching a regexp,
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 and SAME-WINDOW to show thumbs in the same window."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 (interactive "DDir: ")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 (thumbs-show-thumbs-list
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (directory-files dir t
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 (or reg (image-file-name-regexp)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 (concat "*Thumbs: " dir) same-window))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 ;;;###autoload
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (defun thumbs-dired-show-marked ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 "In Dired, make a thumbs buffer with all marked files."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (thumbs-show-thumbs-list (dired-get-marked-files) nil t))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 ;;;###autoload
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (defun thumbs-dired-show-all ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 "In dired, make a thumbs buffer with all files in current directory."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 (thumbs-show-all-from-dir default-directory nil t))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 ;;;###autoload
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 (defalias 'thumbs 'thumbs-show-all-from-dir)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
418 (defun thumbs-find-image (img &optional num otherwin)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
419 (funcall
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 (concat "*Image: " (file-name-nondirectory img) " - "
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (number-to-string (or num 0)) "*"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 (thumbs-view-image-mode)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (let ((inhibit-read-only t))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (setq thumbs-current-image-filename img
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 thumbs-current-tmp-filename nil
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 thumbs-image-num (or num 0))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 (make-variable-buffer-local 'thumbs-current-image-filename)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 (make-variable-buffer-local 'thumbs-current-tmp-filename)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 (make-variable-buffer-local 'thumbs-current-image-size)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 (make-variable-buffer-local 'thumbs-image-num)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 (delete-region (point-min)(point-max))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (thumbs-insert-image img (thumbs-image-type img) 0)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (defun thumbs-find-image-at-point (&optional img otherwin)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 "Display image IMG for thumbnail at point.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 use another window it OTHERWIN is t."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 (interactive)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
439 (let* ((i (or img (thumbs-current-image))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
440 (thumbs-find-image i (point) otherwin)))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 (defun thumbs-find-image-at-point-other-window ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 "Display image for thumbnail at point in the preview buffer.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 Open another window."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (thumbs-find-image-at-point nil t))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
448 (defun thumbs-mouse-find-image (event)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
449 "Display image for thumbnail at mouse click EVENT."
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
450 (interactive "e")
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
451 (mouse-set-point event)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
452 (thumbs-find-image-at-point))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
453
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 (defun thumbs-call-setroot-command (img)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 "Call the setroot program for IMG."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 (run-hooks 'thumbs-before-setroot-hook)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 (shell-command (replace-regexp-in-string
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 "\\*"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 (shell-quote-argument (expand-file-name img))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 thumbs-setroot-command nil t))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 (run-hooks 'thumbs-after-setroot-hook))
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
462
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 (defun thumbs-set-image-at-point-to-root-window ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 "Set the image at point as the desktop wallpaper."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (interactive)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
466 (thumbs-call-setroot-command
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
467 (thumbs-current-image)))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (defun thumbs-set-root ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 "Set the current image as root."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 (thumbs-call-setroot-command
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 (or thumbs-current-tmp-filename
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 thumbs-current-image-filename)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
476 (defun thumbs-file-alist ()
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
477 "Make an alist of elements (POS . FILENAME) for all images in thumb buffer."
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
478 (save-excursion
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
479 (let (list)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
480 (goto-char (point-min))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
481 (while (not (eobp))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
482 (if (thumbs-current-image)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
483 (push (cons (point-marker)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
484 (thumbs-current-image))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
485 list))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
486 (forward-char 1))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
487 list)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
488
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
489 (defun thumbs-file-list ()
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
490 "Make a list of file names for all images in thumb buffer."
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
491 (save-excursion
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
492 (let (list)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
493 (goto-char (point-min))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
494 (while (not (eobp))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
495 (if (thumbs-current-image)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
496 (push (thumbs-current-image) list))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
497 (forward-char 1))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
498 (nreverse list))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
499
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 (defun thumbs-delete-images ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 "Delete the image at point (and it's thumbnail) (or marked files if any)."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 (interactive)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
503 (let ((files (or thumbs-markedL (list (thumbs-current-image)))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
504 (if (yes-or-no-p (format "Really delete %d files? " (length files)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
505 (let ((thumbs-fileL (thumbs-file-alist))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
506 (inhibit-read-only t))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
507 (dolist (x files)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
508 (let (failure)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
509 (condition-case ()
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
510 (progn
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (delete-file x)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
512 (delete-file (thumbs-thumbname x)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
513 (file-error (setq failure t)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
514 (unless failure
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
515 (when (rassoc x thumbs-fileL)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
516 (goto-char (car (rassoc x thumbs-fileL)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
517 (delete-region (point) (1+ (point))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
518 (setq thumbs-markedL
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
519 (delq x thumbs-markedL)))))))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
520
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
521 (defun thumbs-rename-images (newfile)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
522 "Rename the image at point (and it's thumbnail) (or marked files if any)."
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
523 (interactive "FRename to file or directory: ")
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
524 (let ((files (or thumbs-markedL (list (thumbs-current-image))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
525 failures)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
526 (if (and (not (file-directory-p newfile))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
527 thumbs-markedL)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
528 (if (file-exists-p newfile)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
529 (error "Renaming marked files to file name `%s'" newfile)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
530 (make-directory newfile t)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
531 (if (yes-or-no-p (format "Really rename %d files? " (length files)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
532 (let ((thumbs-fileL (thumbs-file-alist))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
533 (inhibit-read-only t))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
534 (dolist (file files)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
535 (let (failure)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
536 (condition-case ()
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
537 (if (file-directory-p newfile)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
538 (rename-file file
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
539 (expand-file-name
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
540 (file-name-nondirectory file)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
541 newfile))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
542 (rename-file file newfile))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
543 (file-error (setq failure t)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
544 (push file failures)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
545 (unless failure
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
546 (when (rassoc file thumbs-fileL)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
547 (goto-char (car (rassoc file thumbs-fileL)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
548 (delete-region (point) (1+ (point))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
549 (setq thumbs-markedL
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
550 (delq file thumbs-markedL)))))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
551 (if failures
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
552 (display-warning 'file-error
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
553 (format "Rename failures for %s into %s"
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
554 failures newfile)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
555 :error))))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 (defun thumbs-kill-buffer ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 "Kill the current buffer."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (let ((buffer (current-buffer)))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
561 (condition-case nil
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
562 (delete-window (selected-window))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
563 (error nil))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (kill-buffer buffer)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (defun thumbs-show-image-num (num)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 "Show the image with number NUM."
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
568 (let ((image-buffer (get-buffer-create "*Image*")))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
569 (let ((i (thumbs-current-image)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
570 (with-current-buffer image-buffer
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
571 (thumbs-insert-image i (thumbs-image-type i) 0))
55213
a911edb6dadf (thumbs-delete-images): Fix formatting of prompt.
John Paul Wallington <jpw@pobox.com>
parents: 55206
diff changeset
572 (setq thumbs-image-num num
a911edb6dadf (thumbs-delete-images): Fix formatting of prompt.
John Paul Wallington <jpw@pobox.com>
parents: 55206
diff changeset
573 thumbs-current-image-filename i))))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 (defun thumbs-next-image ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 "Show next image."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (let* ((i (1+ thumbs-image-num))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
579 (list (thumbs-file-alist))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
580 (l (caar list)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
581 (while (and (/= i thumbs-image-num) (not (assoc i list)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
582 (setq i (if (>= i l) 1 (1+ i))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
583 (thumbs-show-image-num i)))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 (defun thumbs-previous-image ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 "Show the previous image."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 (let* ((i (- thumbs-image-num 1))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
589 (list (thumbs-file-alist))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
590 (l (caar list)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
591 (while (and (/= i thumbs-image-num) (not (assoc i list)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
592 (setq i (if (<= i 1) l (1- i))))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
593 (thumbs-show-image-num i)))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 (defun thumbs-redraw-buffer ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 "Redraw the current thumbs buffer."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 (let ((p (point))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
598 (inhibit-read-only t)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
599 (files (thumbs-file-list)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
600 (erase-buffer)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
601 (thumbs-do-thumbs-insertion files)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
602 (goto-char p)))
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
603
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 (defun thumbs-mark ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 "Mark the image at point."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 (interactive)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
607 (let ((elt (thumbs-current-image)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
608 (unless elt
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
609 (error "No image here"))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
610 (push elt thumbs-markedL)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
611 (let ((inhibit-read-only t))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
612 (delete-char 1)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
613 (thumbs-insert-thumb elt t)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
614 (when (eolp) (forward-char)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
615
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
616 (defun thumbs-unmark ()
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
617 "Unmark the image at point."
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
618 (interactive)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
619 (let ((elt (thumbs-current-image)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
620 (unless elt
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
621 (error "No image here"))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
622 (setq thumbs-markedL (delete elt thumbs-markedL))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
623 (let ((inhibit-read-only t))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
624 (delete-char 1)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
625 (thumbs-insert-thumb elt nil)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
626 (when (eolp) (forward-char)))
55206
c2c29cafaa74 (time-less-p): Remove.
Juanma Barranquero <lekktu@gmail.com>
parents: 54193
diff changeset
627
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 ;; Image modification routines
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 (defun thumbs-modify-image (action &optional arg)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 "Call convert to do ACTION on image with argument ARG.
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 ACTION and ARG should be legal convert command."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 (interactive "sAction: \nsValue: ")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 ;; cleaning of old temp file
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 (mapc 'delete-file
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (directory-files
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 thumbs-temp-dir
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 t
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 thumbs-temp-prefix))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 (let ((buffer-read-only nil)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 (tmp (format "%s%s.jpg" thumbs-temp-file (thumbs-gensym))))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 (erase-buffer)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (thumbs-call-convert thumbs-current-image-filename
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 tmp
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 action
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 (or arg ""))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 (thumbs-insert-image tmp 'jpeg 0)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (setq thumbs-current-tmp-filename tmp)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 (defun thumbs-emboss-image (emboss)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 "Emboss the image with value EMBOSS."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 (interactive "nEmboss value: ")
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
653 (if (or (< emboss 3) (> emboss 31) (zerop (% emboss 2)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
654 (error "Arg must be an odd number between 3 and 31"))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 (thumbs-modify-image "emboss" (number-to-string emboss)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 (defun thumbs-monochrome-image ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 "Turn the image to monochrome."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (thumbs-modify-image "monochrome"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 (defun thumbs-negate-image ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 "Negate the image."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 (thumbs-modify-image "negate"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 (defun thumbs-rotate-left ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 "Rotate the image 90 degrees counter-clockwise."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 (thumbs-modify-image "rotate" "270"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (defun thumbs-rotate-right ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 "Rotate the image 90 degrees clockwise."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (thumbs-modify-image "rotate" "90"))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
677 (defun thumbs-current-image ()
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
678 "Return the name of the image file name at point."
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
679 (get-text-property (point) 'thumb-image-file))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
680
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 (defun thumbs-forward-char ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 "Move forward one image."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 (forward-char)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
685 (while (and (not (eobp)) (not (thumbs-current-image)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
686 (forward-char))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 (thumbs-show-name))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 (defun thumbs-backward-char ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 "Move backward one image."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 (forward-char -1)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
693 (while (and (not (bobp)) (not (thumbs-current-image)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
694 (forward-char -1))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 (thumbs-show-name))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 (defun thumbs-forward-line ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 "Move down one line."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 (forward-line 1)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (thumbs-show-name))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (defun thumbs-backward-line ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 "Move up one line."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 (forward-line -1)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 (thumbs-show-name))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 (defun thumbs-show-name ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 "Show the name of the current file."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 (interactive)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
712 (let ((f (thumbs-current-image)))
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
713 (and f (message "%s [%s]" f (thumbs-file-size f)))))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 (defun thumbs-save-current-image ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 "Save the current image."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (let ((f (or thumbs-current-tmp-filename
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 thumbs-current-image-filename))
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
720 (sa (read-from-minibuffer "Save image file as: "
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 thumbs-current-image-filename)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (copy-file f sa)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (defun thumbs-dired ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 "Use `dired' on the current thumbs directory."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 (dired thumbs-current-dir))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 ;; thumbs-mode
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 (defvar thumbs-mode-map
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 (let ((map (make-sparse-keymap)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 (define-key map [return] 'thumbs-find-image-at-point)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
734 (define-key map [mouse-2] 'thumbs-mouse-find-image)
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 (define-key map [delete] 'thumbs-delete-images)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 (define-key map [right] 'thumbs-forward-char)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 (define-key map [left] 'thumbs-backward-char)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 (define-key map [up] 'thumbs-backward-line)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 (define-key map [down] 'thumbs-forward-line)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742 (define-key map "d" 'thumbs-dired)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 (define-key map "m" 'thumbs-mark)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
744 (define-key map "u" 'thumbs-unmark)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
745 (define-key map "R" 'thumbs-rename-images)
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
746 (define-key map "x" 'thumbs-delete-images)
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 (define-key map "s" 'thumbs-show-name)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748 (define-key map "q" 'thumbs-kill-buffer)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 map)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 "Keymap for `thumbs-mode'.")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
752 (put 'thumbs-mode 'mode-class 'special)
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 (define-derived-mode thumbs-mode
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 fundamental-mode "thumbs"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755 "Preview images in a thumbnails buffer"
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756 (make-variable-buffer-local 'thumbs-markedL)
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
757 (setq buffer-read-only t)
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758 (setq thumbs-markedL nil))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760 (defvar thumbs-view-image-mode-map
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 (let ((map (make-sparse-keymap)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 (define-key map [prior] 'thumbs-previous-image)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 (define-key map [next] 'thumbs-next-image)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 (define-key map "-" 'thumbs-resize-image-size-down)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 (define-key map "+" 'thumbs-resize-image-size-up)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766 (define-key map "<" 'thumbs-rotate-left)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 (define-key map ">" 'thumbs-rotate-right)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 (define-key map "e" 'thumbs-emboss-image)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769 (define-key map "r" 'thumbs-resize-interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 (define-key map "s" 'thumbs-save-current-image)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771 (define-key map "q" 'thumbs-kill-buffer)
56934
ff141f26a0cb (thumbs-view-image-mode-map): Fix `thumbs-set-root' command name typo.
John Paul Wallington <jpw@pobox.com>
parents: 55827
diff changeset
772 (define-key map "w" 'thumbs-set-root)
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 map)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774 "Keymap for `thumbs-view-image-mode'.")
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 ;; thumbs-view-image-mode
55827
c5c73c8c2b3e Don't include cl. Don't bother with old Emacs versions.
Richard M. Stallman <rms@gnu.org>
parents: 55221
diff changeset
777 (put 'thumbs-view-image-mode 'mode-class 'special)
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
778 (define-derived-mode thumbs-view-image-mode
56934
ff141f26a0cb (thumbs-view-image-mode-map): Fix `thumbs-set-root' command name typo.
John Paul Wallington <jpw@pobox.com>
parents: 55827
diff changeset
779 fundamental-mode "image-view-mode"
ff141f26a0cb (thumbs-view-image-mode-map): Fix `thumbs-set-root' command name typo.
John Paul Wallington <jpw@pobox.com>
parents: 55827
diff changeset
780 (setq buffer-read-only t))
54186
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
781
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 ;;;###autoload
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783 (defun thumbs-dired-setroot ()
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784 "In dired, Call the setroot program on the image at point."
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785 (interactive)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786 (thumbs-call-setroot-command (dired-get-filename)))
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 ;; Modif to dired mode map
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789 (define-key dired-mode-map "\C-ta" 'thumbs-dired-show-all)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 (define-key dired-mode-map "\C-tm" 'thumbs-dired-show-marked)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791 (define-key dired-mode-map "\C-tw" 'thumbs-dired-setroot)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793 (provide 'thumbs)
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
795 ;;; thumbs.el ends here
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796
5d76d17025c5 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797
54193
318542a275c4 Resolve CVS conflicts
Miles Bader <miles@gnu.org>
parents: 54186
diff changeset
798 ;;; arch-tag: f9ac1ef8-83fc-42c0-8069-1fae43fd2e5c