annotate lisp/tumme.el @ 68757:3c76b1d6eff0

Tried to make docstring less `colloquial'...
author Mathias Dahl <mathias.dahl@gmail.com>
date Thu, 09 Feb 2006 23:08:19 +0000
parents 9c1ca2e3695c
children 86813076a765
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; tumme.el --- use dired to browse and manipulate your images
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;;
68651
3bd95f4f2941 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 68404
diff changeset
3 ;; Copyright (C) 2005, 2006 Free Software Foundation, Inc.
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;;
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
5 ;; Version: 0.4.11
68404
68bc4d872112 Correct the keywords.
Richard M. Stallman <rms@gnu.org>
parents: 67318
diff changeset
6 ;; Keywords: multimedia
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Author: Mathias Dahl <mathias.rem0veth1s.dahl@gmail.com>
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; Boston, MA 02110-1301, USA.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; BACKGROUND
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; ==========
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; I needed a program to browse, organize and tag my pictures. I got
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; tired of the old gallery program I used as it did not allow
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; multi-file operations easily. Also, it put things out of my
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; control. Image viewing programs I tested did not allow multi-file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; operations or did not do what I wanted it to.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; So, I got the idea to use the wonderful functionality of Emacs and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; `dired' to do it. It would allow me to do almost anything I wanted,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; which is basically just to browse all my pictures in an easy way,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; letting me manipulate and tag them in various ways. `dired' already
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; provide all the file handling and navigation facilities; I only
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; needed to add some functions to display the images.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; I briefly tried out thumbs.el, and although it seemed more
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; powerful than this package, it did not work the way I wanted to. It
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; was too slow to created thumbnails of all files in a directory (I
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; currently keep all my 2000+ images in the same directory) and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; browsing the thumbnail buffer was slow too. tumme.el will not
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; create thumbnails until they are needed and the browsing is done
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; quickly and easily in dired. I copied a great deal of ideas and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; code from there though... :)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; About the name: tumme means thumb in Swedish and it is used for
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; working with thumbnails, so... :) If you want to know how to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 ;; pronounce it, go to the page on EmacsWiki and download the .ogg
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; file from there.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;; `tumme' stores the thumbnail files in `tumme-dir' using the file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; name format ORIGNAME.thumb.ORIGEXT. For example
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; ~/.tumme/myimage01.thumb.jpg. The "database" is for now just a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; plain text file with the following format:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 ;; file-name-non-directory;comment:comment-text;tag1;tag2;tag3;...;tagN
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; PREREQUISITES
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; =============
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;; * The ImageMagick package. Currently, `convert' and `mogrify' are
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; used. Find it here: http://www.imagemagick.org.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; * For non-lossy rotation of JPEG images, the JpegTRAN program is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; needed.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; * For `tumme-get-exif-data' and `tumme-write-exif-data' to work,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; the command line tool `exiftool' is needed. It can be found here:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;; http://www.sno.phy.queensu.ca/~phil/exiftool/. These two functions
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;; are, among other things, used for writing comments to image files
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;; using `tumme-thumbnail-set-image-description' and to create
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;; "unique" file names using `tumme-get-exif-file-name' (used by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;; `tumme-copy-with-exif-file-name').
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; USAGE
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;; =====
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;; If you plan to use tumme much, setting up key bindings for it in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;; dired is a good idea:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; (tumme-setup-dired-keybindings)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ;; Next, do M-x tumme-dired RET. This will ask you for a directory
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 ;; where image files are stored, setup a useful window configuration
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 ;; and enable the two special modes that tumme provides. NOTE: If you
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 ;; do not want tumme to split your windows, call it with a prefix
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 ;; argument.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 ;; Start viewing thumbnails by doing C-S-n and C-S-p to go up and down
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 ;; in the dired buffer while at the same time displaying a thumbnail
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 ;; image. The thumbnail images will be created on the fly, and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;; cached. This means that the first time you browse your images, it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; will be a bit slow because the thumbnails are created. If you want
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; to avoid this, you can pre-create the thumbnail images by marking
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; all images in dired (% m \.jpg$ RET) and then do M-x
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;; tumme-create-thumbs.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;; Next, try `tumme-display-thumbs' (C-t d). If no file is marked, a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;; thumbnail for the file at point will show up in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; `tumme-thumbnail-buffer'. If one or more files are marked,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; thumbnails for those files will be displayed.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 ;; Pressing TAB will switch to the window containing the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 ;; `tumme-thumbnail-buffer' buffer. In there you can move between
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ;; thumbnail images and display a semi-sized version in an Emacs
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;; buffer (RET), or the original image in an external viewer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ;; (C-RET). By pressing SPC or DEL you will navigate back and fort
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;; while at the same time displaying each image in Emacs. You can also
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 ;; navigate using arrow keys. Comment a file by pressing "c". Press
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 ;; TAB to get back to dired.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;; While in dired mode, you can tag and comment files, you can tell
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 ;; `tumme' to mark files with a certain tag (using a regexp) etc.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;; The easiest way to see the available commands is to use the Tumme
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 ;; menus added in tumme-thumbnail-mode and dired-mode.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; LIMITATIONS
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 ;; ===========
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 ;; * Supports all image formats that Emacs and convert supports, but
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 ;; the thumbnails are hard-coded to JPEG format.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 ;; * WARNING: The "database" format used might be changed so keep a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 ;; backup of `tumme-db-file' when testing new versions.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 ;;; History:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 ;; ========
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 ;; Version 0.1, 2005-04-16
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 ;; * First release, only browsing support for now.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 ;; Version 0.2, 2005-04-21
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 ;; * Changed calls to dired-filename-at-point to dired-get-filename
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 ;; Version 0.3, 2005-04-25
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 ;; Quite a lot of changes:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 ;; * Added basic image tagging support. No commands that make use of
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 ;; it yet.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ;; * Added text properties for the thumbnail images to be able to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 ;; track where they came from originally. Used in `tumme-mode'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 ;; * Added `tumme-mode' to be used when navigating the thumbnail
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 ;; buffer. Currently, there are commands to mark, unmark, flag and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 ;; jump to the original file in associated dired buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 ;; * When moving around in the thumbnail buffer (in `tumme-mode'), the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 ;; user can turn on tracking of the movements and let them be
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 ;; mirrored in the associated dired buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 ;; * In this version I have been looking at some ideas in thumbs.el,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 ;; for example the image margin and relief and the `thumbs-mode'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 ;; which I copied and made the `tumme-mode' from.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 ;; Version 0.4, 2005-05-02
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 ;; * Renamed the functions that are to be used in `tumme-mode' in the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 ;; thumbnail buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 ;; * The mark, unmark and flag commands in `tumme-mode' now also moves
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 ;; to next thumbnail, like how dired normally works.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ;; * Added `tumme-mode-line-up', `tumme-display-thumbs-append' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ;; `tumme-mode-delete-char'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 ;; * Each thumbnail's tags is now displayed when navigating among the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 ;; thumbnails in the thumbnail buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 ;; * Added simple slideshow functionality.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 ;; Version 0.4.1, 2005-05-05
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 ;; * Fixed bug in `tumme-flag-thumb-original-file'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 ;; * Added commands to display original image in external viewer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 ;; (`tumme-display-external') and in a Emacs buffer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 ;; (`tumme-display-image').
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 ;; * Minor code clean-up
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 ;; * Renamed some functions back again...
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 ;; * Added rotation of thumbnail images (90 degrees left and right)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 ;; Version 0.4.2, 2005-05-06
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 ;; * Removed need for `tumme-display-image-size' in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 ;; `tumme-display-image'. Now, the maximum image size that fits in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 ;; `tumme-display-buffer' is calculated automatically. Introduced
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 ;; two correction variables, `tumme-display-window-width-correction'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 ;; and `tumme-display-window-height-correction' to be used to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 ;; correct width and height depending on width and height of window
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 ;; decorations, fringes etc. This works really well!
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 ;; Version 0.4.3, 2005-05-07
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ;; * Added menus to `dired-mode' and `tumme-mode'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 ;; * Added `tumme-mark-and-display-next'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 ;; * Added `tumme-jump-thumbnail-buffer'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 ;; * Bound TAB in `dired-mode-map' and `tumme-mode-map' to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 ;; `tumme-jump-thumbnail-buffer' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 ;; `tumme-jump-original-dired-buffer', respectively.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 ;; * Changed `tumme-display-image' to be more general. Now, it can be
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 ;; used from both thumbnail buffer and dired buffer by calling
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 ;; `tumme-display-thumbnail-original-image' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 ;; `tumme-display-dired-image', respectively.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 ;; Version 0.4.4, 2005-05-10
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 ;; * Added `tumme-get-exif-file-name' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 ;; `tumme-copy-with-exif-file-name'. These commands might not be
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 ;; useful for all people because they are very specific. See the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 ;; documentation for each function for more information.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 ;; * Added `tumme-display-next-thumbnail-original' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 ;; `tumme-display-previous-thumbnail-original' to be used for easy
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 ;; image browsing in thumbnail buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 ;; * Added support for comments. New function
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 ;; `tumme-comment-thumbnail' added, to be used in thumbnail buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ;; * Added `tumme-mark-tagged-files'. Use it in dired buffer to mark
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ;; tagged files.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 ;; * Added `mouse-face' property `highlight' for mouse highlighting
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 ;; and had to add a space between each thumbnail to avoid whole rows
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 ;; to be highlighted. Doing this meant that I had to update
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 ;; `tumme-line-up' too...
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 ;; * Added `tumme-mouse-display-image'. Use mouse-2 to display image
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 ;; thumbnail when is highlighted.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 ;; * As suggested by Ehud Karni on gnu.emacs.help, changed
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 ;; `tumme-window-DIMENSION-pixels' to use `frame-char-DIMENSION'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 ;; instead of `frame-pixel-DIMENSION'. Feels better
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 ;; * Corrected a bug in `tumme-window-height-pixels'. I did not know
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 ;; that the mode-line consumed one line. Also, after experimenting, it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 ;; seems that the only correction needed for the image display width
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 ;; is one single pixel. I left the corection variables in there, just
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 ;; in case someone has a system that differs.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 ;; Version 0.4.5, 2005-05-19
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 ;; * Added `tumme-line-up-dynamic' that calculates the number of
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 ;; thumbnails that will fit in the thumbnail buffer's window and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 ;; `tumme-line-up-interactive' that asks the user.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 ;; * Changed `tumme-display-thumbs' to call one of the `tumme-line-up'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 ;; functions instead of doing the line-up itself.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 ;; * Finally! Added experimental gallery creation. See customizable
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 ;; variables `tumme-gallery-dir', `tumme-gallery-image-root-url' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 ;; `tumme-gallery-thumb-image-root-url' and new command
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 ;; `tumme-gallery-generate'. Not beatiful, but it works quite
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 ;; well. Probably needs some CSS-stuff in it eventually. Also, I'm not
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 ;; sure this is the way I want to generate my image galleries in the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 ;; future. After all, static pages cannot do what dynamic pages using
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 ;; PHP et al can do. Serves like a proof-of-concept of the tagging
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 ;; though.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 ;; * Added option to hide images with certain tags. See
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 ;; `tumme-gallery-hidden-tags'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 ;; * Added `tumme-tag-thumbnail' for tagging files from thumbnail
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 ;; buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 ;; * Added `tumme-tag-remove' and `tumme-tag-thumbnail-remove' so that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 ;; you can remove tags. Sorry if I have kept you waiting for
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 ;; this... :)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 ;; * Added option `tumme-append-when-browsing' and new command
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 ;; `tumme-toggle-append-browsing'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 ;; Version 0.4.6, 2005-05-21
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 ;; * Changed `tumme-thumb-name' to always use ".jpg" as file extension
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 ;; for thumbnail files, instead of using the extension from the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 ;; original file's name. This was a very easy way to open up for
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 ;; allowing browsing of all image file types that Emacs support,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 ;; assuming ImageMagick supports it too.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 ;; * Fixed bug in `tumme-create-thumb' `tumme-rotate-thumbnail' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 ;; `tumme-display-image' by adding quotes around the file names. The
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 ;; conversion failed if the file name, or path, contained a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 ;; space. Also expanded the file name, as convert (or is it bash?)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 ;; does not work as expected for paths like "~/.tumme...".
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 ;; * Fixed another "space bug" :) in `tumme-display-external'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 ;; * In call to convert, added "jpeg:" in front of the output file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 ;; name, so that all generated files becomes JPEG files. For now, only
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 ;; useful if `tumme-temp-image-file' does not end in .jpg.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 ;; Version 0.4.7, 2005-05-26
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 ;; * Change header line of tumme.el so that it does not wrap and cause
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 ;; evaluation problems for people getting the source from Usenet.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 ;; * Changed `tumme-write-tag' slightly to get better performance when
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 ;; tagging many files.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 ;; * Fixed bug in `tumme-create-gallery-lists' that made it puke if
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 ;; there was empty lines in the database. Changed the code so that it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 ;; does not car about that. Also, fixed `tumme-remove-tag' so that it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 ;; tries not to add empty lines at the end of the database.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 ;; * Changed all commands that execute shell commands to be
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 ;; configurable using the `tumme-cmd-x' custom variables. This makes
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 ;; it easier to switch among different image conversion tools which
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 ;; might use different syntax and options.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 ;; * Added `tumme-toggle-dired-display-properties'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 ;; * Added `tumme-thumb-file-name-format' and changed
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 ;; `tumme-thumb-name' to make it possible to configure the format of
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 ;; thumbnail files. Did not make it customizable yet though. It might
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 ;; be a bad idea to be able to switch between formats...
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 ;; * Changed `tumme-display-window' so that it looks for tumme's
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 ;; display window in all frames. Useful if you want to create an own
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 ;; frame for displaying the temporary image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 ;; * After changing the call to `get-window-with-predicate' to scan
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 ;; all frames for tumme's special buffers in visible windows, and also
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 ;; changing the way tumme tracks thumbnail movement in the dired
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 ;; buffer (now using `set-buffer' together with `set-window-point'),
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 ;; tumme now works quite happily with all three buffers in different
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 ;; frames. This empowers the user to setup the special buffers the way
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 ;; that best fits his need at the time. Jumping between dired and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 ;; `tumme-thumbnail-buffer' work independent on in which frames they
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 ;; are.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 ;; * Renamed `tumme-track-movement-in-dired' to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 ;; `tumme-toggle-movement-tracking'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 ;; * Added `tumme-track-thumbnail' for movement tracking from dired
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 ;; buffer, analoguous to the tracking done in thumbnail buffer. Both
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 ;; uses the same custom variable `tumme-track-movement' which can be
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 ;; toggled on and off with `tumme-toggle-movement-tracking'. This is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 ;; neat. :) Changed `tumme-setup-dired-keybindings' to make use of
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 ;; this in the best way. Read more about this there.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 ;; Version 0.4.8, 2005-06-05
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 ;; * Changed `tumme-display-dired-image' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 ;; `tumme-display-thumbnail-original-image' so that when called with a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 ;; prefix argument, the image is not resized in the display
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 ;; buffer. This will be useful for later additions of image
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 ;; manipulation commands.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 ;; * Added `tumme-kill-buffer-and-window' to make it easy to kill the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 ;; tumme buffers.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 ;; * Renamed `tumme-mode' to `tumme-thumbnail-mode'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 ;; * `tumme-tag-thumbnail' and `tumme-tag-thumbnail-remove' now
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 ;; updates the tags property for the thumbnail.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 ;; * Added `tumme-dired-display-external' to display images in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 ;; external viewer from dired buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 ;; * Added support for multiple files in `tumme-remove-tag' to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 ;; increase performance.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 ;; * Added `tumme-display-image-mode' so that we can add image
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 ;; manipulation commands there.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 ;; * Added call to `tumme-display-thumb-properties' in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 ;; `tumme-track-thumbnail'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 ;; * Added command `tumme-display-current-image-in-full-size' to be
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 ;; used in `tumme-display-image-mode'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
394 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 ;; * Changed `tumme-display-image' to call
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 ;; `tumme-create-display-image-buffer' so that we are sure that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 ;; `tumme-display-image-buffer' is always available.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
398 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 ;; * Added optional prefix argument to `tumme-dired-folder' that tells
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 ;; it to skip the window splitting and just creates the needed
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 ;; buffers.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 ;; * Fixed bug somewhere that relied on `tumme-dired-folder' having
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 ;; created the `tumme-display-image-buffer'. Now `tumme-dired-folder'
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 ;; *should* not be necessary to call at all, just convenient.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 ;; * Added tracking to `tumme-mouse-display-image'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 ;; * Added `tumme-mouse-select-thumbnail' and bound mouse-1 to it, so
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 ;; that selecting a thumbnail will track the original file.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 ;; * Added three new custom variables, `tumme-cmd-ACTION-program' to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 ;; make the command options cleaner and easier to read.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 ;; * Added `tumme-display-properties-format' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
416 ;; `tumme-format-properties-string' to make it possible to configure
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 ;; the display format of the image file's properties.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 ;; * Added missing (require 'format-spec)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 ;; Version 0.4.9, 2005-09-25
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 ;; * Fixed bug in `tumme-display-thumbs'. If a thumbnail file could
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 ;; not be created for some reason (bad file for example), even if
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 ;; several other thumbnails was created sucessfully, the code
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 ;; generated an error and never continued doing the line-up.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 ;; * Made tumme.el pass the M-x checkdoc test, phew!
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 ;; * Added `tumme-rotate-original', `tumme-rotate-original-left' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 ;; `tumme-rotate-original-right' to rotate the original image from
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 ;; thumbnail view. By default it uses JpegTRAN to rotate the images
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 ;; non-lossy. Only works on JPEG images. The two new commands were
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 ;; added to thumbnail mode. Thanks to Colin Marquardt who told me
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 ;; about the "-copy all" option to jpegtran.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 ;; * Added the functions `tumme-get-exif-data' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 ;; `tumme-set-exif-data' for reading and writing EXIF data to image files.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 ;; * Rewrote `tumme-get-exif-file-name': now uses
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 ;; `tumme-get-exif-data'. Slight change to replace spaces with
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 ;; underscores (tt seems not all cameras use the exact same format for
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 ;; DateTimeOriginal). Added code for handling files that has no
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 ;; EXIF-data (use file's timestamp instead).
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 ;; * Changed from using the exif program to exiftool because exiftool
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 ;; also handles writing of EXIF data, which is very useful.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 ;; * Added the command `tumme-thumbnail-set-image-description' that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 ;; can be used to set the EXIF tag ImageDescription. Thanks to Colin
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 ;; Marquardt for the suggestion.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 ;; * Added `tumme-toggle-mark-thumb-original-file' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 ;; `tumme-mouse-toggle-mark' and changed
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 ;; `tumme-modify-mark-on-thumb-original-file' to support toggling of
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 ;; mark of original image file in dired, from
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 ;; `tumme-thumbnail-mode'. Bound C-down-mouse-1
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 ;; `tumme-mouse-toggle-mark' to in `tumme-thumbnail-mode'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 ;; * Changed `tumme-mouse-select-thumbnail' to also display properties
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 ;; after the file is selected.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 ;; Version 0.4.10, 2005-11-07
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 ;; * Renamed `tumme-dired-folder' to `tumme-dired'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 ;; * Changed format of the database file slightly, now the full path
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 ;; and file name is used. Had to change most of the tag functions
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 ;; (writing, reading, searching) slightly to cope with the change. If
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 ;; you are an old tumme user, you have to update your database
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 ;; manually, probably you only need to prefix all rows with a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 ;; directory name to get the full path and file name.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 ;; * Removed `tumme-thumb-file-name-format'. Added
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 ;; `tumme-thumbnail-storage' and changed `tumme-thumb-name' to provide
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 ;; two different thumbnail storage schemes. It is no longer necessary
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 ;; to have unique image file names to use tumme fully.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 ;; * As a consequence of the above, gallery generation is currently
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 ;; not supported if per-directory thumbnail file storage is used.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 ;; * Changed parameters to `tumme-create-thumb'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 ;; * To be included in Emacs 22.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 ;;
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
487 ;; Version 0.4.11, 2006-MM-DD
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
488 ;;
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
489 ;; * Changed `tumme-display-thumbs' so that it calls `display-buffer'
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
490 ;; after generating the thumbnails and changed
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
491 ;; `tumme-display-thumbnail-original-image' to display the image
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
492 ;; buffer. These small changes should make it easier for a user to
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
493 ;; start using tumme.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
494 ;;
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
495 ;; * Added `tumme-show-all-from-dir' to mimic thumbs.el's easy-to-use
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
496 ;; `thumbs' command. A new customize option,
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
497 ;; `tumme-show-all-from-dir-max-files' was added too.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
498 ;;
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
499 ;; * Renamed `tumme-dired' to `tumme-dired-with-window-configuration'
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
500 ;; and added code to save the window configuration before messing it
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
501 ;; up. The saved window configuration can be restored using the new
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
502 ;; command `tumme-restore-window-configuration'.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
503 ;;
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
504 ;; * Added `tumme-get-thumbnail-image', created by Chong Yidong. His
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
505 ;; own comments: ..., that just takes the original filename and
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
506 ;; returns a thumbnail image descriptor. Then third-party libraries
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
507 ;; won't have to muck around with tumme.el's internal functions like
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
508 ;; `thumme-thumb-name', `tumme-create-thumb', etc. His code to get
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
509 ;; speedbar display tumme thumbnails, might be integrated soon.
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 ;; TODO
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 ;; ====
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 ;; * Support gallery creation when using per-directory thumbnail
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 ;; storage.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 ;; * Some sort of auto-rotate function based on rotate info in the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 ;; EXIF data.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 ;; * Check if exiftool exist before trying to call it to give a better
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 ;; error message.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 ;; * Investigate if it is possible to also write the tags to the image
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 ;; files.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 ;; * From thumbs.el: Add an option for clean-up/max-size functionality
68754
9c1ca2e3695c Added a few todo items.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68682
diff changeset
527 ;; for thumbnail directory.
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 ;; * From thumbs.el: Add setroot function.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 ;;
68754
9c1ca2e3695c Added a few todo items.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68682
diff changeset
531 ;; * From thumbs.el: Add image resizing, if useful (tumme's automatic
9c1ca2e3695c Added a few todo items.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68682
diff changeset
532 ;; "image fit" might be enough)
9c1ca2e3695c Added a few todo items.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68682
diff changeset
533 ;;
9c1ca2e3695c Added a few todo items.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68682
diff changeset
534 ;; * From thumbs.el: Add the "modify" commands (emboss, negate,
9c1ca2e3695c Added a few todo items.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68682
diff changeset
535 ;; monochrome etc).
9c1ca2e3695c Added a few todo items.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68682
diff changeset
536 ;;
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 ;; * Asynchronous creation of thumbnails.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 ;; * Add `tumme-display-thumbs-ring' and functions to cycle that. Find
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 ;; out which is best, saving old batch just before inserting new, or
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 ;; saving the current batch in the ring when inserting it. Adding it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 ;; probably needs rewriting `tumme-display-thumbs' to be more general.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 ;; * Find some way of toggling on and off really nice keybindings in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 ;; dired (for example, using C-n or <down> instead of C-S-n). Richard
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 ;; suggested that we could keep C-t as prefix for tumme commands as it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 ;; is currently not used in dired. He also suggested that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 ;; `dired-next-line' and `dired-previous-line' figure out if tumme is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 ;; enabled in the current buffer and, if it is, call
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 ;; `tumme-dired-next-line' and `tumme-dired-previous-line',
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 ;; respectively.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 ;; * Enhanced gallery creation with basic CSS-support and pagination
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 ;; of tag pages with many pictures.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 ;; * Rewrite `tumme-modify-mark-on-thumb-original-file' to be less
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 ;; ugly.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 ;; * In some way keep track of buffers and windows and stuff so that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 ;; it works as the user expects.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 ;; * More/better documentation
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 ;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 ;;; Code:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (require 'dired)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 (require 'format-spec)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (defgroup tumme nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 "Use dired to browse your images as thumbnails, and more."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 :prefix "tumme-"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 :group 'files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 (defcustom tumme-dir "~/.tumme/"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 "*Directory where thumbnail images for are stored."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 (defcustom tumme-thumbnail-storage 'use-tumme-dir
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 "*How to store tumme's thumbnail files.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 Tumme can store thumbnail files in one of two ways and this is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 controlled by this variable. \"Use tumme dir\" means that the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 thumbnails are stored in a central directory. \"Per directory\"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 means that each thumbnail is stored in a subdirectory called
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 \".tumme\" in the same directory where the image file is."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 :type '(choice :tag "How to store thumbnail files"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 (const :tag "Use tumme-dir" use-tumme-dir)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 (const :tag "Per-directory" per-directory))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 (defcustom tumme-db-file "~/.tumme/.tumme_db"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 "*Database file where file names and their associated tags are stored."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 (defcustom tumme-temp-image-file "~/.tumme/.tumme_temp"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 "*Name of temporary image file used by various commands."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 (defcustom tumme-gallery-dir "~/.tumme/.tumme_gallery"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 "*Directory to store generated gallery html pages.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 This path needs to be \"shared\" to the public so that it can access
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 the index.html page that tumme creates."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 (defcustom tumme-gallery-image-root-url
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 "http://your.own.server/tummepics"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 "*URL where the full size images are to be found.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 Note that this path has to be configured in your web server. Tumme
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 expects to find pictures in this directory."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 (defcustom tumme-gallery-thumb-image-root-url
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 "http://your.own.server/tummethumbs"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 "*URL where the thumbnail images are to be found.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 Note that this path has to be configured in your web server. Tumme
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 expects to find pictures in this directory."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625 (defcustom tumme-cmd-create-thumbnail-program
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 "convert"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 "*Executable used to create thumbnail.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 Used together with `tumme-cmd-create-thumbnail-options'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 (defcustom tumme-cmd-create-thumbnail-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 "%p -size %sx%s \"%f\" -resize %sx%s +profile \"*\" jpeg:\"%t\""
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 "*Format of command used to create thumbnail image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 Available options are %p which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 `tumme-cmd-create-thumbnail-program', %s which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 `tumme-thumb-size', %f which is replaced by the file name of the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 original image and %t which is replaced by the file name of the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 thumbnail file."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (defcustom tumme-cmd-create-temp-image-program
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 "convert"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 "*Executable used to create temporary image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 Used together with `tumme-cmd-create-temp-image-options'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 (defcustom tumme-cmd-create-temp-image-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 "%p -size %xx%y \"%f\" -resize %xx%y +profile \"*\" jpeg:\"%t\""
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 "*Format of command used to create temporary image for display window.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 Available options are %p which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 `tumme-cmd-create-temp-image-program', %x and %y which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 the calculated max size for x and y in the image display window, %f
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 which is replaced by the file name of the original image and %t which
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 is replaced by the file name of the temporary file."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 (defcustom tumme-cmd-rotate-thumbnail-program
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 "mogrify"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 "*Executable used to rotate thumbnail.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 Used together with `tumme-cmd-rotate-thumbnail-options'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 (defcustom tumme-cmd-rotate-thumbnail-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 "%p -rotate %d \"%t\""
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 "*Format of command used to rotate thumbnail image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 Available options are %p which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 `tumme-cmd-rotate-thumbnail-program', %d which is replaced by the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 number of (positive) degrees to rotate the image, normally 90 or 270
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 \(for 90 degrees right and left), %t which is replaced by the file name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 of the thumbnail file."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (defcustom tumme-cmd-rotate-original-program
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 "jpegtran"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 "*Executable used to rotate original image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 Used together with `tumme-cmd-rotate-original-options'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 (defcustom tumme-cmd-rotate-original-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 "%p -rotate %d -copy all \"%o\" > %t"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 "*Format of command used to rotate original image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 Available options are %p which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 `tumme-cmd-rotate-original-program', %d which is replaced by the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 number of (positive) degrees to rotate the image, normally 90 or
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 270 \(for 90 degrees right and left), %o which is replaced by the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 original image file name and %t which is replaced by
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
694 `tumme-temp-image-file'."
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 (defcustom tumme-temp-rotate-image-file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 "~/.tumme/.tumme_rotate_temp"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 "*Temporary file for rotate operations."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 (defcustom tumme-rotate-original-ask-before-overwrite t
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 "Confirm overwrite of original file after rotate operation.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 If non-nil, ask user for confirmation before overwriting the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 original file with `tumme-temp-rotate-image-file'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 :type 'boolean
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 (defcustom tumme-cmd-write-exif-data-program
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 "exiftool"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 "*Program used to write EXIF data to image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 Used together with `tumme-cmd-write-exif-data-options'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (defcustom tumme-cmd-write-exif-data-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 "%p -%t=\"%v\" \"%f\""
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 "*Format of command used to write EXIF data.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 Available options are %p which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 `tumme-cmd-write-exif-data-program', %f which is replaced by the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 image file name, %t which is replaced by the tag name and %v
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 which is replaced by the tag value."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 (defcustom tumme-cmd-read-exif-data-program
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 "exiftool"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 "*Program used to read EXIF data to image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 Used together with `tumme-cmd-read-exif-data-program-options'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 (defcustom tumme-cmd-read-exif-data-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 "%p -s -s -s -%t \"%f\""
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 "*Format of command used to read EXIF data.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 Available options are %p which is replaced by
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 `tumme-cmd-write-exif-data-options', %f which is replaced
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 by the image file name and %t which is replaced by the tag name."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 (defcustom tumme-gallery-hidden-tags
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 (list "private" "hidden" "pending")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746 "*List of \"hidden\" tags.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 Used by `tumme-gallery-generate' to leave out \"hidden\" images."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748 :type '(repeat string)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751 (defcustom tumme-thumb-size 100
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 "Size of thumbnails, in pixels."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 :type 'integer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756 (defcustom tumme-thumb-relief 2
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 "*Size of button-like border around thumbnails."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758 :type 'integer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 (defcustom tumme-thumb-margin 2
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 "*Size of the margin around thumbnails.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 This is where you see the cursor."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764 :type 'integer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 (defcustom tumme-line-up-method 'dynamic
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 "*Default method for line-up of thumbnails in thumbnail buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769 Used by `tumme-display-thumbs' and other functions that needs to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 line-up thumbnails. Dynamic means to use the available width of the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771 window containing the thumbnail buffer, Fixed means to use
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772 `tumme-thumbs-per-row', Interactive is for asking the user, and No
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 line-up means that no automatic line-up will be done."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774 :type '(choice :tag "Default line-up method"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775 (const :tag "Dynamic" dynamic)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 (const :tag "Fixed" fixed)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
777 (const :tag "Interactive" interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
778 (const :tag "No line-up" none))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
779 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
780
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
781 (defcustom tumme-thumbs-per-row 3
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 "*Number of thumbnails to display per row in thumb buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783 :type 'integer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786 (defcustom tumme-display-window-width-correction 1
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
787 "*Number to be used to correct image display window width.
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 Change if the default (1) does not work (i.e. if the image does not
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789 completely fit)."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 :type 'integer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793 (defcustom tumme-display-window-height-correction 0
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794 "*Number to be used to correct image display window height.
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
795 Change if the default (0) does not work (i.e. if the image does not
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796 completely fit)."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797 :type 'integer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
798 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 (defcustom tumme-track-movement nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
801 "The current state of the tracking and mirroring.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 For more information, see the documentation for
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803 `tumme-toggle-movement-tracking'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804 :type 'boolean
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807 (defcustom tumme-append-when-browsing nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
808 "Append thumbnails in thumbnail buffer when browsing.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
809 If non-nil, using `tumme-next-line-and-display' and
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
810 `tumme-previous-line-and-display' will leave a trail of thumbnail
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
811 images in the thumbnail buffer. If you enable this and want to clean
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
812 the thumbnail buffer because it is filled with too many thumbmnails,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
813 just call `tumme-display-thumb' to display only the image at point.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
814 This value can be toggled using `tumme-toggle-append-browsing'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
815 :type 'boolean
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
816 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
817
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
818 (defcustom tumme-dired-disp-props t
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
819 "If non-nil, display properties for dired file when browsing.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
820 Used by `tumme-next-line-and-display',
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
821 `tumme-previous-line-and-display' and `tumme-mark-and-display-next'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
822 If the database file is large, this can slow down image browsing in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823 dired and you might want to turn it off."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824 :type 'boolean
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
825 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
826
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
827 (defcustom tumme-display-properties-format "%b: %f (%t): %c"
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
828 "*Display format for thumbnail properties.
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
829 %b is replaced with associated dired buffer name, %f with file name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
830 \(without path) of original image file, %t with the list of tags and %c
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831 with the comment."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
832 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
833 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
834
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
835 (defcustom tumme-external-viewer "qiv -t"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
836 "*Name of external viewer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
837 Including parameters. Used when displaying original image from
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
838 `tumme-thumbnail-mode'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
840 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 (defcustom tumme-main-image-directory "~/pics/"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843 "*Name of main image directory, if any.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 Used by `tumme-copy-with-exif-file-name'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 :type 'string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846 :group 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
848 (defcustom tumme-show-all-from-dir-max-files 50
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
849 "*Maximum number of files to show using`tumme-show-all-from-dir'.
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
850 before warning the user."
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
851 :type 'integer
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
852 :group 'tumme)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
853
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854 (defun tumme-insert-image (file type relief margin)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855 "Insert image FILE of image TYPE, using RELIEF and MARGIN, at point."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 (let ((i `(image :type ,type
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 :file ,file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 :relief ,relief
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 :margin ,margin)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861 (insert-image i)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
863 (defun tumme-get-thumbnail-image (file)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
864 "Return the image descriptor for a thumbnail of image file FILE."
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
865 (unless (string-match (image-file-name-regexp) file)
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
866 (error "%s is not a valid image file" file))
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
867 (let ((thumb-file (tumme-thumb-name file)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
868 (unless (and (file-exists-p thumb-file)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
869 (<= (float-time (nth 5 (file-attributes file)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
870 (float-time (nth 5 (file-attributes thumb-file)))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
871 (tumme-create-thumb file thumb-file))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
872 (list 'image :type 'jpeg :file thumb-file
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
873 :relief tumme-thumb-relief :margin tumme-thumb-margin)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
874
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
875 (defun tumme-insert-thumbnail (file original-file-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
876 associated-dired-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
877 "Insert thumbnail image FILE.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878 Add text properties ORIGINAL-FILE-NAME and ASSOCIATED-DIRED-BUFFER."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
879 (let (beg end)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880 (setq beg (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
881 (tumme-insert-image file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
882 'jpeg
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
883 tumme-thumb-relief
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
884 tumme-thumb-margin)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
885 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
886 (add-text-properties
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
887 beg end
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
888 (list 'tumme-thumbnail t
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
889 'original-file-name original-file-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
890 'associated-dired-buffer associated-dired-buffer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
891 'tags (tumme-list-tags original-file-name)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892 'mouse-face 'highlight
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
893 'comment (tumme-get-comment original-file-name)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
894
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
895 (defun tumme-thumb-name (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
896 "Return thumbnail file name for FILE.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
897 Depending on the value of `tumme-thumbnail-storage', the file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898 name will vary. For central thumbnail file storage, make a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
899 MD5-hash of the image file's directory name and add that to make
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
900 the thumbnail file name unique. For per-directory storage, just
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 add a subdirectory."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
902 (let ((f (expand-file-name file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
903 md5-hash)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
904 (format "%s%s%s.thumb.%s"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
905 (cond ((eq 'use-tumme-dir tumme-thumbnail-storage)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
906 ;; Is MD5 hashes fast enough? The checksum of a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
907 ;; thumbnail file name need not be that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
908 ;; "cryptographically" good so a faster one could
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
909 ;; be used here.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
910 (setq md5-hash (md5 (file-name-as-directory
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
911 (file-name-directory file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
912 (file-name-as-directory (expand-file-name tumme-dir)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
913 ((eq 'per-directory tumme-thumbnail-storage)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
914 (format "%s.tumme/"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
915 (file-name-directory f))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
916 (file-name-sans-extension
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
917 (file-name-nondirectory f))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
918 (if md5-hash
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
919 (concat "_" md5-hash)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
920 "")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
921 (file-name-extension f))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
922
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
923 (defun tumme-create-thumb (original-file thumbnail-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
924 "For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
925 (let* ((size (int-to-string tumme-thumb-size))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
926 (command
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
927 (format-spec
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
928 tumme-cmd-create-thumbnail-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
929 (list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
930 (cons ?p tumme-cmd-create-thumbnail-program)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
931 (cons ?s size)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
932 (cons ?f original-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
933 (cons ?t thumbnail-file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
934 thumbnail-dir)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
935 (when (not (file-exists-p
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
936 (setq thumbnail-dir (file-name-directory thumbnail-file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
937 (message "Creating thumbnail directory.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
938 (make-directory thumbnail-dir))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
939 (shell-command command nil)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
940
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
941 (defun tumme-next-line-and-display ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
942 "Move to next dired line and display thumbnail image."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
943 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
944 (dired-next-line 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
945 (tumme-display-thumbs
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
946 t (or tumme-append-when-browsing nil))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
947 (if tumme-dired-disp-props
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
948 (tumme-dired-display-properties)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
949
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
950 (defun tumme-previous-line-and-display ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
951 "Move to previous dired line and display thumbnail image."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
952 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
953 (dired-previous-line 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
954 (tumme-display-thumbs
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
955 t (or tumme-append-when-browsing nil))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
956 (if tumme-dired-disp-props
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
957 (tumme-dired-display-properties)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
958
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
959 (defun tumme-toggle-append-browsing ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
960 "Toggle `tumme-append-when-browsing'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
961 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
962 (setq tumme-append-when-browsing
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
963 (not tumme-append-when-browsing))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
964 (message "Append browsing %s."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
965 (if tumme-append-when-browsing
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
966 "on"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
967 "off")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969 (defun tumme-mark-and-display-next ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970 "Mark current file in dired and display next thumbnail image."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972 (dired-mark 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
973 (tumme-display-thumbs
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974 t (or tumme-append-when-browsing nil))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
975 (if tumme-dired-disp-props
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
976 (tumme-dired-display-properties)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
977
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
978 (defun tumme-toggle-dired-display-properties ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
979 "Toggle `tumme-dired-disp-props'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
980 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
981 (setq tumme-dired-disp-props
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
982 (not tumme-dired-disp-props))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
983 (message "Dired display properties %s."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
984 (if tumme-dired-disp-props
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
985 "on"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
986 "off")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
987
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988 (defvar tumme-thumbnail-buffer "*tumme*"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
989 "Tumme's thumbnail buffer.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
990
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
991 (defun tumme-create-thumbnail-buffer ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
992 "Create thumb buffer and set `tumme-thumbnail-mode'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
993 (let ((buf (get-buffer-create tumme-thumbnail-buffer)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
994 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
995 (set-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996 (setq buffer-read-only t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997 (if (not (eq major-mode 'tumme-thumbnail-mode))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998 (tumme-thumbnail-mode)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 buf))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1001 (defvar tumme-display-image-buffer "*tumme-display-image*"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1002 "Where larger versions of the images are display.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1004 (defun tumme-create-display-image-buffer ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005 "Create image display buffer and set `tumme-display-image-mode'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1006 (let ((buf (get-buffer-create tumme-display-image-buffer)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1007 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1008 (set-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1009 (setq buffer-read-only t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1010 (if (not (eq major-mode 'tumme-display-image-mode))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1011 (tumme-display-image-mode)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1012 buf))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1013
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1014 (defvar tumme-saved-window-configuration nil
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1015 "Saved window configuration.")
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1016
68404
68bc4d872112 Correct the keywords.
Richard M. Stallman <rms@gnu.org>
parents: 67318
diff changeset
1017 ;;;###autoload
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1018 (defun tumme-dired-with-window-configuration (dir &optional arg)
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1019 "Open directory DIR and create a default window configuration.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1020
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1021 Convenience command that:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1022
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 - Opens dired in folder DIR
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1024 - Splits windows in most useful (?) way
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1025 - Set `truncate-lines' to t
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1026
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1027 After the command has finished, you would typically mark some
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
1028 image files in dired and type
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
1029 \\[tumme-display-thumbs] (`tumme-display-thumbs').
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1030
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1031 If called with prefix argument ARG, skip splitting of windows.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1032
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1033 The current window configuration is saved and can be restored by
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1034 calling `tumme-restore-window-configuration'."
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1035 (interactive "DDirectory: \nP")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1036 (let ((buf (tumme-create-thumbnail-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1037 (buf2 (tumme-create-display-image-buffer)))
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1038 (setq tumme-saved-window-configuration
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1039 (current-window-configuration))
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1040 (dired dir)
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1041 (delete-other-windows)
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1042 (when (not arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1043 (split-window-horizontally)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1044 (setq truncate-lines t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1045 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1046 (other-window 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1047 (switch-to-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1048 (split-window-vertically)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1049 (other-window 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1050 (switch-to-buffer buf2)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1051 (other-window -2)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1052
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1053 (defun tumme-restore-window-configuration ()
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1054 "Restore window configuration.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1055 Restore any changes to the window configuration made by calling
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
1056 `tumme-dired-with-window-configuration'."
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1057 (interactive)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1058 (if tumme-saved-window-configuration
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1059 (set-window-configuration tumme-saved-window-configuration)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1060 (message "No saved window configuration")))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1061
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1062 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1063 (defun tumme-display-thumbs (&optional arg append)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1064 "Display thumbnails of all marked files, in `tumme-thumbnail-buffer'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1065 If a thumbnail image does not exist for a file, it is created on the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1066 fly. With prefix argument ARG, display only thumbnail for file at
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1067 point (this is useful if you have marked some files but want to show
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1068 another one).
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1069
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1070 Recommended usage is to split the current frame horizontally so that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1071 you have the dired buffer in the left window and the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1072 `tumme-thumbnail-buffer' buffer in the right window.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1073
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1074 With optional argument APPEND, append thumbnail to thumbnail buffer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1075 instead of erasing it first."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1076 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1077 (let ((buf (tumme-create-thumbnail-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1078 curr-file thumb-name files count dired-buf beg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1079 (if arg
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1080 (setq files (list (dired-get-filename)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1081 (setq files (dired-get-marked-files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1082 (setq dired-buf (current-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1083 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1084 (set-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1085 (let ((inhibit-read-only t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1086 (if (not append)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1087 (erase-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1088 (goto-char (point-max)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1089 (mapcar
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1090 (lambda (curr-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1091 (setq thumb-name (tumme-thumb-name curr-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1092 (if (and (not (file-exists-p thumb-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1093 (not (= 0 (tumme-create-thumb curr-file thumb-name))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094 (message "Thumb could not be created for file %s" curr-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1095 (tumme-insert-thumbnail thumb-name curr-file dired-buf)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1096 files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1097 (cond ((eq 'dynamic tumme-line-up-method)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1098 (tumme-line-up-dynamic))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1099 ((eq 'fixed tumme-line-up-method)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1100 (tumme-line-up))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1101 ((eq 'interactive tumme-line-up-method)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1102 (tumme-line-up-interactive))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1103 ((eq 'none tumme-line-up-method)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1104 nil)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1105 (t
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1106 (tumme-line-up-dynamic))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1107 (pop-to-buffer tumme-thumbnail-buffer)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1108
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1109 (defun tumme-show-all-from-dir (dir)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1110 "Make a preview buffer for all images in DIR and display it.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1111 If the number of files in DIR matching `image-file-name-regexp'
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1112 exceeds `tumme-show-all-from-dir-max-files', a warning will be
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1113 displayed."
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1114 (interactive "DDir: ")
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1115 (dired dir)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1116 (dired-mark-files-regexp (image-file-name-regexp))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1117 (let ((files (dired-get-marked-files)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1118 (if (or (<= (length files) tumme-show-all-from-dir-max-files)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1119 (and (> (length files) tumme-show-all-from-dir-max-files)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1120 (y-or-n-p
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1121 (format
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
1122 "Directory contains more than %d image files. Proceed? "
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1123 tumme-show-all-from-dir-max-files))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1124 (progn
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1125 (tumme-display-thumbs)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1126 (pop-to-buffer tumme-thumbnail-buffer))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1127 (message "Cancelled."))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1128
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1129 ;;;###autoload
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
1130 (defalias 'tumme 'tumme-show-all-from-dir)
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1131
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1132 (defun tumme-write-tag (files tag)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1133 "For all FILES, writes TAG to the image database."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1134 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1135 (let (end buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1136 (setq buf (find-file tumme-db-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1137 (if (not (listp files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1138 (if (stringp files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1139 (setq files (list files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1140 (error "Files must be a string or a list of strings!")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1141 (mapcar
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1142 (lambda (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1143 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1144 (if (search-forward-regexp
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1145 (format "^%s" file) nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1146 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1147 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1148 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1149 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1150 (if (not (search-forward (format ";%s" tag) end t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1151 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1152 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1153 (insert (format ";%s" tag)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1154 (goto-char (point-max))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1155 (insert (format "\n%s;%s" file tag))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1156 files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1157 (save-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1158 (kill-buffer buf))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1159
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1160 (defun tumme-remove-tag (files tag)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1161 "For all FILES, remove TAG from the image database."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1162 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1163 (let (end buf start)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1164 (setq buf (find-file tumme-db-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1165 (if (not (listp files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1166 (if (stringp files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1167 (setq files (list files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1168 (error "Files must be a string or a list of strings!")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1169 (mapcar
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1170 (lambda (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1171 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172 (if (search-forward-regexp
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1173 (format "^%s" file) nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1174 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1175 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1176 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1177 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1178 (if (search-forward-regexp (format "\\(;%s\\)" tag) end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1179 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1180 (delete-region (match-beginning 1) (match-end 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1181 ;; Check if file should still be in the database. If
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1182 ;; it has no tags or comments, it will be removed.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1183 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1184 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1185 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1186 (if (not (search-forward ";" end t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1187 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1188 (kill-line 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1189 ;; If on empty line at end of buffer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1190 (if (and (eobp)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1191 (looking-at "^$"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1192 (delete-backward-char 1)))))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1193 files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1194 (save-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1195 (kill-buffer buf))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1196
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1197 (defun tumme-list-tags (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1198 "Read all tags for image FILE from the image database."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1199 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1200 (let (end buf (tags ""))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1201 (setq buf (find-file tumme-db-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1202 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1203 (if (search-forward-regexp
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1204 (format "^%s" file) nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1205 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1206 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1207 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1208 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1209 (if (search-forward ";" end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1210 (if (search-forward "comment:" end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1211 (if (search-forward ";" end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1212 (setq tags (buffer-substring (point) end)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1213 (setq tags (buffer-substring (point) end))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1214 (kill-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1215 (split-string tags ";"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1216
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
1217 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1218 (defun tumme-tag-files (arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1219 "Tag marked file(s) in dired. With prefix ARG, tag file at point."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1220 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1221 (let ((tag (read-string "Tag to add: "))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1222 curr-file files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1223 (if arg
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1224 (setq files (dired-get-filename))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1225 (setq files (dired-get-marked-files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1226 (tumme-write-tag files tag)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1227
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1228 (defun tumme-tag-thumbnail ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1229 "Tag current thumbnail."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1230 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1231 (let ((tag (read-string "Tag to add: ")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 (tumme-write-tag (tumme-original-file-name) tag))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233 (tumme-update-property
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1234 'tags (tumme-list-tags (tumme-original-file-name))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1235
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
1236 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1237 (defun tumme-tag-remove (arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1238 "Remove tag for selected file(s).
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1239 With prefix argument ARG, remove tag from file at point."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1240 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1241 (let ((tag (read-string "Tag to remove: "))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1242 files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1243 (if arg
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 (setq files (list (dired-get-filename)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1245 (setq files (dired-get-marked-files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1246 (tumme-remove-tag files tag)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1247
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1248 (defun tumme-tag-thumbnail-remove ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1249 "Remove tag from thumbnail."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1250 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1251 (let ((tag (read-string "Tag to remove: ")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1252 (tumme-remove-tag (tumme-original-file-name) tag))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1253 (tumme-update-property
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1254 'tags (tumme-list-tags (tumme-original-file-name))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1255
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1256 (defun tumme-original-file-name ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1257 "Get original file name for thumbnail or display image at point."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1258 (get-text-property (point) 'original-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1259
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1260 (defun tumme-associated-dired-buffer ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1261 "Get associated dired buffer at point."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1262 (get-text-property (point) 'associated-dired-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1264 (defun tumme-get-buffer-window (buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265 "Return window where buffer BUF is."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1266 (get-window-with-predicate
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1267 (lambda (window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1268 (equal (window-buffer window) buf))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1269 nil t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1270
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1271 (defun tumme-track-original-file ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1272 "Track the original file in the associated dired buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1273 See documentation for `tumme-toggle-movement-tracking'. Interactive
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1274 use only useful if `tumme-track-movement' is nil."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1275 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1276 (let ((old-buf (current-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1277 (dired-buf (tumme-associated-dired-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1278 (file-name (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 (if (and dired-buf file-name)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1281 (setq file-name (file-name-nondirectory file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282 (set-buffer dired-buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284 (if (not (search-forward file-name nil t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 (message "Could not track file")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1286 (dired-move-to-filename)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1287 (set-window-point
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288 (tumme-get-buffer-window dired-buf) (point)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 (set-buffer old-buf)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1290
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1291 (defun tumme-toggle-movement-tracking ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1292 "Turn on and off `tumme-track-movement'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293 Tracking of the movements between thumbnail and dired buffer so that
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1294 they are \"mirrored\" in the dired buffer. When this is on, moving
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 around in the thumbnail or dired buffer will find the matching
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296 position in the other buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1298 (setq tumme-track-movement (not tumme-track-movement))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1299 (message "Tracking %s" (if tumme-track-movement "on" "off")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1300
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1301 (defun tumme-track-thumbnail ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1302 "Track current dired file's thumb in `tumme-thumbnail-buffer'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1303 This is almost the same as what `tumme-track-original-file' does, but
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1304 the other way around."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1305 (let ((file (dired-get-filename))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1306 (old-buf (current-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1307 prop-val found)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1308 (if (get-buffer tumme-thumbnail-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1309 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1310 (set-buffer tumme-thumbnail-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1311 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1312 (while (and (not (eobp))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1313 (not found))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1314 (if (and (setq prop-val
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1315 (get-text-property (point) 'original-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1316 (string= prop-val file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1317 (setq found t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1318 (if (not found)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1319 (forward-char 1)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320 (if found
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1322 (set-window-point
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1323 (tumme-thumbnail-window) (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1324 (tumme-display-thumb-properties)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1325 (set-buffer old-buf)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1326
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1327 (defun tumme-dired-next-line (&optional arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1328 "Call `dired-next-line', then track thumbnail.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1329 This can safely replace `dired-next-line'. With prefix argument, move
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1330 ARG lines."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1331 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1332 (dired-next-line (or arg 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1334 (tumme-track-thumbnail)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1335
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1336 (defun tumme-dired-previous-line (&optional arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1337 "Call `dired-previous-line', then track thumbnail.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1338 This can safely replace `dired-previous-line'. With prefix argument,
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339 move ARG lines."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1340 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1341 (dired-previous-line (or arg 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343 (tumme-track-thumbnail)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1344
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1345 (defun tumme-forward-char ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1346 "Move to next image and display properties."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1347 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1348 ;; Before we move, make sure that there is an image two positions
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1349 ;; forward.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1350 (if (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1351 (forward-char 2)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1352 (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1353 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1354 (forward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1355 (while (and (not (eobp))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1356 (not (tumme-image-at-point-p)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1357 (forward-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1358 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1359 (tumme-track-original-file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1360 (tumme-display-thumb-properties))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1361
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1362 (defun tumme-backward-char ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1363 "Move to previous image and display properties."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1364 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1365 (if (not (bobp))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1366 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1367 (backward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1368 (while (and (not (bobp))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1369 (not (tumme-image-at-point-p)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1370 (backward-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1371 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1372 (tumme-track-original-file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1373 (tumme-display-thumb-properties))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1374
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1375 (defun tumme-next-line ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1376 "Move to next line and display properties."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1377 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378 (next-line 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1379 ;; If we end up in an empty spot, back up to the next thumbnail.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380 (if (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1381 (tumme-backward-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1382 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1383 (tumme-track-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1384 (tumme-display-thumb-properties))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1385
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1386
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1387 (defun tumme-previous-line ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1388 "Move to previous line and display properties."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1389 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1390 (previous-line 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1391 ;; If we end up in an empty spot, back up to the next
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1392 ;; thumbnail. This should only happen if the user deleted a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1393 ;; thumbnail and did not refresh, so it is not very common. But we
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1394 ;; can handle it in a good manner, so why not?
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1395 (if (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1396 (tumme-backward-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1397 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1398 (tumme-track-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1399 (tumme-display-thumb-properties))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1400
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1401 (defun tumme-format-properties-string (buf file props comment)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1402 "Format display properties.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1403 BUF is the associated dired buffer, FILE is the original image file
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
1404 name, PROPS is a list of tags and COMMENT is the image files's
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1405 comment."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1406 (format-spec
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1407 tumme-display-properties-format
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1408 (list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1409 (cons ?b buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1410 (cons ?f file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1411 (cons ?t (or (princ props) ""))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1412 (cons ?c (or comment "")))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1414 (defun tumme-display-thumb-properties ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1415 "Display thumbnail properties in the echo area."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416 (if (not (eobp))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1417 (let ((file-name (file-name-nondirectory (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1418 (dired-buf (buffer-name (tumme-associated-dired-buffer)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1419 (props (mapconcat
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1420 'princ
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1421 (get-text-property (point) 'tags)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1422 ", "))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1423 (comment (get-text-property (point) 'comment)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1424 (if file-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1425 (message
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1426 (tumme-format-properties-string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1427 dired-buf
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1428 file-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1429 props
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1430 comment))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1431
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1432 (defun tumme-dired-file-marked-p ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1433 "Check whether file on current line is marked or not."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1434 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1435 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1436 (not (looking-at "^ .*$"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1437
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1438 (defun tumme-modify-mark-on-thumb-original-file (command)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1439 "Modify mark in dired buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1440 This is quite ugly but I don't know how to implemented in a better
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1441 way. COMMAND is one of 'mark for marking file in dired, 'unmark for
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1442 unmarking file in dired or 'flag for flagging file for delete in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1443 dired."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1444 (let ((file-name (tumme-original-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1445 (dired-buf (tumme-associated-dired-buffer)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1446 (if (not (and dired-buf file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1447 (message "No image, or image with correct properties, at point.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1448 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1449 (message file-name)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1450 (setq file-name (file-name-nondirectory file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1451 (set-buffer dired-buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1452 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1453 (if (search-forward file-name nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1454 (cond ((eq command 'mark) (dired-mark 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1455 ((eq command 'unmark) (dired-unmark 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1456 ((eq command 'toggle)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1457 (if (tumme-dired-file-marked-p)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1458 (dired-unmark 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1459 (dired-mark 1)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1460 ((eq command 'flag) (dired-flag-file-deletion 1))))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1461
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1462 (defun tumme-mark-thumb-original-file ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1463 "Mark original image file in associated dired buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1464 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1465 (tumme-modify-mark-on-thumb-original-file 'mark)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1466 (tumme-forward-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1467
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468 (defun tumme-unmark-thumb-original-file ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469 "Unmark original image file in associated dired buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1470 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1471 (tumme-modify-mark-on-thumb-original-file 'unmark)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1472 (tumme-forward-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1473
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1474 (defun tumme-flag-thumb-original-file ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1475 "Flag original image file for deletion in associated dired buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1476 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1477 (tumme-modify-mark-on-thumb-original-file 'flag)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1478 (tumme-forward-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1479
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1480 (defun tumme-toggle-mark-thumb-original-file ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1481 "Toggle mark on original image file in associated dired buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1482 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1483 (tumme-modify-mark-on-thumb-original-file 'toggle))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1484
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1485 (defun tumme-jump-original-dired-buffer ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1486 "Jump to the dired buffer associated with the current image file.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1487 You probably want to use this together with
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1488 `tumme-track-original-file'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1489 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490 (let ((buf (tumme-associated-dired-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491 window frame)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1492 (setq window (tumme-get-buffer-window buf))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1493 (if window
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1494 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1495 (if (not (equal (selected-frame) (setq frame (window-frame window))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1496 (select-frame-set-input-focus frame))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1497 (select-window window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1498 (message "Associated dired buffer not visible"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1499
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
1500 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1501 (defun tumme-jump-thumbnail-buffer ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1502 "Jump to thumbnail buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1503 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1504 (let ((window (tumme-thumbnail-window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1505 frame)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1506 (if window
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1507 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1508 (if (not (equal (selected-frame) (setq frame (window-frame window))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1509 (select-frame-set-input-focus frame))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1510 (select-window window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1511 (message "Thumbnail buffer not visible"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1512
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1513 (defvar tumme-thumbnail-mode-map (make-sparse-keymap)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1514 "Keymap for `tumme-thumbnail-mode'.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1515
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1516 (defvar tumme-thumbnail-mode-line-up-map (make-sparse-keymap)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1517 "Keymap for line-up commands in `tumme-thumbnail-mode'.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1518
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1519 (defvar tumme-thumbnail-mode-tag-map (make-sparse-keymap)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1520 "Keymap for tag commands in `tumme-thumbnail-mode'.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1521
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1522 (defun tumme-define-thumbnail-mode-keymap ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1523 "Define keymap for `tumme-thumbnail-mode'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1524
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1525 ;; Keys
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1526 (define-key tumme-thumbnail-mode-map [right] 'tumme-forward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1527 (define-key tumme-thumbnail-mode-map [left] 'tumme-backward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1528 (define-key tumme-thumbnail-mode-map [up] 'tumme-previous-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1529 (define-key tumme-thumbnail-mode-map [down] 'tumme-next-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1530 (define-key tumme-thumbnail-mode-map "\C-f" 'tumme-forward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1531 (define-key tumme-thumbnail-mode-map "\C-b" 'tumme-backward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1532 (define-key tumme-thumbnail-mode-map "\C-p" 'tumme-previous-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1533 (define-key tumme-thumbnail-mode-map "\C-n" 'tumme-next-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1534
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1535 (define-key tumme-thumbnail-mode-map "d" 'tumme-flag-thumb-original-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1536 (define-key tumme-thumbnail-mode-map [delete]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1537 'tumme-flag-thumb-original-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1538 (define-key tumme-thumbnail-mode-map "m" 'tumme-mark-thumb-original-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1539 (define-key tumme-thumbnail-mode-map "u" 'tumme-unmark-thumb-original-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1540 (define-key tumme-thumbnail-mode-map "." 'tumme-track-original-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1541 (define-key tumme-thumbnail-mode-map [tab] 'tumme-jump-original-dired-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1542
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1543 ;; add line-up map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1544 (define-key tumme-thumbnail-mode-map "g" tumme-thumbnail-mode-line-up-map)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1545
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1546 ;; map it to "g" so that the user can press it more quickly
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1547 (define-key tumme-thumbnail-mode-line-up-map "g" 'tumme-line-up-dynamic)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1548 ;; "f" for "fixed" number of thumbs per row
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1549 (define-key tumme-thumbnail-mode-line-up-map "f" 'tumme-line-up)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1550 ;; "i" for "interactive"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1551 (define-key tumme-thumbnail-mode-line-up-map "i" 'tumme-line-up-interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1552
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553 ;; add tag map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1554 (define-key tumme-thumbnail-mode-map "t" tumme-thumbnail-mode-tag-map)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1555
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1556 ;; map it to "t" so that the user can press it more quickly
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1557 (define-key tumme-thumbnail-mode-tag-map "t" 'tumme-tag-thumbnail)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1558 ;; "r" for "remove"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1559 (define-key tumme-thumbnail-mode-tag-map "r" 'tumme-tag-thumbnail-remove)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1560
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1561 (define-key tumme-thumbnail-mode-map "\C-m"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1562 'tumme-display-thumbnail-original-image)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1563 (define-key tumme-thumbnail-mode-map [C-return]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1564 'tumme-thumbnail-display-external)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1565
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566 (define-key tumme-thumbnail-mode-map "l" 'tumme-rotate-thumbnail-left)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1567 (define-key tumme-thumbnail-mode-map "r" 'tumme-rotate-thumbnail-right)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1568
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569 (define-key tumme-thumbnail-mode-map "L" 'tumme-rotate-original-left)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 (define-key tumme-thumbnail-mode-map "R" 'tumme-rotate-original-right)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1571
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1572 (define-key tumme-thumbnail-mode-map "D" 'tumme-thumbnail-set-image-description)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1573
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1574 (define-key tumme-thumbnail-mode-map "\C-d" 'tumme-delete-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1575 (define-key tumme-thumbnail-mode-map " "
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1576 'tumme-display-next-thumbnail-original)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1577 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1578 (kbd "DEL") 'tumme-display-previous-thumbnail-original)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1579 (define-key tumme-thumbnail-mode-map "c" 'tumme-comment-thumbnail)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1580 (define-key tumme-thumbnail-mode-map "q" 'tumme-kill-buffer-and-window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1581
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1582 ;; Mouse
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1583 (define-key tumme-thumbnail-mode-map [mouse-2] 'tumme-mouse-display-image)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1584 (define-key tumme-thumbnail-mode-map [mouse-1] 'tumme-mouse-select-thumbnail)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1585
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1586 ;; Seems I must first set C-down-mouse-1 to undefined, or else it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1587 ;; will trigger the buffer menu. If I try to instead bind
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1588 ;; C-down-mouse-1 to `tumme-mouse-toggle-mark', I get a message
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1589 ;; about C-mouse-1 not being defined afterwards. Annoying, but I
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1590 ;; probably do not completely understand mouse events.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1591
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1592 (define-key tumme-thumbnail-mode-map [C-down-mouse-1] 'undefined)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1593 (define-key tumme-thumbnail-mode-map [C-mouse-1] 'tumme-mouse-toggle-mark)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1594
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1595 ;; Menu
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1596 (define-key tumme-thumbnail-mode-map [menu-bar tumme]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1597 (cons "Tumme" (make-sparse-keymap "Tumme")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1598
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1599 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1600 [menu-bar tumme tumme-kill-buffer-and-window]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1601 '("Quit" . tumme-kill-buffer-and-window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1602
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1603 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1604 [menu-bar tumme tumme-delete-char]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1605 '("Delete thumbnail from buffer" . tumme-delete-char))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1606
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1607 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1608 [menu-bar tumme tumme-tag-thumbnail-remove]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1609 '("Remove tag from thumbnail" . tumme-tag-thumbnail-remove))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1610
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1611 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1612 [menu-bar tumme tumme-tag-thumbnail]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613 '("Tag thumbnail" . tumme-tag-thumbnail))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1614
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1615 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1616 [menu-bar tumme tumme-comment-thumbnail]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1617 '("Comment thumbnail" . tumme-comment-thumbnail))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1618
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1619 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1620 [menu-bar tumme tumme-refresh-thumb]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1621 '("Refresh thumb" . tumme-refresh-thumb))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1622 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1623 [menu-bar tumme tumme-line-up-dynamic]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1624 '("Dynamic line up" . tumme-line-up-dynamic))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1625 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1626 [menu-bar tumme tumme-line-up]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1627 '("Line up thumbnails" . tumme-line-up))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1628
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1629 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1630 [menu-bar tumme tumme-rotate-thumbnail-left]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1631 '("Rotate thumbnail left" . tumme-rotate-thumbnail-left))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1632 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1633 [menu-bar tumme tumme-rotate-thumbnail-right]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1634 '("Rotate thumbnail right" . tumme-rotate-thumbnail-right))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1635
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1636 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1637 [menu-bar tumme tumme-rotate-original-left]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1638 '("Rotate original left" . tumme-rotate-original-left))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1639 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1640 [menu-bar tumme tumme-rotate-original-right]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1641 '("Rotate original right" . tumme-rotate-original-right))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1642
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1643 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1644 [menu-bar tumme tumme-toggle-movement-tracking]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1645 '("Toggle movement tracking on/off" . tumme-toggle-movement-tracking))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1646
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1647 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1648 [menu-bar tumme tumme-jump-original-dired-buffer]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1649 '("Jump to dired buffer" . tumme-jump-original-dired-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1650 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1651 [menu-bar tumme tumme-track-original-file]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1652 '("Track original" . tumme-track-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1653
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1654 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1655 [menu-bar tumme tumme-flag-thumb-original-file]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1656 '("Flag original for deletion" . tumme-flag-thumb-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1657 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1658 [menu-bar tumme tumme-unmark-thumb-original-file]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1659 '("Unmark original" . tumme-unmark-thumb-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1660 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1661 [menu-bar tumme tumme-mark-thumb-original-file]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1662 '("Mark original" . tumme-mark-thumb-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1663
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1664 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1665 [menu-bar tumme tumme-thumbnail-display-external]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1666 '("Display in external viewer" . tumme-thumbnail-display-external))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1667 (define-key tumme-thumbnail-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1668 [menu-bar tumme tumme-display-thumbnail-original-image]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1669 '("Display image" . tumme-display-thumbnail-original-image)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1670
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1671 (defvar tumme-display-image-mode-map (make-sparse-keymap)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1672 "Keymap for `tumme-display-image-mode'.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1673
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1674 (defun tumme-define-display-image-mode-keymap ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675 "Define keymap for `tumme-display-image-mode'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1676
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1677 ;; Keys
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1678 (define-key tumme-display-image-mode-map "q" 'tumme-kill-buffer-and-window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1679
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1680 (define-key tumme-display-image-mode-map "f"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1681 'tumme-display-current-image-full)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1682
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1683 (define-key tumme-display-image-mode-map "s"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1684 'tumme-display-current-image-sized)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1685
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1686 ;; Menu
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1687 (define-key tumme-display-image-mode-map [menu-bar tumme]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1688 (cons "Tumme" (make-sparse-keymap "Tumme")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1689
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1690 (define-key tumme-display-image-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1691 [menu-bar tumme tumme-kill-buffer-and-window]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1692 '("Quit" . tumme-kill-buffer-and-window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1693
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1694 (define-key tumme-display-image-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1695 [menu-bar tumme tumme-display-current-image-sized]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1696 '("Display original, sized to fit" . tumme-display-current-image-sized))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1697
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1698 (define-key tumme-display-image-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1699 [menu-bar tumme tumme-display-current-image-full]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1700 '("Display original, full size" . tumme-display-current-image-full))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1701
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1702 )
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1703
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1704 (defun tumme-display-current-image-full ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1705 "Display current image in full size."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1706 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1707 (let ((file (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1708 (if file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1709 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1710 (tumme-display-image file t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1711 (message "Full size image displayed"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1712 (error "No original file name at point"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1713
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1714 (defun tumme-display-current-image-sized ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1715 "Display current image in sized to fit window dimensions."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1716 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1717 (let ((file (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1718 (if file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1719 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1720 (tumme-display-image file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1721 (message "Full size image displayed"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1722 (error "No original file name at point"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1723
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1724 (define-derived-mode tumme-thumbnail-mode
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1725 fundamental-mode "tumme-thumbnail"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1726 "Browse and manipulate thumbnail images using dired.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1727 Use `tumme-dired' and `tumme-setup-dired-keybindings' to get a
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1728 nice setup to start with."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1729 (tumme-define-thumbnail-mode-keymap)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1730 (message "tumme-thumbnail-mode enabled"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1731
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1732 (define-derived-mode tumme-display-image-mode
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1733 fundamental-mode "tumme-image-display"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1734 "Mode for displaying and manipulating original image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1735 Resized or in full-size."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1736 (tumme-define-display-image-mode-keymap)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1737 (message "tumme-display-image-mode enabled"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1738
68404
68bc4d872112 Correct the keywords.
Richard M. Stallman <rms@gnu.org>
parents: 67318
diff changeset
1739 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1740 (defun tumme-setup-dired-keybindings ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1741 "Setup easy-to-use keybindings for the commands to be used in dired mode.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1742 Note that n, p and <down> and <up> will be hijacked and bound to
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1743 `tumme-dired-x-line'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1744 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1745
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1746 ;; Hijack previous and next line movement. Let C-p and C-b be
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1747 ;; though...
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1748
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1749 (define-key dired-mode-map "p" 'tumme-dired-previous-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1750 (define-key dired-mode-map "n" 'tumme-dired-next-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1751 (define-key dired-mode-map [up] 'tumme-dired-previous-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1752 (define-key dired-mode-map [down] 'tumme-dired-next-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1753
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1754 (define-key dired-mode-map (kbd "C-S-n") 'tumme-next-line-and-display)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1755 (define-key dired-mode-map (kbd "C-S-p") 'tumme-previous-line-and-display)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1756 (define-key dired-mode-map (kbd "C-S-m") 'tumme-mark-and-display-next)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1757
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1758 (define-key dired-mode-map "\C-td" 'tumme-display-thumbs)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1759 (define-key dired-mode-map "\C-tt" 'tumme-tag-files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1760 (define-key dired-mode-map "\C-tr" 'tumme-tag-remove)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1761 (define-key dired-mode-map [tab] 'tumme-jump-thumbnail-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1762 (define-key dired-mode-map "\C-ti" 'tumme-display-dired-image)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1763 (define-key dired-mode-map "\C-tx" 'tumme-dired-display-external)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1764 (define-key dired-mode-map "\C-ta" 'tumme-display-thumbs-append)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1765 (define-key dired-mode-map "\C-t." 'tumme-display-thumb)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1766 (define-key dired-mode-map "\C-tc" 'tumme-dired-comment-files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1767 (define-key dired-mode-map "\C-tf" 'tumme-mark-tagged-files)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1768
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1769 ;; Menu for dired
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1770 (define-key dired-mode-map [menu-bar tumme]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1771 (cons "Tumme" (make-sparse-keymap "Tumme")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1772
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1773 (define-key dired-mode-map [menu-bar tumme tumme-copy-with-exif-file-name]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1774 '("Copy with EXIF file name" . tumme-copy-with-exif-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1775
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1776 (define-key dired-mode-map [menu-bar tumme tumme-dired-comment-files]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1777 '("Comment files" . tumme-dired-comment-files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1778
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1779 (define-key dired-mode-map [menu-bar tumme tumme-mark-tagged-files]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1780 '("Mark tagged files" . tumme-mark-tagged-files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1781
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1782 (define-key dired-mode-map [menu-bar tumme tumme-tag-remove]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1783 '("Remove tag from files" . tumme-tag-remove))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1784
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1785 (define-key dired-mode-map [menu-bar tumme tumme-tag-files]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1786 '("Tag files" . tumme-tag-files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1787
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1788 (define-key dired-mode-map [menu-bar tumme tumme-jump-thumbnail-buffer]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1789 '("Jump to thumbnail buffer" . tumme-jump-thumbnail-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1790
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1791 (define-key dired-mode-map [menu-bar tumme tumme-toggle-movement-tracking]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1792 '("Toggle movement tracking" . tumme-toggle-movement-tracking))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1793
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1794 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1795 [menu-bar tumme tumme-toggle-append-browsing]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1796 '("Toggle append browsing" . tumme-toggle-append-browsing))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1797
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1798 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1799 [menu-bar tumme tumme-toggle-disp-props]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1800 '("Toggle display properties" . tumme-toggle-dired-display-properties))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1801
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1802 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1803 [menu-bar tumme tumme-dired-display-external]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1804 '("Display in external viewer" . tumme-dired-display-external))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1805 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1806 [menu-bar tumme tumme-display-dired-image]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1807 '("Display image" . tumme-display-dired-image))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1808 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1809 [menu-bar tumme tumme-display-thumb]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1810 '("Display this thumbnail" . tumme-display-thumb))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1811 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1812 [menu-bar tumme tumme-display-thumbs-append]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1813 '("Display thumbnails append" . tumme-display-thumbs-append))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1814 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1815 [menu-bar tumme tumme-display-thumbs]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1816 '("Display thumbnails" . tumme-display-thumbs))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1817
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1818 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1819 [menu-bar tumme tumme-create-thumbs]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1820 '("Create thumbnails for marked files" . tumme-create-thumbs))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1821
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1822 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1823 [menu-bar tumme tumme-mark-and-display-next]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1824 '("Mark and display next" . tumme-mark-and-display-next))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1825 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1826 [menu-bar tumme tumme-previous-line-and-display]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1827 '("Display thumb for previous file" . tumme-previous-line-and-display))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1828 (define-key dired-mode-map
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1829 [menu-bar tumme tumme-next-line-and-display]
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830 '("Display thumb for next file" . tumme-next-line-and-display)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1832 (defun tumme-create-thumbs (&optional arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833 "Create thumbnail images for all marked files in dired.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 With prefix argument ARG, create thumbnails even if they already exist
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
1835 \(i.e. use this to refresh your thumbnails)."
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837 (let (curr-file thumb-name files count)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1838 (setq files (dired-get-marked-files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 (mapcar
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1840 (lambda (curr-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 (setq thumb-name (tumme-thumb-name curr-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842 ;; If the user overrides the exist check, we must clear the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1843 ;; image cache so that if the user wants to display the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1844 ;; thumnail, it is not fetched from cache.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1845 (if arg
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1846 (clear-image-cache))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1847 (if (or (not (file-exists-p thumb-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1848 arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1849 (if (not (= 0 (tumme-create-thumb curr-file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1850 (tumme-thumb-name curr-file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1851 (error "Thumb could not be created"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852 files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1853
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 (defvar tumme-slideshow-timer nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1855 "Slideshow timer.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1856
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 (defvar tumme-slideshow-count 0
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858 "Keeping track on number of images in slideshow.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1859
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1860 (defvar tumme-slideshow-times 0
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1861 "Number of pictures to display in slideshow.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1862
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1863 (defun tumme-slideshow-step ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1864 "Step to next file, if `tumme-slideshow-times' has not been reached."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 (if (< tumme-slideshow-count tumme-slideshow-times)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867 (message "%s" (1+ tumme-slideshow-count))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868 (setq tumme-slideshow-count (1+ tumme-slideshow-count))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1869 (tumme-next-line-and-display))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1870 (tumme-slideshow-stop)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1871
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872 (defun tumme-slideshow-start ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1873 "Start slideshow.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1874 Ask user for number of images to show and the delay in between."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1875 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1876 (setq tumme-slideshow-count 0)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1877 (setq tumme-slideshow-times (string-to-number (read-string "How many: ")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878 (let ((repeat (string-to-number
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 (read-string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880 "Delay, in seconds. Decimals are accepted : " "1"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1881 (setq tumme-slideshow-timer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1882 (run-with-timer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1883 0 repeat
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1884 'tumme-slideshow-step))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1885
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1886 (defun tumme-slideshow-stop ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1887 "Cancel slideshow."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1888 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889 (cancel-timer tumme-slideshow-timer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1890
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1891 (defun tumme-delete-char ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1892 "Remove current thumbnail from thumbnail buffer and line up."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1893 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1894 (let ((inhibit-read-only t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1895 (delete-char 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1896 (if (looking-at " ")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1897 (delete-char 1))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1898
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
1899 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1900 (defun tumme-display-thumbs-append ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1901 "Append thumbnails to `tumme-thumbnail-buffer'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1902 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1903 (tumme-display-thumbs nil t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1904
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
1905 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1906 (defun tumme-display-thumb ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1907 "Shorthard for `tumme-display-thumbs' with prefix argument."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1908 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1909 (tumme-display-thumbs t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1910
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1911 (defun tumme-line-up ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1912 "Line up thumbnails according to `tumme-thumbs-per-row'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1913 See also `tumme-line-up-dynamic'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1914 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1915 (let ((inhibit-read-only t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1916 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1917 (while (and (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1918 (not (eobp)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1919 (delete-char 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1920 (while (not (eobp))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1921 (forward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1922 (while (and (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1923 (not (eobp)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1924 (delete-char 1)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1925 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1926 (let ((count 0))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1927 (while (not (eobp))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1928 (forward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1929 (if (= tumme-thumbs-per-row 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1930 (insert "\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1931 (insert " ")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1932 (setq count (1+ count))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1933 (if (= count (- tumme-thumbs-per-row 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1934 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1935 (forward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1936 (insert "\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1937 (setq count 0))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1938 (goto-char (point-min))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1939
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1940 (defun tumme-line-up-dynamic ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1941 "Line up thumbnails images dynamically.
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
1942 Calculate how many thumbnails fit."
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1943 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1944 (let* ((char-width (frame-char-width))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1945 (width (tumme-window-width-pixels (tumme-thumbnail-window)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1946 (tumme-thumbs-per-row
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1947 (/ width
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1948 (+ (* 2 tumme-thumb-relief)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1949 (* 2 tumme-thumb-margin)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1950 tumme-thumb-size char-width))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1951 (tumme-line-up)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1952
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1953 (defun tumme-line-up-interactive ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1954 "Line up thumbnails interactively.
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
1955 Ask user how many thumbnails should be displayed per row."
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1956 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1957 (let ((tumme-thumbs-per-row
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1958 (string-to-number (read-string "How many thumbs per row: "))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1959 (if (not (> tumme-thumbs-per-row 0))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1960 (message "Number must be greater than 0")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1961 (tumme-line-up))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1962
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1963 (defun tumme-thumbnail-display-external ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964 "Display original image for thumbnail at point using external viewer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1965
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1966 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1967 (let ((file (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1968 (if (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1969 (message "No thumbnail at point")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1970 (if (not file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1971 (message "No original file name found")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 (shell-command (format "%s \"%s\""
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1973 tumme-external-viewer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1974 file))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1975
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
1976 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1977 (defun tumme-dired-display-external ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1978 "Display file at point using an external viewer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1979 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1980 (let ((file (dired-get-filename)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1981 (shell-command (format "%s \"%s\""
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1982 tumme-external-viewer
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1983 file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1984
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1985 (defun tumme-window-width-pixels (window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1986 "Calculate WINDOW width in pixels."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1987 (* (window-width window) (frame-char-width)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1988
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1989 (defun tumme-window-height-pixels (window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1990 "Calculate WINDOW height in pixels."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 ;; Note: The mode-line consumes one line
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992 (* (- (window-height window) 1) (frame-char-height)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1993
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1994 (defun tumme-display-window ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1995 "Return window where `tumme-display-image-buffer' is visible."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1996 (get-window-with-predicate
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1997 (lambda (window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1998 (equal (buffer-name (window-buffer window)) tumme-display-image-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1999 nil t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2000
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2001 (defun tumme-thumbnail-window ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2002 "Return window where `tumme-thumbnail-buffer' is visible."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2003 (get-window-with-predicate
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2004 (lambda (window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2005 (equal (buffer-name (window-buffer window)) tumme-thumbnail-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2006 nil t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2008 (defun tumme-associated-dired-buffer-window ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2009 "Return window where associated dired buffer is visible."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2010 (let (buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2011 (if (tumme-image-at-point-p)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2012 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2013 (setq buf (tumme-associated-dired-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2014 (get-window-with-predicate
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2015 (lambda (window)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2016 (equal (window-buffer window) buf))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2017 (error "No thumbnail image at point"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2018
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2019 (defun tumme-display-window-width ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2020 "Return width, in pixels, of tumme's image display window."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2021 (- (tumme-window-width-pixels (tumme-display-window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022 tumme-display-window-width-correction))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2024 (defun tumme-display-window-height ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2025 "Return height, in pixels, of tumme's image display window."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2026 (- (tumme-window-height-pixels (tumme-display-window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2027 tumme-display-window-height-correction))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2028
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2029 (defun tumme-display-image (file &optional original-size)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2030 "Display image FILE in image buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2031 Use this when you want to display the image, semi sized, in a window
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2032 next to the thumbnail window - typically a three-window configuration
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2033 with dired to the left, thumbnail window to the upper right and image
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2034 window to the lower right. The image is sized to fit the display
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2035 window (using a temporary file, don't worry). Because of this, it
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2036 will not be as quick as opening it directly, but on most modern
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2037 systems it should feel snappy enough.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2038
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2039 If optional argument ORIGINAL-SIZE is non-nil, display image in its
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2040 original size."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2041 (let ((new-file (expand-file-name tumme-temp-image-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2042 size-x size-y command ret)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2043 (setq file (expand-file-name file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2044 (if (not original-size)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2045 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2046 (setq size-x (tumme-display-window-width))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2047 (setq size-y (tumme-display-window-height))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2048 (setq command
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2049 (format-spec
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2050 tumme-cmd-create-temp-image-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2051 (list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2052 (cons ?p tumme-cmd-create-temp-image-program)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2053 (cons ?x size-x)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2054 (cons ?y size-y)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2055 (cons ?f file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2056 (cons ?t new-file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2057 (setq ret (shell-command command nil))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2058 (if (not (= 0 ret))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2059 (error "Could not resize image")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2060 (copy-file file new-file t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2061 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2062 (set-buffer (tumme-create-display-image-buffer))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2063 (let ((inhibit-read-only t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2064 (erase-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2065 (clear-image-cache)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2066 (tumme-insert-image tumme-temp-image-file 'jpeg 0 0)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2067 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2068 (tumme-update-property 'original-file-name file)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2069
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2070 (defun tumme-display-thumbnail-original-image (&optional arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2071 "Display current thumbnail's original image in display buffer.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2072 See documentation for `tumme-display-image' for more information.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2073 With prefix argument ARG, display image in its original size."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2074 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2075 (let ((file (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2076 (if (not (string-equal major-mode "tumme-thumbnail-mode"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2077 (message "Not in tumme-thumbnail-mode")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2078 (if (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2079 (message "No thumbnail at point")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2080 (if (not file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2081 (message "No original file name found")
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2082 (tumme-display-image file arg)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2083 (display-buffer tumme-display-image-buffer))))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2084
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
2085 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2086 (defun tumme-display-dired-image (&optional arg)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2087 "Display current image file.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2088 See documentation for `tumme-display-image' for more information.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2089 With prefix argument ARG, display image in its original size."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2090 (interactive "P")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2091 (tumme-display-image (dired-get-filename) arg))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2092
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2093 (defun tumme-image-at-point-p ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2094 "Return true if there is a tumme thumbnail at point."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2095 (get-text-property (point) 'tumme-thumbnail))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2096
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2097 (defun tumme-rotate-thumbnail (degrees)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2098 "Rotate thumbnail DEGREES degrees."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2099 (if (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2100 (message "No thumbnail at point")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2101 (let ((file (tumme-thumb-name (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2102 command)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2103 (setq command (format-spec
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2104 tumme-cmd-rotate-thumbnail-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2105 (list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2106 (cons ?p tumme-cmd-rotate-thumbnail-program)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2107 (cons ?d degrees)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2108 (cons ?t (expand-file-name file)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2109 (shell-command command nil)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2110 ;; Clear the cache to refresh image. I wish I could just refresh
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2111 ;; the current file but I do not know how to do that. Yet...
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112 (clear-image-cache))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2113
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2114 (defun tumme-rotate-thumbnail-left ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2115 "Rotate thumbnail left (counter clockwise) 90 degrees.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2116 The result of the rotation is displayed in the image display area
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2117 and a confirmation is needed before the original image files is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2118 overwritten. This confirmation can be turned off using
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2119 `tumme-rotate-original-ask-before-overwrite'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2120 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2121 (tumme-rotate-thumbnail "270"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2122
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2123 (defun tumme-rotate-thumbnail-right ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2124 "Rotate thumbnail counter right (clockwise) 90 degrees.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2125 The result of the rotation is displayed in the image display area
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2126 and a confirmation is needed before the original image files is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2127 overwritten. This confirmation can be turned off using
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2128 `tumme-rotate-original-ask-before-overwrite'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2129 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2130 (tumme-rotate-thumbnail "90"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2131
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2132 (defun tumme-refresh-thumb ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2133 "Force creation of new image for current thumbnail."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2134 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2135 (let ((file (tumme-original-file-name)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2136 (clear-image-cache)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2137 (tumme-create-thumb file (tumme-thumb-name file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2138
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2139 (defun tumme-rotate-original (degrees)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2140 "Rotate original image DEGREES degrees."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2141 (if (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2142 (message "No image at point")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2143 (let ((file (tumme-original-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2144 command temp-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2145 (if (not (string-match "\.[jJ][pP[eE]?[gG]$" file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2146 (error "Only JPEG images can be rotated!"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2147 (setq command (format-spec
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2148 tumme-cmd-rotate-original-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2149 (list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2150 (cons ?p tumme-cmd-rotate-original-program)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2151 (cons ?d degrees)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2152 (cons ?o (expand-file-name file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2153 (cons ?t tumme-temp-rotate-image-file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2154 (if (not (= 0 (shell-command command nil)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2155 (error "Could not rotate image")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2156 (tumme-display-image tumme-temp-rotate-image-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2157 (if (or (and tumme-rotate-original-ask-before-overwrite
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2158 (y-or-n-p "Rotate to temp file OK. Overwrite original image? "))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2159 (not tumme-rotate-original-ask-before-overwrite))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2160 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2161 (copy-file tumme-temp-rotate-image-file file t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2162 (tumme-refresh-thumb))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2163 (tumme-display-image file))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2164
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2165 (defun tumme-rotate-original-left ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2166 "Rotate original image left (counter clockwise) 90 degrees."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2167 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2168 (tumme-rotate-original "270"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2169
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2170 (defun tumme-rotate-original-right ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2171 "Rotate original image right (clockwise) 90 degrees."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2172 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2173 (tumme-rotate-original "90"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2174
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2175 (defun tumme-get-exif-file-name (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2176 "Use the image's EXIF information to return a unique file name.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2177 The file name should be unique as long as you do not take more than
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2178 one picture per second. The original file name is suffixed at the end
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2179 for traceability. The format of the returned file name is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2180 YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2181 `tumme-copy-with-exif-file-name'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2182 (let (data no-exif-data-found)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2183 (if (not (string-match "\.[Jj][Pp][Ee]?[Gg]$" (expand-file-name file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2184 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2185 (setq no-exif-data-found t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2186 (setq data
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2187 (format-time-string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2188 "%Y:%m:%d %H:%M:%S"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2189 (nth 5 (file-attributes (expand-file-name file))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2190 (setq data (tumme-get-exif-data (expand-file-name file) "DateTimeOriginal")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2191 (while (string-match "[ :]" data)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2192 (setq data (replace-match "_" nil nil data)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2193 (format "%s%s%s" data
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2194 (if no-exif-data-found
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2195 "_noexif_"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2196 "_")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2197 (file-name-nondirectory file))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2198
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2199 (defun tumme-thumbnail-set-image-description ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2200 "Set the ImageDescription EXIF tag for the original image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2201 If the image already has a value for this tag, it is used as the
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2202 default value at the prompt."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2203 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2204 (if (not (tumme-image-at-point-p))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2205 (message "No thumbnail at point")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2206 (let* ((file (tumme-original-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2207 (old-value (tumme-get-exif-data file "ImageDescription")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2208 (if (eq 0
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2209 (tumme-set-exif-data file "ImageDescription"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2210 (read-string "Value of ImageDescription: " old-value)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2211 (message "Successfully wrote ImageDescription tag.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2212 (error "Could not write ImageDescription tag")))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2213
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2214 (defun tumme-set-exif-data (file tag-name tag-value)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2215 "In FILE, set EXIF tag TAG-NAME to value TAG-VALUE."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2216 (let (command)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2217 (setq command (format-spec
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2218 tumme-cmd-write-exif-data-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2219 (list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2220 (cons ?p tumme-cmd-write-exif-data-program)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2221 (cons ?f (expand-file-name file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2222 (cons ?t tag-name)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2223 (cons ?v tag-value))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2224 (shell-command command nil)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2225
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2226 (defun tumme-get-exif-data (file tag-name)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2227 "From FILE, return EXIF tag TAG-NAME."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2228 (let ((buf (get-buffer-create "*tumme-get-exif-data*"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2229 command tag-value)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2230 (setq command (format-spec
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2231 tumme-cmd-read-exif-data-options
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2232 (list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2233 (cons ?p tumme-cmd-read-exif-data-program)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2234 (cons ?f file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2235 (cons ?t tag-name))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2236 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2237 (set-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2238 (delete-region (point-min) (point-max))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2239 (if (not (eq (shell-command command buf) 0))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2240 (error "Could not get EXIF tag")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2241 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2242 ;; Clean buffer from newlines and carriage returns before
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2243 ;; getting final info
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2244 (while (search-forward-regexp "[\n\r]" nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2245 (replace-match "" nil t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2246 (setq tag-value (buffer-substring (point-min) (point-max)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2247 tag-value))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2248
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2249 (defun tumme-copy-with-exif-file-name ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2250 "Copy file with unique name to main image directory.
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2251 Copy current or all marked files in dired to a new file in your
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2252 main image directory, using a file name generated by
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2253 `tumme-get-exif-file-name'. A typical usage for this if when
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2254 copying images from a digital camera into the image directory.
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2255
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2256 Typically, you would open up the folder with the incoming
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2257 digital images, mark the files to be copied, and execute this
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2258 function. The result is a couple of new files in
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2259 `tumme-main-image-directory' called
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2260 2005_05_08_12_52_00_dscn0319.jpg,
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2261 2005_05_08_14_27_45_dscn0320.jpg etc."
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2262 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2263 (let (new-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2264 (files (dired-get-marked-files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2265 (mapcar
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2266 (lambda (curr-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2267 (setq new-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2268 (format "%s/%s"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2269 (file-name-as-directory
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2270 (expand-file-name tumme-main-image-directory))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2271 (tumme-get-exif-file-name curr-file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2272 (message "Copying %s to %s" curr-file new-name)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2273 (copy-file curr-file new-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2274 files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2275
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2276 (defun tumme-display-next-thumbnail-original ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2277 "In thubnail buffer, move to next thumbnail and display the image."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2278 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2279 (tumme-forward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2280 (tumme-display-thumbnail-original-image))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2281
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2282 (defun tumme-display-previous-thumbnail-original ()
68673
5a7d4aa73d2d (tumme-get-thumbnail-image): Add missing arg to `error'.
Juanma Barranquero <lekktu@gmail.com>
parents: 68658
diff changeset
2283 "Move to previous thumbnail and display image."
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2284
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2285 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2286 (tumme-backward-char)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2287 (tumme-display-thumbnail-original-image))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2288
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2289 (defun tumme-write-comment (file comment)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2290 "For FILE, write comment COMMENT in database."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2291 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2292 (let (end buf comment-beg
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2293 (base-name (file-name-nondirectory file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2294 (setq buf (find-file tumme-db-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2295 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2296 (if (search-forward-regexp
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2297 (format "^%s" base-name) nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2298 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2299 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2300 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2301 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2302 ;; Delete old comment, if any
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2303 (cond ((search-forward ";comment:" end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2304 (setq comment-beg (match-beginning 0))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2305 ;; Any tags after the comment?
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2306 (if (search-forward ";" end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2307 (setq comment-end (- (point) 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2308 (setq comment-end end))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2309 ;; Delete comment tag and comment
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2310 (delete-region comment-beg comment-end)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2311 ;; Insert new comment
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2312 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2313 (if (not (search-forward ";" end t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2314 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2315 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2316 (insert ";")))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2317 (insert (format "comment:%s;" comment)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2318 ;; File does not exist in databse - add it.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2319 (goto-char (point-max))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2320 (insert (format "\n%s;comment:%s" base-name comment)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2321 (save-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2322 (kill-buffer buf))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2323
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2324 (defun tumme-update-property (prop value)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2325 "Update text property PROP with value VALUE at point."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2326 (let ((inhibit-read-only t))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2327 (put-text-property
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2328 (point) (1+ (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2329 prop
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2330 value)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2331
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
2332 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2333 (defun tumme-dired-comment-files ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2334 "Add comment to current or marked files in dired."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2335 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2336 (let ((files (dired-get-marked-files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2337 (comment (tumme-read-comment)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2338 (mapcar
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2339 (lambda (curr-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2340 (tumme-write-comment curr-file comment))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2341 files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2342
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2343 (defun tumme-comment-thumbnail ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2344 "Add comment to current thumbnail in thumbnail buffer."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2345 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2346 (let* ((file (tumme-original-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2347 (comment (tumme-read-comment file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2348 (tumme-write-comment file comment)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2349 (tumme-update-property 'comment comment))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2350 (tumme-display-thumb-properties))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2351
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2352 (defun tumme-read-comment (&optional file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2353 "Read comment, optionally using old comment from FILE as initial value."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2354
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2355 (let ((comment
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2356 (read-string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2357 "Comment: "
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2358 (if file (tumme-get-comment file)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2359 comment))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2360
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361 (defun tumme-get-comment (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 "Get comment for file FILE."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2363 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2364 (let (end buf comment-beg comment (base-name (file-name-nondirectory file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2365 (setq buf (find-file tumme-db-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2367 (if (search-forward-regexp
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2368 (format "^%s" base-name) nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2369 (progn
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2370 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2371 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2372 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2373 (cond ((search-forward ";comment:" end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2374 (setq comment-beg (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2375 (if (search-forward ";" end t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2376 (setq comment-end (- (point) 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377 (setq comment-end end))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2378 (setq comment (buffer-substring
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2379 comment-beg comment-end))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2380 (kill-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2381 comment)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2382
68682
23eaa0d773ea Added more autoload cookies.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68675
diff changeset
2383 ;;;###autoload
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2384 (defun tumme-mark-tagged-files ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2385 "Use regexp to mark files with matching tag."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2386 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2387 (let ((tag (read-string "Mark tagged files (regexp): "))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2388 (hits 0)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2389 files buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2390 (save-excursion
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2391 (setq buf (find-file tumme-db-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2392 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2393 ;; Collect matches
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2394 (while (search-forward-regexp
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2395 (concat "\\(^[^;]+\\);.*" tag ".*$") nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2396 (setq files (append (list (match-string 1)) files)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2397 (kill-buffer buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2398 ;; Mark files
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2399 (mapcar
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2400 ;; I tried using `dired-mark-files-regexp' but it was
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2401 ;; waaaay to slow.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2402 (lambda (curr-file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2403 ;; Don't bother about hits found in other directories than
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2404 ;; the current one.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2405 (when (string= (file-name-as-directory
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2406 (expand-file-name default-directory))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2407 (file-name-as-directory
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2408 (file-name-directory curr-file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2409 (setq curr-file (file-name-nondirectory curr-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2410 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2411 (when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2412 (setq hits (+ hits 1))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2413 (dired-mark 1))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2414 files))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2415 (message "%d files with matching tag marked." hits)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2416
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2417 (defun tumme-mouse-display-image (event)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2418 "Use mouse EVENT, call `tumme-display-image' to display image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2419 Track this in associated dired buffer if `tumme-track-movement' is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2420 non-nil."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2421 (interactive "e")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2422 (let (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2423 (mouse-set-point event)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2424 (goto-char (posn-point (event-end event)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2425 (setq file (tumme-original-file-name))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2426 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2427 (tumme-track-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2428 (tumme-display-image file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2429
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2430 (defun tumme-mouse-select-thumbnail (event)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2431 "Use mouse EVENT to select thumbnail image.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2432 Track this in associated dired buffer if `tumme-track-movement' is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2433 non-nil."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2434 (interactive "e")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2435 (let (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2436 (mouse-set-point event)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2437 (goto-char (posn-point (event-end event)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2438 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2439 (tumme-track-original-file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2440 (tumme-display-thumb-properties))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2441
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2442 (defun tumme-mouse-toggle-mark (event)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2443 "Use mouse EVENT to toggle dired mark for thumbnail.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2444 Track this in associated dired buffer if `tumme-track-movement' is
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2445 non-nil."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2446 (interactive "e")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2447 (let (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2448 (mouse-set-point event)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2449 (goto-char (posn-point (event-end event)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2450 (if tumme-track-movement
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2451 (tumme-track-original-file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2452 (tumme-toggle-mark-thumb-original-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2453
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2454 (defun tumme-dired-display-properties ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2455 "Display properties for dired file in the echo area."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2456 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2457 (let* ((file (dired-get-filename))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2458 (file-name (file-name-nondirectory file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2459 (dired-buf (buffer-name (current-buffer)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2460 (props (mapconcat
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2461 'princ
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2462 (tumme-list-tags file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2463 ", "))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2464 (comment (tumme-get-comment file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2465 (if file-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2466 (message
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2467 (tumme-format-properties-string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2468 dired-buf
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2469 file-name
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2470 props
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2471 comment)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2472
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2473 (defvar tumme-tag-file-list nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2474 "List to store tag-file structure.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2475
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2476 (defvar tumme-file-tag-list nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2477 "List to store file-tag structure.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2478
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2479 (defvar tumme-file-comment-list nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2480 "List to store file comments.")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2481
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2482 (defun tumme-add-to-tag-file-list (tag file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2483 "Add relation between TAG and FILE."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2484 (let (curr)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2485 (if tumme-tag-file-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2486 (if (setq curr (assoc tag tumme-tag-file-list))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2487 (if (not (member file curr))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2488 (setcdr curr (cons file (cdr curr))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2489 (setcdr tumme-tag-file-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2490 (cons (list tag file) (cdr tumme-tag-file-list))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2491 (setq tumme-tag-file-list (list (list tag file))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2492
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2493 (defun tumme-add-to-tag-file-lists (tag file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2494 "Helper function used from `tumme-create-gallery-lists'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2495
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2496 Add TAG to FILE in one list and FILE to TAG in the other.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2497
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2498 Lisp structures look like the following:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2499
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2500 tumme-file-tag-list:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2501
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2502 ((\"filename1\" \"tag1\" \"tag2\" \"tag3\" ...)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2503 (\"filename2\" \"tag1\" \"tag2\" \"tag3\" ...)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2504 ...)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2505
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2506 tumme-tag-file-list:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2507
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2508 ((\"tag1\" \"filename1\" \"filename2\" \"filename3\" ...)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2509 (\"tag2\" \"filename1\" \"filename2\" \"filename3\" ...)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2510 ...)"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2511 ;; Add tag to file list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2512 (let (curr)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2513 (if tumme-file-tag-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2514 (if (setq curr (assoc file tumme-file-tag-list))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2515 (setcdr curr (cons tag (cdr curr)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2516 (setcdr tumme-file-tag-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2517 (cons (list file tag) (cdr tumme-file-tag-list))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2518 (setq tumme-file-tag-list (list (list file tag))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2519 ;; Add file to tag list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2520 (if tumme-tag-file-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2521 (if (setq curr (assoc tag tumme-tag-file-list))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2522 (if (not (member file curr))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2523 (setcdr curr (cons file (cdr curr))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2524 (setcdr tumme-tag-file-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2525 (cons (list tag file) (cdr tumme-tag-file-list))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2526 (setq tumme-tag-file-list (list (list tag file))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2527
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2528 (defun tumme-add-to-file-comment-list (file comment)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2529 "Helper function used from `tumme-create-gallery-lists'.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2530
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2531 For FILE, add COMMENT to list.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2532
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2533 Lisp structure looks like the following:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2534
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2535 tumme-file-comment-list:
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2536
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2537 ((\"filename1\" . \"comment1\")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2538 (\"filename2\" . \"comment2\")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2539 ...)"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2540 (if tumme-file-comment-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2541 (if (not (assoc file tumme-file-comment-list))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2542 (setcdr tumme-file-comment-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2543 (cons (cons file comment)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2544 (cdr tumme-file-comment-list))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2545 (setq tumme-file-comment-list (list (cons file comment)))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2546
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2547 (defun tumme-create-gallery-lists ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2548 "Create temporary lists used by `tumme-gallery-generate'."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2549 (let ((buf (find-file tumme-db-file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2550 end beg file row-tags)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2551 (setq tumme-tag-file-list nil)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2552 (setq tumme-file-tag-list nil)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2553 (setq tumme-file-comment-list nil)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2554 (goto-char (point-min))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2555 (while (search-forward-regexp "^." nil t)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2556 (end-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2557 (setq end (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2558 (beginning-of-line)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2559 (setq beg (point))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2560 (if (not (search-forward ";" end nil))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2561 (error "Something is really wrong, check format of database"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2562 (setq row-tags (split-string
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2563 (buffer-substring beg end) ";"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2564 (setq file (car row-tags))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2565 (mapc
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2566 (lambda (x)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2567 (if (not (string-match "^comment:\\(.*\\)" x))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2568 (tumme-add-to-tag-file-lists x file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2569 (tumme-add-to-file-comment-list file (match-string 1 x))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2570 (cdr row-tags)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2571 (kill-buffer buf))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2572 ;; Sort tag-file list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2573 (setq tumme-tag-file-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2574 (sort tumme-tag-file-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2575 (lambda (x y)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2576 (string< (car x) (car y))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2577
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2578 (defun tumme-hidden-p (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2579 "Return t if image FILE has a \"hidden\" tag."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2580 (let (hidden)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2581 (mapc
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2582 (lambda (tag)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2583 (if (member tag tumme-gallery-hidden-tags)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2584 (setq hidden t)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2585 (cdr (assoc file tumme-file-tag-list)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2586 hidden))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2587
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2588 (defun tumme-gallery-generate ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2589 "Generate gallery pages.
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2590 First we create a couple of Lisp structures from the database to make
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2591 it easier to generate, then HTML-files are created in
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2592 `tumme-gallery-dir'"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2593 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2594 (if (eq 'per-directory tumme-thumbnail-storage)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2595 (error "Currently, gallery generation is not supported \
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2596 when using per-directory thumbnail file storage"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2597 (tumme-create-gallery-lists)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2598 (let ((tags tumme-tag-file-list)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2599 count curr tag index-buf tag-buf
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2600 comment file-tags tag-link tag-link-list)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2601 ;; Make sure gallery root exist
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2602 (if (file-exists-p tumme-gallery-dir)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2603 (if (not (file-directory-p tumme-gallery-dir))
68757
3c76b1d6eff0 Tried to make docstring less `colloquial'...
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68754
diff changeset
2604 (error "Variable tumme-gallery-dir is not a directory"))
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2605 (make-directory tumme-gallery-dir))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2606 ;; Open index file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2607 (setq index-buf (find-file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2608 (format "%s/index.html" tumme-gallery-dir)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2609 (erase-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2610 (insert "<html>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2611 (insert " <body>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2612 (insert " <h2>Tumme Gallery</h2>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2613 (insert (format "<p>\n Gallery generated %s\n <p>\n"
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2614 (current-time-string)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2615 (insert " <h3>Tag index</h3>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2616 (setq count 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2617 ;; Pre-generate list of all tag links
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2618 (mapc
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2619 (lambda (curr)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2620 (setq tag (car curr))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2621 (when (not (member tag tumme-gallery-hidden-tags))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2622 (setq tag-link (format "<a href=\"%d.html\">%s</a>" count tag))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2623 (if tag-link-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2624 (setq tag-link-list
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2625 (append tag-link-list (list (cons tag tag-link))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2626 (setq tag-link-list (list (cons tag tag-link))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2627 (setq count (1+ count))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2628 tags)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2629 (setq count 1)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2630 ;; Main loop where we generated thumbnail pages per tag
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2631 (mapc
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2632 (lambda (curr)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2633 (setq tag (car curr))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2634 ;; Don't display hidden tags
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2635 (when (not (member tag tumme-gallery-hidden-tags))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2636 ;; Insert link to tag page in index
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2637 (insert (format " %s<br>\n" (cdr (assoc tag tag-link-list))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2638 ;; Open per-tag file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2639 (setq tag-buf (find-file
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2640 (format "%s/%s.html" tumme-gallery-dir count)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2641 (erase-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2642 (insert "<html>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2643 (insert " <body>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2644 (insert " <p><a href=\"index.html\">Index</a></p>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2645 (insert (format " <h2>Images with tag &quot;%s&quot;</h2>" tag))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2646 ;; Main loop for files per tag page
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2647 (mapc
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2648 (lambda (file)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2649 (when (not (tumme-hidden-p file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2650 ;; Insert thumbnail with link to full image
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2651 (insert
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2652 (format "<a href=\"%s/%s\"><img src=\"%s/%s\"%s></a>\n"
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2653 tumme-gallery-image-root-url (file-name-nondirectory file)
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2654 tumme-gallery-thumb-image-root-url
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2655 (file-name-nondirectory (tumme-thumb-name file)) file))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2656 ;; Insert comment, if any
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2657 (if (setq comment (cdr (assoc file tumme-file-comment-list)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2658 (insert (format "<br>\n%s<br>\n" comment))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2659 (insert "<br>\n"))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2660 ;; Insert links to other tags, if any
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2661 (when (> (length
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2662 (setq file-tags (assoc file tumme-file-tag-list))) 2)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2663 (insert "[ ")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2664 (mapc
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2665 (lambda (extra-tag)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2666 ;; Only insert if not file name or the main tag
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2667 (if (and (not (equal extra-tag tag))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2668 (not (equal extra-tag file)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2669 (insert
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2670 (format "%s " (cdr (assoc extra-tag tag-link-list))))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2671 file-tags)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2672 (insert "]<br>\n"))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2673 (cdr curr))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2674 (insert " <p><a href=\"index.html\">Index</a></p>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2675 (insert " </body>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2676 (insert "</html>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2677 (save-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2678 (kill-buffer tag-buf)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2679 (setq count (1+ count))))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2680 tags)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2681 (insert " </body>\n")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2682 (insert "</html>")
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2683 (save-buffer)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2684 (kill-buffer index-buf)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2685
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2686 (defun tumme-kill-buffer-and-window ()
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2687 "Kill the current buffer and, if possible, also the window."
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2688 (interactive)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2689 (let ((buffer (current-buffer)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2690 (condition-case nil
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2691 (delete-window (selected-window))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2692 (error nil))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2693 (kill-buffer buffer)))
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2694
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2695 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2696 ;;;;;;;;; TEST-SECTION ;;;;;;;;;;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2697 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2698
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2699 ;; (defvar tumme-dir-max-size 12300000)
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2700
68658
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2701 ;; (defun tumme-test-clean-old-files ()
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2702 ;; "Clean `tumme-dir' from old thumbnail files.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2703 ;; \"Oldness\" measured using last access time. If the total size of all
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2704 ;; thumbnail files in `tumme-dir' is larger than 'tumme-dir-max-size',
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2705 ;; old files are deleted until the max size is reached."
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2706 ;; (let* ((files
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2707 ;; (sort
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2708 ;; (mapcar
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2709 ;; (lambda (f)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2710 ;; (let ((fattribs (file-attributes f)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2711 ;; ;; Get last access time and file size
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2712 ;; `(,(nth 4 fattribs) ,(nth 7 fattribs) ,f)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2713 ;; (directory-files tumme-dir t ".+\.thumb\..+$"))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2714 ;; ;; Sort function. Compare time between two files.
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2715 ;; '(lambda (l1 l2)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2716 ;; (time-less-p (car l1) (car l2)))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2717 ;; (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) files))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2718 ;; (while (> dirsize tumme-dir-max-size)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2719 ;; (y-or-n-p
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2720 ;; (format "Size of thumbnail directory: %d, delete old file %s? "
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2721 ;; dirsize (cadr (cdar files))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2722 ;; (delete-file (cadr (cdar files)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2723 ;; (setq dirsize (- dirsize (car (cdar files))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2724 ;; (setq files (cdr files)))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2725
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2726 ;;;;;;;;;;;;;;;;;;;;;;,
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2727
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2728 ;; (defun dired-speedbar-buttons (dired-buffer)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2729 ;; (when (and (boundp 'tumme-use-speedbar)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2730 ;; tumme-use-speedbar)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2731 ;; (let ((filename (with-current-buffer dired-buffer
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2732 ;; (dired-get-filename))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2733 ;; (when (and (not (string-equal filename (buffer-string)))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2734 ;; (string-match (image-file-name-regexp) filename))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2735 ;; (erase-buffer)
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2736 ;; (insert (propertize
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2737 ;; filename
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2738 ;; 'display
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2739 ;; (tumme-get-thumbnail-image filename)))))))
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2740
80719021c770 Some user interface changes: added command `tumme', etc.
Mathias Dahl <mathias.dahl@gmail.com>
parents: 68651
diff changeset
2741 ;; (setq tumme-use-speedbar t)
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2742
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2743 (provide 'tumme)
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2744
67318
2bd2f72e4a01 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 67302
diff changeset
2745 ;; arch-tag: 9d11411d-331f-4380-8b44-8adfe3a0343e
67302
ba871f6905f7 New file.
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2746 ;;; tumme.el ends here