annotate lisp/image-dired.el @ 97293:bfe6068912b0

* symbols.texi (Other Plists): Fix incorrect example. Suggested by Florian Beck.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 05 Aug 2008 20:58:21 +0000
parents 522e28ddd67f
children 814d2d823dd7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; image-dired.el --- use dired to browse and manipulate your images
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2 ;;
79721
73661ddc7ac7 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78964
diff changeset
3 ;; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Version: 0.4.11
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Keywords: multimedia
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Author: Mathias Dahl <mathias.rem0veth1s.dahl@gmail.com>
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94268
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94268
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94268
diff changeset
14 ;; (at your option) any later version.
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 94268
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;; Commentary:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; BACKGROUND
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; ==========
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; I needed a program to browse, organize and tag my pictures. I got
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; tired of the old gallery program I used as it did not allow
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;; multi-file operations easily. Also, it put things out of my
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 ;; control. Image viewing programs I tested did not allow multi-file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 ;; operations or did not do what I wanted it to.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;; So, I got the idea to use the wonderful functionality of Emacs and
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;; `dired' to do it. It would allow me to do almost anything I wanted,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 ;; which is basically just to browse all my pictures in an easy way,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 ;; letting me manipulate and tag them in various ways. `dired' already
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 ;; provide all the file handling and navigation facilities; I only
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 ;; needed to add some functions to display the images.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 ;; I briefly tried out thumbs.el, and although it seemed more
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 ;; powerful than this package, it did not work the way I wanted to. It
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 ;; was too slow to created thumbnails of all files in a directory (I
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 ;; currently keep all my 2000+ images in the same directory) and
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 ;; browsing the thumbnail buffer was slow too. image-dired.el will not
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 ;; create thumbnails until they are needed and the browsing is done
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 ;; quickly and easily in dired. I copied a great deal of ideas and
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 ;; code from there though... :)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 ;; `image-dired' stores the thumbnail files in `image-dired-dir'
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;; using the file name format ORIGNAME.thumb.ORIGEXT. For example
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 ;; ~/.emacs.d/image-dired/myimage01.thumb.jpg. The "database" is for
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 ;; now just a plain text file with the following format:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 ;; file-name-non-directory;comment:comment-text;tag1;tag2;tag3;...;tagN
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 ;; PREREQUISITES
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 ;; =============
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 ;; * The ImageMagick package. Currently, `convert' and `mogrify' are
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 ;; used. Find it here: http://www.imagemagick.org.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 ;; * For non-lossy rotation of JPEG images, the JpegTRAN program is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 ;; needed.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 ;; * For `image-dired-get-exif-data' and `image-dired-write-exif-data' to work,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 ;; the command line tool `exiftool' is needed. It can be found here:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 ;; http://www.sno.phy.queensu.ca/~phil/exiftool/. These two functions
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 ;; are, among other things, used for writing comments to image files
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 ;; using `image-dired-thumbnail-set-image-description' and to create
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 ;; "unique" file names using `image-dired-get-exif-file-name' (used by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 ;; `image-dired-copy-with-exif-file-name').
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 ;; USAGE
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 ;; =====
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 ;; This information has been moved to the manual. Type `C-h r' to open
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 ;; the Emacs manual and go to the node Thumbnails by typing `g
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 ;; Thumbnails RET'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 ;; Quickstart: M-x image-dired RET DIRNAME RET
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 ;; where DIRNAME is a directory containing image files.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 ;; LIMITATIONS
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 ;; ===========
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 ;; * Supports all image formats that Emacs and convert supports, but
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 ;; the thumbnails are hard-coded to JPEG format.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 ;; * WARNING: The "database" format used might be changed so keep a
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;; backup of `image-dired-db-file' when testing new versions.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 ;; TODO
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 ;; ====
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 ;; * Support gallery creation when using per-directory thumbnail
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 ;; storage.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 ;; * Some sort of auto-rotate function based on rotate info in the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 ;; EXIF data.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 ;; * Check if exiftool exist before trying to call it to give a better
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 ;; error message.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ;; * Investigate if it is possible to also write the tags to the image
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 ;; files.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 ;; * From thumbs.el: Add an option for clean-up/max-size functionality
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 ;; for thumbnail directory.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 ;; * From thumbs.el: Add setroot function.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 ;; * From thumbs.el: Add image resizing, if useful (image-dired's automatic
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 ;; "image fit" might be enough)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 ;; * From thumbs.el: Add the "modify" commands (emboss, negate,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 ;; monochrome etc).
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 ;; * Asynchronous creation of thumbnails.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 ;; * Add `image-dired-display-thumbs-ring' and functions to cycle that. Find
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 ;; out which is best, saving old batch just before inserting new, or
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 ;; saving the current batch in the ring when inserting it. Adding it
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 ;; probably needs rewriting `image-dired-display-thumbs' to be more general.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 ;; * Find some way of toggling on and off really nice keybindings in
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 ;; dired (for example, using C-n or <down> instead of C-S-n). Richard
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 ;; suggested that we could keep C-t as prefix for image-dired commands
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 ;; as it is currently not used in dired. He also suggested that
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 ;; `dired-next-line' and `dired-previous-line' figure out if
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 ;; image-dired is enabled in the current buffer and, if it is, call
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 ;; `image-dired-dired-next-line' and
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 ;; `image-dired-dired-previous-line', respectively. Update: This is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 ;; partly done; some bindings have now been added to dired.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 ;; * Enhanced gallery creation with basic CSS-support and pagination
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 ;; of tag pages with many pictures.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 ;; * Rewrite `image-dired-modify-mark-on-thumb-original-file' to be
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 ;; less ugly.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 ;; * In some way keep track of buffers and windows and stuff so that
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 ;; it works as the user expects.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 ;; * More/better documentation
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 ;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 ;;; Code:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (require 'dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (require 'format-spec)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (require 'widget)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (eval-when-compile
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 (require 'wid-edit))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (defgroup image-dired nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 "Use dired to browse your images as thumbnails, and more."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 :prefix "image-dired-"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 :group 'multimedia)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166
81347
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
167 (defcustom image-dired-dir (concat user-emacs-directory "image-dired/")
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 "Directory where thumbnail images are stored."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 (defcustom image-dired-thumbnail-storage 'use-image-dired-dir
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 "How to store image-dired's thumbnail files.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 Image-Dired can store thumbnail files in one of two ways and this is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 controlled by this variable. \"Use image-dired dir\" means that the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 thumbnails are stored in a central directory. \"Per directory\"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 means that each thumbnail is stored in a subdirectory called
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 \".image-dired\" in the same directory where the image file is.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 \"Thumbnail Managing Standard\" means that the thumbnails are
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 stored and generated according to the Thumbnail Managing Standard
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 that allows sharing of thumbnails across different programs."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 :type '(choice :tag "How to store thumbnail files"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (const :tag "Thumbnail Managing Standard" standard)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (const :tag "Use image-dired-dir" use-image-dired-dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 (const :tag "Per-directory" per-directory))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187
81347
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
188 (defcustom image-dired-db-file
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
189 (concat user-emacs-directory "image-dired/.image-dired_db")
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 "Database file where file names and their associated tags are stored."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193
81347
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
194 (defcustom image-dired-temp-image-file
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
195 (concat user-emacs-directory "image-dired/.image-dired_temp")
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 "Name of temporary image file used by various commands."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199
81347
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
200 (defcustom image-dired-gallery-dir
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
201 (concat user-emacs-directory "image-dired/.image-dired_gallery")
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 "Directory to store generated gallery html pages.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 This path needs to be \"shared\" to the public so that it can access
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 the index.html page that image-dired creates."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (defcustom image-dired-gallery-image-root-url
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 "http://your.own.server/image-diredpics"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 "URL where the full size images are to be found.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 Note that this path has to be configured in your web server. Image-Dired
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 expects to find pictures in this directory."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (defcustom image-dired-gallery-thumb-image-root-url
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 "http://your.own.server/image-diredthumbs"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 "URL where the thumbnail images are to be found.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 Note that this path has to be configured in your web server. Image-Dired
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 expects to find pictures in this directory."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (defcustom image-dired-cmd-create-thumbnail-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 "convert"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 "Executable used to create thumbnail.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 Used together with `image-dired-cmd-create-thumbnail-options'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (defcustom image-dired-cmd-create-thumbnail-options
96822
522e28ddd67f (image-dired-cmd-create-thumbnail-options)
Juri Linkov <juri@jurta.org>
parents: 95841
diff changeset
232 "%p -size %wx%h \"%f\" -resize \"%wx%h>\" -strip jpeg:\"%t\""
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 "Format of command used to create thumbnail image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 Available options are %p which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 `image-dired-cmd-create-thumbnail-program', %w which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 `image-dired-thumb-width', %h which is replaced by `image-dired-thumb-height',
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 %f which is replaced by the file name of the original image and %t
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 which is replaced by the file name of the thumbnail file."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (defcustom image-dired-cmd-create-temp-image-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 "convert"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 "Executable used to create temporary image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 Used together with `image-dired-cmd-create-temp-image-options'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 (defcustom image-dired-cmd-create-temp-image-options
96822
522e28ddd67f (image-dired-cmd-create-thumbnail-options)
Juri Linkov <juri@jurta.org>
parents: 95841
diff changeset
250 "%p -size %wx%h \"%f\" -resize \"%wx%h>\" -strip jpeg:\"%t\""
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 "Format of command used to create temporary image for display window.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 Available options are %p which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 `image-dired-cmd-create-temp-image-program', %w and %h which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 the calculated max size for width and height in the image display window,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 %f which is replaced by the file name of the original image and %t which
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 is replaced by the file name of the temporary file."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 (defcustom image-dired-cmd-pngnq-program (executable-find "pngnq")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 "The file name of the `pngnq' program.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 It quantizes colors of PNG images down to 256 colors."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 :type '(choice (const :tag "Not Set" nil) string)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 (defcustom image-dired-cmd-pngcrush-program (executable-find "pngcrush")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 "The file name of the `pngcrush' program.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 It optimizes the compression of PNG images. Also it adds PNG textual chunks
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 with the information required by the Thumbnail Managing Standard."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 :type '(choice (const :tag "Not Set" nil) string)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (defcustom image-dired-cmd-create-standard-thumbnail-command
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (concat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 image-dired-cmd-create-thumbnail-program " "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 "-size %wx%h \"%f\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 (unless (or image-dired-cmd-pngcrush-program image-dired-cmd-pngnq-program)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 (concat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 "-set \"Thumb::MTime\" \"%m\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 "-set \"Thumb::URI\" \"file://%f\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 "-set \"Description\" \"Thumbnail of file://%f\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 "-set \"Software\" \"" (emacs-version) "\" "))
96822
522e28ddd67f (image-dired-cmd-create-thumbnail-options)
Juri Linkov <juri@jurta.org>
parents: 95841
diff changeset
283 "-thumbnail \"%wx%h>\" png:\"%t\""
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 (if image-dired-cmd-pngnq-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (concat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 " ; " image-dired-cmd-pngnq-program " -f \"%t\""
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (unless image-dired-cmd-pngcrush-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 " ; mv %q %t")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (if image-dired-cmd-pngcrush-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 (concat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 (unless image-dired-cmd-pngcrush-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 " ; cp %t %q")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 " ; " image-dired-cmd-pngcrush-program " -q "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 "-text b \"Description\" \"Thumbnail of file://%f\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 "-text b \"Software\" \"" (emacs-version) "\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 ;; "-text b \"Thumb::Image::Height\" \"%oh\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 ;; "-text b \"Thumb::Image::Mimetype\" \"%mime\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 ;; "-text b \"Thumb::Image::Width\" \"%ow\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 "-text b \"Thumb::MTime\" \"%m\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 ;; "-text b \"Thumb::Size\" \"%b\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 "-text b \"Thumb::URI\" \"file://%f\" "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 "%q %t"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 " ; rm %q")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 "Command to create thumbnails according to the Thumbnail Managing Standard."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 (defcustom image-dired-cmd-rotate-thumbnail-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 "mogrify"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 "Executable used to rotate thumbnail.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 Used together with `image-dired-cmd-rotate-thumbnail-options'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 (defcustom image-dired-cmd-rotate-thumbnail-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 "%p -rotate %d \"%t\""
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 "Format of command used to rotate thumbnail image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 Available options are %p which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 `image-dired-cmd-rotate-thumbnail-program', %d which is replaced by the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 number of (positive) degrees to rotate the image, normally 90 or 270
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 \(for 90 degrees right and left), %t which is replaced by the file name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 of the thumbnail file."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 (defcustom image-dired-cmd-rotate-original-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 "jpegtran"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 "Executable used to rotate original image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 Used together with `image-dired-cmd-rotate-original-options'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 (defcustom image-dired-cmd-rotate-original-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 "%p -rotate %d -copy all -outfile %t \"%o\""
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 "Format of command used to rotate original image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 Available options are %p which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 `image-dired-cmd-rotate-original-program', %d which is replaced by the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 number of (positive) degrees to rotate the image, normally 90 or
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 270 \(for 90 degrees right and left), %o which is replaced by the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 original image file name and %t which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 `image-dired-temp-image-file'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 (defcustom image-dired-temp-rotate-image-file
81347
2a989ff22a03 (image-dired-dir): Use user-emacs-directory.
Chong Yidong <cyd@stupidchicken.com>
parents: 77585
diff changeset
346 (concat user-emacs-directory "image-dired/.image-dired_rotate_temp")
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 "Temporary file for rotate operations."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 (defcustom image-dired-rotate-original-ask-before-overwrite t
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 "Confirm overwrite of original file after rotate operation.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 If non-nil, ask user for confirmation before overwriting the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 original file with `image-dired-temp-rotate-image-file'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 :type 'boolean
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (defcustom image-dired-cmd-write-exif-data-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 "exiftool"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 "Program used to write EXIF data to image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 Used together with `image-dired-cmd-write-exif-data-options'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (defcustom image-dired-cmd-write-exif-data-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 "%p -%t=\"%v\" \"%f\""
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 "Format of command used to write EXIF data.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 Available options are %p which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 `image-dired-cmd-write-exif-data-program', %f which is replaced by the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 image file name, %t which is replaced by the tag name and %v
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 which is replaced by the tag value."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 (defcustom image-dired-cmd-read-exif-data-program
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 "exiftool"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 "Program used to read EXIF data to image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 Used together with `image-dired-cmd-read-exif-data-program-options'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 (defcustom image-dired-cmd-read-exif-data-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 "%p -s -s -s -%t \"%f\""
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 "Format of command used to read EXIF data.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 Available options are %p which is replaced by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 `image-dired-cmd-write-exif-data-options', %f which is replaced
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 by the image file name and %t which is replaced by the tag name."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 (defcustom image-dired-gallery-hidden-tags
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 (list "private" "hidden" "pending")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 "List of \"hidden\" tags.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 Used by `image-dired-gallery-generate' to leave out \"hidden\" images."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 :type '(repeat string)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 (defcustom image-dired-thumb-size (if (eq 'standard image-dired-thumbnail-storage) 128 100)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 "Size of thumbnails, in pixels.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 This is the default size for both `image-dired-thumb-width' and `image-dired-thumb-height'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (defcustom image-dired-thumb-width image-dired-thumb-size
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 "Width of thumbnails, in pixels."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (defcustom image-dired-thumb-height image-dired-thumb-size
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 "Height of thumbnails, in pixels."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 (defcustom image-dired-thumb-relief 2
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 "Size of button-like border around thumbnails."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 (defcustom image-dired-thumb-margin 2
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 "Size of the margin around thumbnails.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 This is where you see the cursor."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 (defcustom image-dired-line-up-method 'dynamic
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 "Default method for line-up of thumbnails in thumbnail buffer.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 Used by `image-dired-display-thumbs' and other functions that needs to
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 line-up thumbnails. Dynamic means to use the available width of the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 window containing the thumbnail buffer, Fixed means to use
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 `image-dired-thumbs-per-row', Interactive is for asking the user, and No
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 line-up means that no automatic line-up will be done."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 :type '(choice :tag "Default line-up method"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (const :tag "Dynamic" dynamic)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 (const :tag "Fixed" fixed)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (const :tag "Interactive" interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 (const :tag "No line-up" none))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 (defcustom image-dired-thumbs-per-row 3
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 "Number of thumbnails to display per row in thumb buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 (defcustom image-dired-display-window-width-correction 1
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 "Number to be used to correct image display window width.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 Change if the default (1) does not work (i.e. if the image does not
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 completely fit)."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 (defcustom image-dired-display-window-height-correction 0
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 "Number to be used to correct image display window height.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 Change if the default (0) does not work (i.e. if the image does not
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 completely fit)."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 (defcustom image-dired-track-movement t
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 "The current state of the tracking and mirroring.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 For more information, see the documentation for
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 `image-dired-toggle-movement-tracking'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 :type 'boolean
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (defcustom image-dired-append-when-browsing nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 "Append thumbnails in thumbnail buffer when browsing.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 If non-nil, using `image-dired-next-line-and-display' and
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 `image-dired-previous-line-and-display' will leave a trail of thumbnail
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 images in the thumbnail buffer. If you enable this and want to clean
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 the thumbnail buffer because it is filled with too many thumbmnails,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 just call `image-dired-display-thumb' to display only the image at point.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 This value can be toggled using `image-dired-toggle-append-browsing'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 :type 'boolean
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 (defcustom image-dired-dired-disp-props t
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 "If non-nil, display properties for dired file when browsing.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 Used by `image-dired-next-line-and-display',
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 `image-dired-previous-line-and-display' and `image-dired-mark-and-display-next'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 If the database file is large, this can slow down image browsing in
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 dired and you might want to turn it off."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 :type 'boolean
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 (defcustom image-dired-display-properties-format "%b: %f (%t): %c"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 "Display format for thumbnail properties.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 %b is replaced with associated dired buffer name, %f with file name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 \(without path) of original image file, %t with the list of tags and %c
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 with the comment."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 (defcustom image-dired-external-viewer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 ;; TODO: Use mailcap, dired-guess-shell-alist-default,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 ;; dired-view-command-alist.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 (cond ((executable-find "display"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 ((executable-find "xli"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 ((executable-find "qiv") "qiv -t"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 "Name of external viewer.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 Including parameters. Used when displaying original image from
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 `image-dired-thumbnail-mode'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 (defcustom image-dired-main-image-directory "~/pics/"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 "Name of main image directory, if any.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 Used by `image-dired-copy-with-exif-file-name'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 :type 'string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 (defcustom image-dired-show-all-from-dir-max-files 50
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 "Maximum number of files to show using `image-dired-show-all-from-dir'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 before warning the user."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 :type 'integer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 :group 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 (defun image-dired-dir ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 "Return the current thumbnails directory (from variable `image-dired-dir').
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 Create the thumbnails directory if it does not exist."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 (let ((image-dired-dir (file-name-as-directory
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 (expand-file-name image-dired-dir))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 (unless (file-directory-p image-dired-dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (make-directory image-dired-dir t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (message "Creating thumbnails directory"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 image-dired-dir))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 (defun image-dired-insert-image (file type relief margin)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 "Insert image FILE of image TYPE, using RELIEF and MARGIN, at point."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 (let ((i `(image :type ,type
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 :file ,file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 :relief ,relief
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 :margin ,margin)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 (insert-image i)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 (defun image-dired-get-thumbnail-image (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 "Return the image descriptor for a thumbnail of image file FILE."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 (unless (string-match (image-file-name-regexp) file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 (error "%s is not a valid image file" file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 (let ((thumb-file (image-dired-thumb-name file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541 (unless (and (file-exists-p thumb-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 (<= (float-time (nth 5 (file-attributes file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 (float-time (nth 5 (file-attributes thumb-file)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 (image-dired-create-thumb file thumb-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 (create-image thumb-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 ;; (list 'image :type 'jpeg
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 ;; :file thumb-file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 ;; :relief image-dired-thumb-relief :margin image-dired-thumb-margin)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 ))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 (defun image-dired-insert-thumbnail (file original-file-name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 associated-dired-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 "Insert thumbnail image FILE.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 Add text properties ORIGINAL-FILE-NAME and ASSOCIATED-DIRED-BUFFER."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 (let (beg end)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 (setq beg (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 (image-dired-insert-image file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 ;; TODO: this should depend on the real file type
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (if (eq 'standard image-dired-thumbnail-storage)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 'png 'jpeg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
561 image-dired-thumb-relief
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 image-dired-thumb-margin)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564 (add-text-properties
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 beg end
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 (list 'image-dired-thumbnail t
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 'original-file-name original-file-name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568 'associated-dired-buffer associated-dired-buffer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 'tags (image-dired-list-tags original-file-name)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570 'mouse-face 'highlight
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571 'comment (image-dired-get-comment original-file-name)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 (defun image-dired-thumb-name (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 "Return thumbnail file name for FILE.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 Depending on the value of `image-dired-thumbnail-storage', the file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 name will vary. For central thumbnail file storage, make a
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577 MD5-hash of the image file's directory name and add that to make
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 the thumbnail file name unique. For per-directory storage, just
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 add a subdirectory. For standard storage, produce the file name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 according to the Thumbnail Managing Standard."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 (cond ((eq 'standard image-dired-thumbnail-storage)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 (expand-file-name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 (concat "~/.thumbnails/normal/"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584 (md5 (concat "file://" (expand-file-name file))) ".png")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 ((eq 'use-image-dired-dir image-dired-thumbnail-storage)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 (let* ((f (expand-file-name file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 (md5-hash
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 ;; Is MD5 hashes fast enough? The checksum of a
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 ;; thumbnail file name need not be that
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590 ;; "cryptographically" good so a faster one could
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 ;; be used here.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 (md5 (file-name-as-directory (file-name-directory f)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 (format "%s%s%s.thumb.%s"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 (file-name-as-directory (expand-file-name (image-dired-dir)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 (file-name-sans-extension (file-name-nondirectory f))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596 (if md5-hash (concat "_" md5-hash) "")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 (file-name-extension f))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 ((eq 'per-directory image-dired-thumbnail-storage)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599 (let ((f (expand-file-name file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600 (format "%s.image-dired/%s.thumb.%s"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
601 (file-name-directory f)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
602 (file-name-sans-extension (file-name-nondirectory f))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603 (file-name-extension f))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605 (defun image-dired-create-thumb (original-file thumbnail-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606 "For ORIGINAL-FILE, create thumbnail image named THUMBNAIL-FILE."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 (let* ((width (int-to-string image-dired-thumb-width))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
608 (height (int-to-string image-dired-thumb-height))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
609 (modif-time (format "%.0f" (float-time (nth 5 (file-attributes
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610 original-file)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611 (thumbnail-nq8-file (replace-regexp-in-string ".png\\'" "-nq8.png"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 thumbnail-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 (command
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 (format-spec
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
615 (if (eq 'standard image-dired-thumbnail-storage)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
616 image-dired-cmd-create-standard-thumbnail-command
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
617 image-dired-cmd-create-thumbnail-options)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
618 (list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
619 (cons ?p image-dired-cmd-create-thumbnail-program)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620 (cons ?w width)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621 (cons ?h height)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 (cons ?m modif-time)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623 (cons ?f original-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
624 (cons ?q thumbnail-nq8-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
625 (cons ?t thumbnail-file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
626 thumbnail-dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 (when (not (file-exists-p
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 (setq thumbnail-dir (file-name-directory thumbnail-file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 (message "Creating thumbnail directory.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630 (make-directory thumbnail-dir))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 (call-process shell-file-name nil nil nil shell-command-switch command)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
632
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 (defun image-dired-dired-insert-marked-thumbs ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 "Insert thumbnails before file names of marked files in the dired buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
637 (dired-map-over-marks
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 (let* ((image-pos (dired-move-to-filename))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
639 (image-file (dired-get-filename))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640 (thumb-file (image-dired-get-thumbnail-image image-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 overlay)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 ;; If image is not already added, then add it.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 (unless (delq nil (mapcar (lambda (o) (overlay-get o 'put-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644 ;; Can't use (overlays-at (point)), BUG?
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 (overlays-in (point) (1+ (point)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646 (put-image thumb-file image-pos)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647 (setq
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 overlay
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649 (car (delq nil (mapcar (lambda (o) (and (overlay-get o 'put-image) o))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 (overlays-in (point) (1+ (point)))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 (overlay-put overlay 'image-file image-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 (overlay-put overlay 'thumb-file thumb-file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 nil)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 (add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 (defun image-dired-dired-after-readin-hook ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 "Relocate existing thumbnail overlays in dired buffer after reverting.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 Move them to their corresponding files if they are still exist.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 Otherwise, delete overlays."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 (mapc (lambda (overlay)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 (when (overlay-get overlay 'put-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (let* ((image-file (overlay-get overlay 'image-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (image-pos (dired-goto-file image-file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 (if image-pos
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665 (move-overlay overlay image-pos image-pos)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 (delete-overlay overlay)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667 (overlays-in (point-min) (point-max))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 (defun image-dired-next-line-and-display ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 "Move to next dired line and display thumbnail image."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 (dired-next-line 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 (image-dired-display-thumbs
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674 t (or image-dired-append-when-browsing nil) t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 (if image-dired-dired-disp-props
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 (image-dired-dired-display-properties)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 (defun image-dired-previous-line-and-display ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679 "Move to previous dired line and display thumbnail image."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681 (dired-previous-line 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682 (image-dired-display-thumbs
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 t (or image-dired-append-when-browsing nil) t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 (if image-dired-dired-disp-props
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 (image-dired-dired-display-properties)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 (defun image-dired-toggle-append-browsing ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688 "Toggle `image-dired-append-when-browsing'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690 (setq image-dired-append-when-browsing
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691 (not image-dired-append-when-browsing))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692 (message "Append browsing %s."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693 (if image-dired-append-when-browsing
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 "on"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695 "off")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
696
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 (defun image-dired-mark-and-display-next ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
698 "Mark current file in dired and display next thumbnail image."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
699 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700 (dired-mark 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
701 (image-dired-display-thumbs
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
702 t (or image-dired-append-when-browsing nil) t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
703 (if image-dired-dired-disp-props
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704 (image-dired-dired-display-properties)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
706 (defun image-dired-toggle-dired-display-properties ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
707 "Toggle `image-dired-dired-disp-props'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
708 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
709 (setq image-dired-dired-disp-props
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
710 (not image-dired-dired-disp-props))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
711 (message "Dired display properties %s."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
712 (if image-dired-dired-disp-props
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
713 "on"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 "off")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
715
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
716 (defvar image-dired-thumbnail-buffer "*image-dired*"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
717 "Image-Dired's thumbnail buffer.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
718
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719 (defun image-dired-create-thumbnail-buffer ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
720 "Create thumb buffer and set `image-dired-thumbnail-mode'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
721 (let ((buf (get-buffer-create image-dired-thumbnail-buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
722 (with-current-buffer buf
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
723 (setq buffer-read-only t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
724 (if (not (eq major-mode 'image-dired-thumbnail-mode))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
725 (image-dired-thumbnail-mode)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
726 buf))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
727
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
728 (defvar image-dired-display-image-buffer "*image-dired-display-image*"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 "Where larger versions of the images are display.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 (defun image-dired-create-display-image-buffer ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732 "Create image display buffer and set `image-dired-display-image-mode'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 (let ((buf (get-buffer-create image-dired-display-image-buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734 (with-current-buffer buf
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
735 (setq buffer-read-only t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 (if (not (eq major-mode 'image-dired-display-image-mode))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
737 (image-dired-display-image-mode)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
738 buf))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 (defvar image-dired-saved-window-configuration nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
741 "Saved window configuration.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
742
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
743 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
744 (defun image-dired-dired-with-window-configuration (dir &optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
745 "Open directory DIR and create a default window configuration.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
746
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
747 Convenience command that:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
748
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
749 - Opens dired in folder DIR
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
750 - Splits windows in most useful (?) way
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
751 - Set `truncate-lines' to t
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
752
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
753 After the command has finished, you would typically mark some
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
754 image files in dired and type
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
755 \\[image-dired-display-thumbs] (`image-dired-display-thumbs').
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
756
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
757 If called with prefix argument ARG, skip splitting of windows.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
758
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
759 The current window configuration is saved and can be restored by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
760 calling `image-dired-restore-window-configuration'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
761 (interactive "DDirectory: \nP")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
762 (let ((buf (image-dired-create-thumbnail-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
763 (buf2 (image-dired-create-display-image-buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
764 (setq image-dired-saved-window-configuration
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
765 (current-window-configuration))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
766 (dired dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
767 (delete-other-windows)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
768 (when (not arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
769 (split-window-horizontally)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
770 (setq truncate-lines t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
771 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
772 (other-window 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
773 (switch-to-buffer buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
774 (split-window-vertically)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
775 (other-window 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
776 (switch-to-buffer buf2)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
777 (other-window -2)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
778
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
779 (defun image-dired-restore-window-configuration ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
780 "Restore window configuration.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
781 Restore any changes to the window configuration made by calling
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
782 `image-dired-dired-with-window-configuration'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
783 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
784 (if image-dired-saved-window-configuration
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
785 (set-window-configuration image-dired-saved-window-configuration)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
786 (message "No saved window configuration")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
787
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
788 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
789 (defun image-dired-display-thumbs (&optional arg append do-not-pop)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
790 "Display thumbnails of all marked files, in `image-dired-thumbnail-buffer'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
791 If a thumbnail image does not exist for a file, it is created on the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
792 fly. With prefix argument ARG, display only thumbnail for file at
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
793 point (this is useful if you have marked some files but want to show
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
794 another one).
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
795
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
796 Recommended usage is to split the current frame horizontally so that
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
797 you have the dired buffer in the left window and the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
798 `image-dired-thumbnail-buffer' buffer in the right window.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
799
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
800 With optional argument APPEND, append thumbnail to thumbnail buffer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
801 instead of erasing it first.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
802
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
803 Option argument DO-NOT-POP controls if `pop-to-buffer' should be
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
804 used or not. If non-nil, use `display-buffer' instead of
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
805 `pop-to-buffer'. This is used from functions like
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
806 `image-dired-next-line-and-display' and
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
807 `image-dired-previous-line-and-display' where we do not want the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
808 thumbnail buffer to be selected."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
809 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
810 (let ((buf (image-dired-create-thumbnail-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
811 curr-file thumb-name files count dired-buf beg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
812 (if arg
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
813 (setq files (list (dired-get-filename)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
814 (setq files (dired-get-marked-files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
815 (setq dired-buf (current-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
816 (with-current-buffer buf
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
817 (let ((inhibit-read-only t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
818 (if (not append)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
819 (erase-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
820 (goto-char (point-max)))
84874
e971b563a3eb (image-dired-display-thumbs, image-dired-remove-tag,
Juanma Barranquero <lekktu@gmail.com>
parents: 82140
diff changeset
821 (mapc
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
822 (lambda (curr-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
823 (setq thumb-name (image-dired-thumb-name curr-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
824 (if (and (not (file-exists-p thumb-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
825 (not (= 0 (image-dired-create-thumb curr-file thumb-name))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
826 (message "Thumb could not be created for file %s" curr-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
827 (image-dired-insert-thumbnail thumb-name curr-file dired-buf)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
828 files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
829 (cond ((eq 'dynamic image-dired-line-up-method)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
830 (image-dired-line-up-dynamic))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
831 ((eq 'fixed image-dired-line-up-method)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
832 (image-dired-line-up))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
833 ((eq 'interactive image-dired-line-up-method)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
834 (image-dired-line-up-interactive))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
835 ((eq 'none image-dired-line-up-method)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
836 nil)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
837 (t
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
838 (image-dired-line-up-dynamic))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
839 (if do-not-pop
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
840 (display-buffer image-dired-thumbnail-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
841 (pop-to-buffer image-dired-thumbnail-buffer))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
842
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
843 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
844 (defun image-dired-show-all-from-dir (dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
845 "Make a preview buffer for all images in DIR and display it.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
846 If the number of files in DIR matching `image-file-name-regexp'
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
847 exceeds `image-dired-show-all-from-dir-max-files', a warning will be
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
848 displayed."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
849 (interactive "DDir: ")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
850 (dired dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
851 (dired-mark-files-regexp (image-file-name-regexp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
852 (let ((files (dired-get-marked-files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
853 (if (or (<= (length files) image-dired-show-all-from-dir-max-files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
854 (and (> (length files) image-dired-show-all-from-dir-max-files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
855 (y-or-n-p
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
856 (format
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
857 "Directory contains more than %d image files. Proceed? "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
858 image-dired-show-all-from-dir-max-files))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
859 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
860 (image-dired-display-thumbs)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
861 (pop-to-buffer image-dired-thumbnail-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
862 (message "Cancelled."))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
863
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
864 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
865 (defalias 'image-dired 'image-dired-show-all-from-dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
866
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
867 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
868 (defalias 'tumme 'image-dired-show-all-from-dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
869
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
870 (defun image-dired-sane-db-file ()
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
871 "Check if `image-dired-db-file' exists.
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
872 If not, try to create it (including any parent directories).
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
873 Signal error if there are problems creating it."
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
874 (or (file-exists-p image-dired-db-file)
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
875 (let (dir buf)
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
876 (unless (file-directory-p (setq dir (file-name-directory
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
877 image-dired-db-file)))
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
878 (make-directory dir t))
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
879 (with-current-buffer (setq buf (create-file-buffer
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
880 image-dired-db-file))
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
881 (write-file image-dired-db-file))
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
882 (kill-buffer buf)
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
883 (file-exists-p image-dired-db-file))
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
884 (error "Could not create %s" image-dired-db-file)))
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
885
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
886 (defun image-dired-write-tags (file-tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
887 "Write file tags to database.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
888 Write each file and tag in FILE-TAGS to the database. FILE-TAGS
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
889 is an alist in the following form:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
890 ((FILE . TAG) ... )"
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
891 (image-dired-sane-db-file)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
892 (let (end file tag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
893 (with-temp-file image-dired-db-file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
894 (insert-file-contents image-dired-db-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
895 (dolist (elt file-tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
896 (setq file (car elt)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
897 tag (cdr elt))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
898 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
899 (if (search-forward-regexp (format "^%s.*$" file) nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
900 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
901 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
902 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
903 (when (not (search-forward (format ";%s" tag) end t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
904 (end-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
905 (insert (format ";%s" tag))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
906 (goto-char (point-max))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
907 (insert (format "\n%s;%s" file tag)))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
908
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
909 (defun image-dired-remove-tag (files tag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
910 "For all FILES, remove TAG from the image database."
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
911 (image-dired-sane-db-file)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
912 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
913 (let (end buf start)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
914 (setq buf (find-file image-dired-db-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
915 (if (not (listp files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
916 (if (stringp files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
917 (setq files (list files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
918 (error "Files must be a string or a list of strings!")))
84874
e971b563a3eb (image-dired-display-thumbs, image-dired-remove-tag,
Juanma Barranquero <lekktu@gmail.com>
parents: 82140
diff changeset
919 (mapc
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
920 (lambda (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
921 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
922 (when (search-forward-regexp
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
923 (format "^%s" file) nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
924 (end-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
925 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
926 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
927 (when (search-forward-regexp (format "\\(;%s\\)" tag) end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
928 (delete-region (match-beginning 1) (match-end 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
929 ;; Check if file should still be in the database. If
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
930 ;; it has no tags or comments, it will be removed.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
931 (end-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
932 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
933 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
934 (when (not (search-forward ";" end t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
935 (kill-line 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
936 ;; If on empty line at end of buffer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
937 (when (and (eobp)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
938 (looking-at "^$"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
939 (delete-backward-char 1))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
940 files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
941 (save-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
942 (kill-buffer buf))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
943
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
944 (defun image-dired-list-tags (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
945 "Read all tags for image FILE from the image database."
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
946 (image-dired-sane-db-file)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
947 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
948 (let (end buf (tags ""))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
949 (setq buf (find-file image-dired-db-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
950 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
951 (when (search-forward-regexp
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
952 (format "^%s" file) nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
953 (end-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
954 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
955 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
956 (if (search-forward ";" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
957 (if (search-forward "comment:" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
958 (if (search-forward ";" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
959 (setq tags (buffer-substring (point) end)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
960 (setq tags (buffer-substring (point) end)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
961 (kill-buffer buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
962 (split-string tags ";"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
963
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
964 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
965 (defun image-dired-tag-files (arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
966 "Tag marked file(s) in dired. With prefix ARG, tag file at point."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
967 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
968 (let ((tag (read-string "Tags to add (separate tags with a semicolon): "))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
969 curr-file files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
970 (if arg
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
971 (setq files (list (dired-get-filename)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
972 (setq files (dired-get-marked-files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
973 (image-dired-write-tags
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
974 (mapcar
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
975 (lambda (x)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
976 (cons x tag))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
977 files))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
978
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
979 (defun image-dired-tag-thumbnail ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
980 "Tag current thumbnail."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
981 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
982 (let ((tag (read-string "Tags to add (separate tags with a semicolon): ")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
983 (image-dired-write-tags (list (cons (image-dired-original-file-name) tag))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
984 (image-dired-update-property
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
985 'tags (image-dired-list-tags (image-dired-original-file-name))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
986
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
987 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
988 (defun image-dired-delete-tag (arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
989 "Remove tag for selected file(s).
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
990 With prefix argument ARG, remove tag from file at point."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
991 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
992 (let ((tag (read-string "Tag to remove: "))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
993 files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
994 (if arg
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
995 (setq files (list (dired-get-filename)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
996 (setq files (dired-get-marked-files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
997 (image-dired-remove-tag files tag)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
998
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
999 (defun image-dired-tag-thumbnail-remove ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1000 "Remove tag from thumbnail."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1001 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1002 (let ((tag (read-string "Tag to remove: ")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1003 (image-dired-remove-tag (image-dired-original-file-name) tag))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1004 (image-dired-update-property
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1005 'tags (image-dired-list-tags (image-dired-original-file-name))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1006
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1007 (defun image-dired-original-file-name ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1008 "Get original file name for thumbnail or display image at point."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1009 (get-text-property (point) 'original-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1010
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1011 (defun image-dired-associated-dired-buffer ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1012 "Get associated dired buffer at point."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1013 (get-text-property (point) 'associated-dired-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1014
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1015 (defun image-dired-get-buffer-window (buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1016 "Return window where buffer BUF is."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1017 (get-window-with-predicate
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1018 (lambda (window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1019 (equal (window-buffer window) buf))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1020 nil t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1021
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1022 (defun image-dired-track-original-file ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1023 "Track the original file in the associated dired buffer.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1024 See documentation for `image-dired-toggle-movement-tracking'. Interactive
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1025 use only useful if `image-dired-track-movement' is nil."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1026 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1027 (let ((old-buf (current-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1028 (dired-buf (image-dired-associated-dired-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1029 (file-name (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1030 (when (and (buffer-live-p dired-buf) file-name)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1031 (set-buffer dired-buf)
94268
4cca1963bd37 (image-dired-track-original-file)
Juri Linkov <juri@jurta.org>
parents: 87649
diff changeset
1032 (if (not (dired-goto-file file-name))
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1033 (message "Could not track file")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1034 (set-window-point
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1035 (image-dired-get-buffer-window dired-buf) (point)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1036 (set-buffer old-buf))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1037
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1038 (defun image-dired-toggle-movement-tracking ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1039 "Turn on and off `image-dired-track-movement'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1040 Tracking of the movements between thumbnail and dired buffer so that
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1041 they are \"mirrored\" in the dired buffer. When this is on, moving
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1042 around in the thumbnail or dired buffer will find the matching
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1043 position in the other buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1044 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1045 (setq image-dired-track-movement (not image-dired-track-movement))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1046 (message "Tracking %s" (if image-dired-track-movement "on" "off")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1047
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1048 (defun image-dired-track-thumbnail ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1049 "Track current dired file's thumb in `image-dired-thumbnail-buffer'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1050 This is almost the same as what `image-dired-track-original-file' does, but
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1051 the other way around."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1052 (let ((file (dired-get-filename))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1053 (old-buf (current-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1054 prop-val found)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1055 (when (get-buffer image-dired-thumbnail-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1056 (set-buffer image-dired-thumbnail-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1057 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1058 (while (and (not (eobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1059 (not found))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1060 (if (and (setq prop-val
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1061 (get-text-property (point) 'original-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1062 (string= prop-val file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1063 (setq found t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1064 (if (not found)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1065 (forward-char 1)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1066 (when found
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1067 (set-window-point
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1068 (image-dired-thumbnail-window) (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1069 (image-dired-display-thumb-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1070 (set-buffer old-buf))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1071
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1072 (defun image-dired-dired-next-line (&optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1073 "Call `dired-next-line', then track thumbnail.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1074 This can safely replace `dired-next-line'. With prefix argument, move
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1075 ARG lines."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1076 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1077 (dired-next-line (or arg 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1078 (if image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1079 (image-dired-track-thumbnail)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1080
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1081 (defun image-dired-dired-previous-line (&optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1082 "Call `dired-previous-line', then track thumbnail.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1083 This can safely replace `dired-previous-line'. With prefix argument,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1084 move ARG lines."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1085 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1086 (dired-previous-line (or arg 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1087 (if image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1088 (image-dired-track-thumbnail)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1089
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1090 (defun image-dired-forward-image (&optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1091 "Move to next image and display properties.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1092 Optional prefix ARG says how many images to move; default is one
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1093 image."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1094 (interactive "p")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1095 (let (pos (steps (or arg 1)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1096 (dotimes (i steps)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1097 (if (and (not (eobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1098 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1099 (forward-char)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1100 (while (and (not (eobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1101 (not (image-dired-image-at-point-p)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1102 (forward-char))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1103 (setq pos (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1104 (image-dired-image-at-point-p)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1105 (goto-char pos)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1106 (error "At last image"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1107 (when image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1108 (image-dired-track-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1109 (image-dired-display-thumb-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1110
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1111 (defun image-dired-backward-image (&optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1112 "Move to previous image and display properties.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1113 Optional prefix ARG says how many images to move; default is one
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1114 image."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1115 (interactive "p")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1116 (let (pos (steps (or arg 1)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1117 (dotimes (i steps)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1118 (if (and (not (bobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1119 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1120 (backward-char)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1121 (while (and (not (bobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1122 (not (image-dired-image-at-point-p)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1123 (backward-char))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1124 (setq pos (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1125 (image-dired-image-at-point-p)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1126 (goto-char pos)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1127 (error "At first image"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1128 (when image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1129 (image-dired-track-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1130 (image-dired-display-thumb-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1131
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1132 (defun image-dired-next-line ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1133 "Move to next line and display properties."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1134 (interactive)
85478
786d3a985758 * term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85037
diff changeset
1135 (forward-line 1)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1136 ;; If we end up in an empty spot, back up to the next thumbnail.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1137 (if (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1138 (image-dired-backward-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1139 (if image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1140 (image-dired-track-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1141 (image-dired-display-thumb-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1142
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1143
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1144 (defun image-dired-previous-line ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1145 "Move to previous line and display properties."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1146 (interactive)
85478
786d3a985758 * term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85037
diff changeset
1147 (forward-line -1)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1148 ;; If we end up in an empty spot, back up to the next
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1149 ;; thumbnail. This should only happen if the user deleted a
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1150 ;; thumbnail and did not refresh, so it is not very common. But we
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1151 ;; can handle it in a good manner, so why not?
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1152 (if (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1153 (image-dired-backward-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1154 (if image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1155 (image-dired-track-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1156 (image-dired-display-thumb-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1157
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1158 (defun image-dired-format-properties-string (buf file props comment)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1159 "Format display properties.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1160 BUF is the associated dired buffer, FILE is the original image file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1161 name, PROPS is a list of tags and COMMENT is the image files's
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1162 comment."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1163 (format-spec
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1164 image-dired-display-properties-format
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1165 (list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1166 (cons ?b (or buf ""))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1167 (cons ?f file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1168 (cons ?t (or (princ props) ""))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1169 (cons ?c (or comment "")))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1170
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1171 (defun image-dired-display-thumb-properties ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1172 "Display thumbnail properties in the echo area."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1173 (if (not (eobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1174 (let ((file-name (file-name-nondirectory (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1175 (dired-buf (buffer-name (image-dired-associated-dired-buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1176 (props (mapconcat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1177 'princ
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1178 (get-text-property (point) 'tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1179 ", "))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1180 (comment (get-text-property (point) 'comment)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1181 (if file-name
87096
a99a2e8bc21e Fix possibly buggy calls to `message'.
Deepak Goel <deego@gnufans.org>
parents: 85478
diff changeset
1182 (message "%s"
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1183 (image-dired-format-properties-string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1184 dired-buf
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1185 file-name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1186 props
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1187 comment))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1188
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1189 (defun image-dired-dired-file-marked-p ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1190 "Check whether file on current line is marked or not."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1191 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1192 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1193 (not (looking-at "^ .*$"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1194
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1195 (defun image-dired-modify-mark-on-thumb-original-file (command)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1196 "Modify mark in dired buffer.
94268
4cca1963bd37 (image-dired-track-original-file)
Juri Linkov <juri@jurta.org>
parents: 87649
diff changeset
1197 COMMAND is one of 'mark for marking file in dired, 'unmark for
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1198 unmarking file in dired or 'flag for flagging file for delete in
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1199 dired."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1200 (let ((file-name (image-dired-original-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1201 (dired-buf (image-dired-associated-dired-buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1202 (if (not (and dired-buf file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1203 (message "No image, or image with correct properties, at point.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1204 (with-current-buffer dired-buf
87096
a99a2e8bc21e Fix possibly buggy calls to `message'.
Deepak Goel <deego@gnufans.org>
parents: 85478
diff changeset
1205 (message "%s" file-name)
94268
4cca1963bd37 (image-dired-track-original-file)
Juri Linkov <juri@jurta.org>
parents: 87649
diff changeset
1206 (if (dired-goto-file file-name)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1207 (cond ((eq command 'mark) (dired-mark 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1208 ((eq command 'unmark) (dired-unmark 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1209 ((eq command 'toggle)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1210 (if (image-dired-dired-file-marked-p)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1211 (dired-unmark 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1212 (dired-mark 1)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1213 ((eq command 'flag) (dired-flag-file-deletion 1))))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1214
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1215 (defun image-dired-mark-thumb-original-file ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1216 "Mark original image file in associated dired buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1217 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1218 (image-dired-modify-mark-on-thumb-original-file 'mark)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1219 (image-dired-forward-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1220
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1221 (defun image-dired-unmark-thumb-original-file ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1222 "Unmark original image file in associated dired buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1223 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1224 (image-dired-modify-mark-on-thumb-original-file 'unmark)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1225 (image-dired-forward-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1226
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1227 (defun image-dired-flag-thumb-original-file ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1228 "Flag original image file for deletion in associated dired buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1229 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1230 (image-dired-modify-mark-on-thumb-original-file 'flag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1231 (image-dired-forward-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1232
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1233 (defun image-dired-toggle-mark-thumb-original-file ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1234 "Toggle mark on original image file in associated dired buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1235 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1236 (image-dired-modify-mark-on-thumb-original-file 'toggle))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1237
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1238 (defun image-dired-jump-original-dired-buffer ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1239 "Jump to the dired buffer associated with the current image file.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1240 You probably want to use this together with
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1241 `image-dired-track-original-file'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1242 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1243 (let ((buf (image-dired-associated-dired-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1244 window frame)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1245 (setq window (image-dired-get-buffer-window buf))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1246 (if window
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1247 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1248 (if (not (equal (selected-frame) (setq frame (window-frame window))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1249 (select-frame-set-input-focus frame))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1250 (select-window window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1251 (message "Associated dired buffer not visible"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1252
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1253 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1254 (defun image-dired-jump-thumbnail-buffer ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1255 "Jump to thumbnail buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1256 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1257 (let ((window (image-dired-thumbnail-window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1258 frame)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1259 (if window
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1260 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1261 (if (not (equal (selected-frame) (setq frame (window-frame window))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1262 (select-frame-set-input-focus frame))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1263 (select-window window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1264 (message "Thumbnail buffer not visible"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1265
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1266 (defvar image-dired-thumbnail-mode-map (make-sparse-keymap)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1267 "Keymap for `image-dired-thumbnail-mode'.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1268
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1269 (defvar image-dired-thumbnail-mode-line-up-map (make-sparse-keymap)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1270 "Keymap for line-up commands in `image-dired-thumbnail-mode'.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1271
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1272 (defvar image-dired-thumbnail-mode-tag-map (make-sparse-keymap)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1273 "Keymap for tag commands in `image-dired-thumbnail-mode'.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1274
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1275 (defun image-dired-define-thumbnail-mode-keymap ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1276 "Define keymap for `image-dired-thumbnail-mode'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1277
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1278 ;; Keys
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1279 (define-key image-dired-thumbnail-mode-map [right] 'image-dired-forward-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1280 (define-key image-dired-thumbnail-mode-map [left] 'image-dired-backward-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1281 (define-key image-dired-thumbnail-mode-map [up] 'image-dired-previous-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1282 (define-key image-dired-thumbnail-mode-map [down] 'image-dired-next-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1283 (define-key image-dired-thumbnail-mode-map "\C-f" 'image-dired-forward-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1284 (define-key image-dired-thumbnail-mode-map "\C-b" 'image-dired-backward-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1285 (define-key image-dired-thumbnail-mode-map "\C-p" 'image-dired-previous-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1286 (define-key image-dired-thumbnail-mode-map "\C-n" 'image-dired-next-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1287
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1288 (define-key image-dired-thumbnail-mode-map "d" 'image-dired-flag-thumb-original-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1289 (define-key image-dired-thumbnail-mode-map [delete]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1290 'image-dired-flag-thumb-original-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1291 (define-key image-dired-thumbnail-mode-map "m" 'image-dired-mark-thumb-original-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1292 (define-key image-dired-thumbnail-mode-map "u" 'image-dired-unmark-thumb-original-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1293 (define-key image-dired-thumbnail-mode-map "." 'image-dired-track-original-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1294 (define-key image-dired-thumbnail-mode-map [tab] 'image-dired-jump-original-dired-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1295
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1296 ;; add line-up map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1297 (define-key image-dired-thumbnail-mode-map "g" image-dired-thumbnail-mode-line-up-map)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1298
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1299 ;; map it to "g" so that the user can press it more quickly
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1300 (define-key image-dired-thumbnail-mode-line-up-map "g" 'image-dired-line-up-dynamic)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1301 ;; "f" for "fixed" number of thumbs per row
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1302 (define-key image-dired-thumbnail-mode-line-up-map "f" 'image-dired-line-up)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1303 ;; "i" for "interactive"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1304 (define-key image-dired-thumbnail-mode-line-up-map "i" 'image-dired-line-up-interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1305
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1306 ;; add tag map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1307 (define-key image-dired-thumbnail-mode-map "t" image-dired-thumbnail-mode-tag-map)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1308
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1309 ;; map it to "t" so that the user can press it more quickly
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1310 (define-key image-dired-thumbnail-mode-tag-map "t" 'image-dired-tag-thumbnail)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1311 ;; "r" for "remove"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1312 (define-key image-dired-thumbnail-mode-tag-map "r" 'image-dired-tag-thumbnail-remove)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1313
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1314 (define-key image-dired-thumbnail-mode-map "\C-m"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1315 'image-dired-display-thumbnail-original-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1316 (define-key image-dired-thumbnail-mode-map [C-return]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1317 'image-dired-thumbnail-display-external)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1318
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1319 (define-key image-dired-thumbnail-mode-map "l" 'image-dired-rotate-thumbnail-left)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1320 (define-key image-dired-thumbnail-mode-map "r" 'image-dired-rotate-thumbnail-right)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1321
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1322 (define-key image-dired-thumbnail-mode-map "L" 'image-dired-rotate-original-left)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1323 (define-key image-dired-thumbnail-mode-map "R" 'image-dired-rotate-original-right)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1324
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1325 (define-key image-dired-thumbnail-mode-map "D"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1326 'image-dired-thumbnail-set-image-description)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1327
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1328 (define-key image-dired-thumbnail-mode-map "\C-d" 'image-dired-delete-char)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1329 (define-key image-dired-thumbnail-mode-map " "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1330 'image-dired-display-next-thumbnail-original)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1331 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1332 (kbd "DEL") 'image-dired-display-previous-thumbnail-original)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1333 (define-key image-dired-thumbnail-mode-map "c" 'image-dired-comment-thumbnail)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1334 (define-key image-dired-thumbnail-mode-map "q" 'image-dired-kill-buffer-and-window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1335
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1336 ;; Mouse
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1337 (define-key image-dired-thumbnail-mode-map [mouse-2] 'image-dired-mouse-display-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1338 (define-key image-dired-thumbnail-mode-map [mouse-1] 'image-dired-mouse-select-thumbnail)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1339
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1340 ;; Seems I must first set C-down-mouse-1 to undefined, or else it
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1341 ;; will trigger the buffer menu. If I try to instead bind
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1342 ;; C-down-mouse-1 to `image-dired-mouse-toggle-mark', I get a message
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1343 ;; about C-mouse-1 not being defined afterwards. Annoying, but I
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1344 ;; probably do not completely understand mouse events.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1345
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1346 (define-key image-dired-thumbnail-mode-map [C-down-mouse-1] 'undefined)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1347 (define-key image-dired-thumbnail-mode-map [C-mouse-1] 'image-dired-mouse-toggle-mark)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1348
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1349 ;; Menu
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1350 (define-key image-dired-thumbnail-mode-map [menu-bar image-dired]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1351 (cons "Image-Dired" (make-sparse-keymap "Image-Dired")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1352
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1353 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1354 [menu-bar image-dired image-dired-kill-buffer-and-window]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1355 '("Quit" . image-dired-kill-buffer-and-window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1356
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1357 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1358 [menu-bar image-dired image-dired-delete-char]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1359 '("Delete thumbnail from buffer" . image-dired-delete-char))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1360
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1361 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1362 [menu-bar image-dired image-dired-tag-thumbnail-remove]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1363 '("Remove tag from thumbnail" . image-dired-tag-thumbnail-remove))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1364
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1365 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1366 [menu-bar image-dired image-dired-tag-thumbnail]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1367 '("Tag thumbnail" . image-dired-tag-thumbnail))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1368
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1369 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1370 [menu-bar image-dired image-dired-comment-thumbnail]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1371 '("Comment thumbnail" . image-dired-comment-thumbnail))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1372
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1373 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1374 [menu-bar image-dired image-dired-refresh-thumb]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1375 '("Refresh thumb" . image-dired-refresh-thumb))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1376 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1377 [menu-bar image-dired image-dired-line-up-dynamic]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1378 '("Dynamic line up" . image-dired-line-up-dynamic))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1379 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1380 [menu-bar image-dired image-dired-line-up]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1381 '("Line up thumbnails" . image-dired-line-up))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1382
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1383 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1384 [menu-bar image-dired image-dired-rotate-thumbnail-left]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1385 '("Rotate thumbnail left" . image-dired-rotate-thumbnail-left))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1386 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1387 [menu-bar image-dired image-dired-rotate-thumbnail-right]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1388 '("Rotate thumbnail right" . image-dired-rotate-thumbnail-right))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1389
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1390 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1391 [menu-bar image-dired image-dired-rotate-original-left]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1392 '("Rotate original left" . image-dired-rotate-original-left))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1393 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1394 [menu-bar image-dired image-dired-rotate-original-right]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1395 '("Rotate original right" . image-dired-rotate-original-right))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1396
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1397 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1398 [menu-bar image-dired image-dired-toggle-movement-tracking]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1399 '("Toggle movement tracking on/off" . image-dired-toggle-movement-tracking))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1400
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1401 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1402 [menu-bar image-dired image-dired-jump-original-dired-buffer]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1403 '("Jump to dired buffer" . image-dired-jump-original-dired-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1404 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1405 [menu-bar image-dired image-dired-track-original-file]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1406 '("Track original" . image-dired-track-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1407
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1408 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1409 [menu-bar image-dired image-dired-flag-thumb-original-file]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1410 '("Flag original for deletion" . image-dired-flag-thumb-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1411 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1412 [menu-bar image-dired image-dired-unmark-thumb-original-file]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1413 '("Unmark original" . image-dired-unmark-thumb-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1414 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1415 [menu-bar image-dired image-dired-mark-thumb-original-file]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1416 '("Mark original" . image-dired-mark-thumb-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1417
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1418 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1419 [menu-bar image-dired image-dired-thumbnail-display-external]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1420 '("Display in external viewer" . image-dired-thumbnail-display-external))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1421 (define-key image-dired-thumbnail-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1422 [menu-bar image-dired image-dired-display-thumbnail-original-image]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1423 '("Display image" . image-dired-display-thumbnail-original-image)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1424
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1425 (defvar image-dired-display-image-mode-map (make-sparse-keymap)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1426 "Keymap for `image-dired-display-image-mode'.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1427
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1428 (defun image-dired-define-display-image-mode-keymap ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1429 "Define keymap for `image-dired-display-image-mode'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1430
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1431 ;; Keys
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1432 (define-key image-dired-display-image-mode-map "q" 'image-dired-kill-buffer-and-window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1433
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1434 (define-key image-dired-display-image-mode-map "f"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1435 'image-dired-display-current-image-full)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1436
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1437 (define-key image-dired-display-image-mode-map "s"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1438 'image-dired-display-current-image-sized)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1439
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1440 ;; Menu
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1441 (define-key image-dired-display-image-mode-map [menu-bar image-dired]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1442 (cons "Image-Dired" (make-sparse-keymap "Image-Dired")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1443
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1444 (define-key image-dired-display-image-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1445 [menu-bar image-dired image-dired-kill-buffer-and-window]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1446 '("Quit" . image-dired-kill-buffer-and-window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1447
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1448 (define-key image-dired-display-image-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1449 [menu-bar image-dired image-dired-display-current-image-sized]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1450 '("Display original, sized to fit" . image-dired-display-current-image-sized))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1451
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1452 (define-key image-dired-display-image-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1453 [menu-bar image-dired image-dired-display-current-image-full]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1454 '("Display original, full size" . image-dired-display-current-image-full))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1455
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1456 )
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1457
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1458 (defun image-dired-display-current-image-full ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1459 "Display current image in full size."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1460 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1461 (let ((file (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1462 (if file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1463 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1464 (image-dired-display-image file t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1465 (message "Full size image displayed"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1466 (error "No original file name at point"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1467
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1468 (defun image-dired-display-current-image-sized ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1469 "Display current image in sized to fit window dimensions."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1470 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1471 (let ((file (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1472 (if file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1473 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1474 (image-dired-display-image file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1475 (message "Full size image displayed"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1476 (error "No original file name at point"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1477
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1478 (define-derived-mode image-dired-thumbnail-mode
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1479 fundamental-mode "image-dired-thumbnail"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1480 "Browse and manipulate thumbnail images using dired.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1481 Use `image-dired-dired' and `image-dired-setup-dired-keybindings' to get a
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1482 nice setup to start with."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1483 (image-dired-define-thumbnail-mode-keymap)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1484 (message "image-dired-thumbnail-mode enabled"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1485
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1486 (define-derived-mode image-dired-display-image-mode
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1487 fundamental-mode "image-dired-image-display"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1488 "Mode for displaying and manipulating original image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1489 Resized or in full-size."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1490 (image-dired-define-display-image-mode-keymap)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1491 (message "image-dired-display-image-mode enabled"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1492
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1493 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1494 (defun image-dired-setup-dired-keybindings ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1495 "Setup easy-to-use keybindings for the commands to be used in dired mode.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1496 Note that n, p and <down> and <up> will be hijacked and bound to
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1497 `image-dired-dired-x-line'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1498 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1499
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1500 ;; Hijack previous and next line movement. Let C-p and C-b be
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1501 ;; though...
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1502
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1503 (define-key dired-mode-map "p" 'image-dired-dired-previous-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1504 (define-key dired-mode-map "n" 'image-dired-dired-next-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1505 (define-key dired-mode-map [up] 'image-dired-dired-previous-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1506 (define-key dired-mode-map [down] 'image-dired-dired-next-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1507
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1508 (define-key dired-mode-map (kbd "C-S-n") 'image-dired-next-line-and-display)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1509 (define-key dired-mode-map (kbd "C-S-p") 'image-dired-previous-line-and-display)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1510 (define-key dired-mode-map (kbd "C-S-m") 'image-dired-mark-and-display-next)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1511
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1512 (define-key dired-mode-map "\C-td" 'image-dired-display-thumbs)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1513 (define-key dired-mode-map "\C-tt" 'image-dired-tag-files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1514 (define-key dired-mode-map "\C-tr" 'image-dired-delete-tag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1515 (define-key dired-mode-map [tab] 'image-dired-jump-thumbnail-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1516 (define-key dired-mode-map "\C-ti" 'image-dired-dired-display-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1517 (define-key dired-mode-map "\C-tx" 'image-dired-dired-display-external)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1518 (define-key dired-mode-map "\C-ta" 'image-dired-display-thumbs-append)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1519 (define-key dired-mode-map "\C-t." 'image-dired-display-thumb)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1520 (define-key dired-mode-map "\C-tc" 'image-dired-dired-comment-files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1521 (define-key dired-mode-map "\C-tf" 'image-dired-mark-tagged-files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1522
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1523 ;; Menu for dired
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1524 (define-key dired-mode-map [menu-bar image-dired]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1525 (cons "Image-Dired" (make-sparse-keymap "Image-Dired")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1526
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1527 (define-key dired-mode-map [menu-bar image-dired image-dired-copy-with-exif-file-name]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1528 '("Copy with EXIF file name" . image-dired-copy-with-exif-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1529
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1530 (define-key dired-mode-map [menu-bar image-dired image-dired-dired-comment-files]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1531 '("Comment files" . image-dired-dired-comment-files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1532
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1533 (define-key dired-mode-map [menu-bar image-dired image-dired-mark-tagged-files]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1534 '("Mark tagged files" . image-dired-mark-tagged-files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1535
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1536 (define-key dired-mode-map [menu-bar image-dired image-dired-delete-tag]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1537 '("Remove tag from files" . image-dired-delete-tag))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1538
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1539 (define-key dired-mode-map [menu-bar image-dired image-dired-tag-files]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1540 '("Tag files" . image-dired-tag-files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1541
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1542 (define-key dired-mode-map [menu-bar image-dired image-dired-jump-thumbnail-buffer]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1543 '("Jump to thumbnail buffer" . image-dired-jump-thumbnail-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1544
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1545 (define-key dired-mode-map [menu-bar image-dired image-dired-toggle-movement-tracking]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1546 '("Toggle movement tracking" . image-dired-toggle-movement-tracking))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1547
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1548 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1549 [menu-bar image-dired image-dired-toggle-append-browsing]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1550 '("Toggle append browsing" . image-dired-toggle-append-browsing))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1551
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1552 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1553 [menu-bar image-dired image-dired-toggle-disp-props]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1554 '("Toggle display properties" . image-dired-toggle-dired-display-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1555
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1556 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1557 [menu-bar image-dired image-dired-dired-display-external]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1558 '("Display in external viewer" . image-dired-dired-display-external))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1559 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1560 [menu-bar image-dired image-dired-dired-display-image]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1561 '("Display image" . image-dired-dired-display-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1562 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1563 [menu-bar image-dired image-dired-display-thumb]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1564 '("Display this thumbnail" . image-dired-display-thumb))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1565 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1566 [menu-bar image-dired image-dired-display-thumbs-append]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1567 '("Display thumbnails append" . image-dired-display-thumbs-append))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1568 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1569 [menu-bar image-dired image-dired-display-thumbs]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1570 '("Display thumbnails" . image-dired-display-thumbs))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1571
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1572 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1573 [menu-bar image-dired image-dired-create-thumbs]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1574 '("Create thumbnails for marked files" . image-dired-create-thumbs))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1575
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1576 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1577 [menu-bar image-dired image-dired-mark-and-display-next]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1578 '("Mark and display next" . image-dired-mark-and-display-next))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1579 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1580 [menu-bar image-dired image-dired-previous-line-and-display]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1581 '("Display thumb for previous file" . image-dired-previous-line-and-display))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1582 (define-key dired-mode-map
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1583 [menu-bar image-dired image-dired-next-line-and-display]
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1584 '("Display thumb for next file" . image-dired-next-line-and-display)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1585
95841
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1586 (declare-function clear-image-cache "image.c" (&optional filter))
b4e36ff621b3 Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents: 94678
diff changeset
1587
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1588 (defun image-dired-create-thumbs (&optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1589 "Create thumbnail images for all marked files in dired.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1590 With prefix argument ARG, create thumbnails even if they already exist
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1591 \(i.e. use this to refresh your thumbnails)."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1592 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1593 (let (curr-file thumb-name files count)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1594 (setq files (dired-get-marked-files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1595 (mapcar
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1596 (lambda (curr-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1597 (setq thumb-name (image-dired-thumb-name curr-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1598 ;; If the user overrides the exist check, we must clear the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1599 ;; image cache so that if the user wants to display the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1600 ;; thumnail, it is not fetched from cache.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1601 (if arg
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1602 (clear-image-cache))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1603 (if (or (not (file-exists-p thumb-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1604 arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1605 (if (not (= 0 (image-dired-create-thumb curr-file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1606 (image-dired-thumb-name curr-file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1607 (error "Thumb could not be created"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1608 files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1609
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1610 (defvar image-dired-slideshow-timer nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1611 "Slideshow timer.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1612
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1613 (defvar image-dired-slideshow-count 0
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1614 "Keeping track on number of images in slideshow.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1615
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1616 (defvar image-dired-slideshow-times 0
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1617 "Number of pictures to display in slideshow.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1618
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1619 (defun image-dired-slideshow-step ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1620 "Step to next file, if `image-dired-slideshow-times' has not been reached."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1621 (if (< image-dired-slideshow-count image-dired-slideshow-times)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1622 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1623 (message "%s" (1+ image-dired-slideshow-count))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1624 (setq image-dired-slideshow-count (1+ image-dired-slideshow-count))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1625 (image-dired-next-line-and-display))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1626 (image-dired-slideshow-stop)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1627
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1628 (defun image-dired-slideshow-start ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1629 "Start slideshow.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1630 Ask user for number of images to show and the delay in between."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1631 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1632 (setq image-dired-slideshow-count 0)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1633 (setq image-dired-slideshow-times (string-to-number (read-string "How many: ")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1634 (let ((repeat (string-to-number
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1635 (read-string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1636 "Delay, in seconds. Decimals are accepted : " "1"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1637 (setq image-dired-slideshow-timer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1638 (run-with-timer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1639 0 repeat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1640 'image-dired-slideshow-step))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1641
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1642 (defun image-dired-slideshow-stop ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1643 "Cancel slideshow."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1644 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1645 (cancel-timer image-dired-slideshow-timer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1646
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1647 (defun image-dired-delete-char ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1648 "Remove current thumbnail from thumbnail buffer and line up."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1649 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1650 (let ((inhibit-read-only t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1651 (delete-char 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1652 (if (looking-at " ")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1653 (delete-char 1))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1654
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1655 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1656 (defun image-dired-display-thumbs-append ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1657 "Append thumbnails to `image-dired-thumbnail-buffer'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1658 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1659 (image-dired-display-thumbs nil t t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1660
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1661 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1662 (defun image-dired-display-thumb ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1663 "Shorthand for `image-dired-display-thumbs' with prefix argument."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1664 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1665 (image-dired-display-thumbs t nil t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1666
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1667 (defun image-dired-line-up ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1668 "Line up thumbnails according to `image-dired-thumbs-per-row'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1669 See also `image-dired-line-up-dynamic'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1670 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1671 (let ((inhibit-read-only t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1672 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1673 (while (and (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1674 (not (eobp)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1675 (delete-char 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1676 (while (not (eobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1677 (forward-char)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1678 (while (and (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1679 (not (eobp)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1680 (delete-char 1)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1681 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1682 (let ((count 0))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1683 (while (not (eobp))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1684 (forward-char)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1685 (if (= image-dired-thumbs-per-row 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1686 (insert "\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1687 (insert " ")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1688 (setq count (1+ count))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1689 (when (and (= count (- image-dired-thumbs-per-row 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1690 (not (eobp)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1691 (forward-char)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1692 (insert "\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1693 (setq count 0)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1694 (goto-char (point-min))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1695
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1696 (defun image-dired-line-up-dynamic ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1697 "Line up thumbnails images dynamically.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1698 Calculate how many thumbnails fit."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1699 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1700 (let* ((char-width (frame-char-width))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1701 (width (image-dired-window-width-pixels (image-dired-thumbnail-window)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1702 (image-dired-thumbs-per-row
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1703 (/ width
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1704 (+ (* 2 image-dired-thumb-relief)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1705 (* 2 image-dired-thumb-margin)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1706 image-dired-thumb-width char-width))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1707 (image-dired-line-up)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1708
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1709 (defun image-dired-line-up-interactive ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1710 "Line up thumbnails interactively.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1711 Ask user how many thumbnails should be displayed per row."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1712 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1713 (let ((image-dired-thumbs-per-row
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1714 (string-to-number (read-string "How many thumbs per row: "))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1715 (if (not (> image-dired-thumbs-per-row 0))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1716 (message "Number must be greater than 0")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1717 (image-dired-line-up))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1718
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1719 (defun image-dired-thumbnail-display-external ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1720 "Display original image for thumbnail at point using external viewer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1721 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1722 (let ((file (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1723 (if (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1724 (message "No thumbnail at point")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1725 (if (not file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1726 (message "No original file name found")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1727 (call-process shell-file-name nil nil nil shell-command-switch
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1728 (format "%s \"%s\"" image-dired-external-viewer file))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1729
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1730 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1731 (defun image-dired-dired-display-external ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1732 "Display file at point using an external viewer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1733 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1734 (let ((file (dired-get-filename)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1735 (call-process shell-file-name nil nil nil shell-command-switch
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1736 (format "%s \"%s\"" image-dired-external-viewer file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1737
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1738 (defun image-dired-window-width-pixels (window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1739 "Calculate WINDOW width in pixels."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1740 (* (window-width window) (frame-char-width)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1741
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1742 (defun image-dired-window-height-pixels (window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1743 "Calculate WINDOW height in pixels."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1744 ;; Note: The mode-line consumes one line
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1745 (* (- (window-height window) 1) (frame-char-height)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1746
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1747 (defun image-dired-display-window ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1748 "Return window where `image-dired-display-image-buffer' is visible."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1749 (get-window-with-predicate
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1750 (lambda (window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1751 (equal (buffer-name (window-buffer window)) image-dired-display-image-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1752 nil t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1753
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1754 (defun image-dired-thumbnail-window ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1755 "Return window where `image-dired-thumbnail-buffer' is visible."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1756 (get-window-with-predicate
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1757 (lambda (window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1758 (equal (buffer-name (window-buffer window)) image-dired-thumbnail-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1759 nil t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1760
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1761 (defun image-dired-associated-dired-buffer-window ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1762 "Return window where associated dired buffer is visible."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1763 (let (buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1764 (if (image-dired-image-at-point-p)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1765 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1766 (setq buf (image-dired-associated-dired-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1767 (get-window-with-predicate
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1768 (lambda (window)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1769 (equal (window-buffer window) buf))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1770 (error "No thumbnail image at point"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1771
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1772 (defun image-dired-display-window-width ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1773 "Return width, in pixels, of image-dired's image display window."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1774 (- (image-dired-window-width-pixels (image-dired-display-window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1775 image-dired-display-window-width-correction))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1776
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1777 (defun image-dired-display-window-height ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1778 "Return height, in pixels, of image-dired's image display window."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1779 (- (image-dired-window-height-pixels (image-dired-display-window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1780 image-dired-display-window-height-correction))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1781
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1782 (defun image-dired-display-image (file &optional original-size)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1783 "Display image FILE in image buffer.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1784 Use this when you want to display the image, semi sized, in a new
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1785 window. The image is sized to fit the display window (using a
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1786 temporary file, don't worry). Because of this, it will not be as
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1787 quick as opening it directly, but on most modern systems it
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1788 should feel snappy enough.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1789
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1790 If optional argument ORIGINAL-SIZE is non-nil, display image in its
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1791 original size."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1792 (let ((new-file (expand-file-name image-dired-temp-image-file))
77488
27c929c72d08 Mathias Dahl <mathias.dahl at gmail.com>:
Glenn Morris <rgm@gnu.org>
parents: 77405
diff changeset
1793 width height command ret
27c929c72d08 Mathias Dahl <mathias.dahl at gmail.com>:
Glenn Morris <rgm@gnu.org>
parents: 77405
diff changeset
1794 (image-type 'jpeg))
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1795 (setq file (expand-file-name file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1796 (if (not original-size)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1797 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1798 (setq width (image-dired-display-window-width))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1799 (setq height (image-dired-display-window-height))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1800 (setq command
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1801 (format-spec
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1802 image-dired-cmd-create-temp-image-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1803 (list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1804 (cons ?p image-dired-cmd-create-temp-image-program)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1805 (cons ?w width)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1806 (cons ?h height)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1807 (cons ?f file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1808 (cons ?t new-file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1809 (setq ret (call-process shell-file-name nil nil nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1810 shell-command-switch command))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1811 (if (not (= 0 ret))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1812 (error "Could not resize image")))
77488
27c929c72d08 Mathias Dahl <mathias.dahl at gmail.com>:
Glenn Morris <rgm@gnu.org>
parents: 77405
diff changeset
1813 (setq image-type (image-type-from-file-name file))
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1814 (copy-file file new-file t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1815 (with-current-buffer (image-dired-create-display-image-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1816 (let ((inhibit-read-only t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1817 (erase-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1818 (clear-image-cache)
77488
27c929c72d08 Mathias Dahl <mathias.dahl at gmail.com>:
Glenn Morris <rgm@gnu.org>
parents: 77405
diff changeset
1819 (image-dired-insert-image image-dired-temp-image-file image-type 0 0)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1820 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1821 (image-dired-update-property 'original-file-name file)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1822
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1823 (defun image-dired-display-thumbnail-original-image (&optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1824 "Display current thumbnail's original image in display buffer.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1825 See documentation for `image-dired-display-image' for more information.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1826 With prefix argument ARG, display image in its original size."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1827 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1828 (let ((file (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1829 (if (not (string-equal major-mode "image-dired-thumbnail-mode"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1830 (message "Not in image-dired-thumbnail-mode")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1831 (if (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1832 (message "No thumbnail at point")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1833 (if (not file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1834 (message "No original file name found")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1835 (image-dired-create-display-image-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1836 (display-buffer image-dired-display-image-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1837 (image-dired-display-image file arg))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1838
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1839
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1840 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1841 (defun image-dired-dired-display-image (&optional arg)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1842 "Display current image file.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1843 See documentation for `image-dired-display-image' for more information.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1844 With prefix argument ARG, display image in its original size."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1845 (interactive "P")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1846 (image-dired-create-display-image-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1847 (display-buffer image-dired-display-image-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1848 (image-dired-display-image (dired-get-filename) arg))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1849
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1850 (defun image-dired-image-at-point-p ()
78964
7a23b4f8846e (image-dired-image-at-point-p): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents: 78236
diff changeset
1851 "Return true if there is an image-dired thumbnail at point."
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1852 (get-text-property (point) 'image-dired-thumbnail))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1853
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1854 (defun image-dired-rotate-thumbnail (degrees)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1855 "Rotate thumbnail DEGREES degrees."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1856 (if (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1857 (message "No thumbnail at point")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1858 (let ((file (image-dired-thumb-name (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1859 command)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1860 (setq command (format-spec
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1861 image-dired-cmd-rotate-thumbnail-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1862 (list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1863 (cons ?p image-dired-cmd-rotate-thumbnail-program)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1864 (cons ?d degrees)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1865 (cons ?t (expand-file-name file)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1866 (call-process shell-file-name nil nil nil shell-command-switch command)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1867 ;; Clear the cache to refresh image. I wish I could just refresh
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1868 ;; the current file but I do not know how to do that. Yet...
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1869 (clear-image-cache))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1870
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1871 (defun image-dired-rotate-thumbnail-left ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1872 "Rotate thumbnail left (counter clockwise) 90 degrees.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1873 The result of the rotation is displayed in the image display area
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1874 and a confirmation is needed before the original image files is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1875 overwritten. This confirmation can be turned off using
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1876 `image-dired-rotate-original-ask-before-overwrite'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1877 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1878 (image-dired-rotate-thumbnail "270"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1879
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1880 (defun image-dired-rotate-thumbnail-right ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1881 "Rotate thumbnail counter right (clockwise) 90 degrees.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1882 The result of the rotation is displayed in the image display area
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1883 and a confirmation is needed before the original image files is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1884 overwritten. This confirmation can be turned off using
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1885 `image-dired-rotate-original-ask-before-overwrite'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1886 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1887 (image-dired-rotate-thumbnail "90"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1888
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1889 (defun image-dired-refresh-thumb ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1890 "Force creation of new image for current thumbnail."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1891 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1892 (let ((file (image-dired-original-file-name)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1893 (clear-image-cache)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1894 (image-dired-create-thumb file (image-dired-thumb-name file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1895
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1896 (defun image-dired-rotate-original (degrees)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1897 "Rotate original image DEGREES degrees."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1898 (if (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1899 (message "No image at point")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1900 (let ((file (image-dired-original-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1901 command temp-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1902 (if (not (string-match "\.[jJ][pP[eE]?[gG]$" file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1903 (error "Only JPEG images can be rotated!"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1904 (setq command (format-spec
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1905 image-dired-cmd-rotate-original-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1906 (list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1907 (cons ?p image-dired-cmd-rotate-original-program)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1908 (cons ?d degrees)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1909 (cons ?o (expand-file-name file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1910 (cons ?t image-dired-temp-rotate-image-file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1911 (if (not (= 0 (call-process shell-file-name nil nil nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1912 shell-command-switch command)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1913 (error "Could not rotate image")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1914 (image-dired-display-image image-dired-temp-rotate-image-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1915 (if (or (and image-dired-rotate-original-ask-before-overwrite
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1916 (y-or-n-p
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1917 "Rotate to temp file OK. Overwrite original image? "))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1918 (not image-dired-rotate-original-ask-before-overwrite))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1919 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1920 (copy-file image-dired-temp-rotate-image-file file t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1921 (image-dired-refresh-thumb))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1922 (image-dired-display-image file))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1923
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1924 (defun image-dired-rotate-original-left ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1925 "Rotate original image left (counter clockwise) 90 degrees."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1926 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1927 (image-dired-rotate-original "270"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1928
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1929 (defun image-dired-rotate-original-right ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1930 "Rotate original image right (clockwise) 90 degrees."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1931 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1932 (image-dired-rotate-original "90"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1933
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1934 (defun image-dired-get-exif-file-name (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1935 "Use the image's EXIF information to return a unique file name.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1936 The file name should be unique as long as you do not take more than
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1937 one picture per second. The original file name is suffixed at the end
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1938 for traceability. The format of the returned file name is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1939 YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1940 `image-dired-copy-with-exif-file-name'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1941 (let (data no-exif-data-found)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1942 (if (not (string-match "\.[Jj][Pp][Ee]?[Gg]$" (expand-file-name file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1943 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1944 (setq no-exif-data-found t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1945 (setq data
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1946 (format-time-string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1947 "%Y:%m:%d %H:%M:%S"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1948 (nth 5 (file-attributes (expand-file-name file))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1949 (setq data (image-dired-get-exif-data (expand-file-name file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1950 "DateTimeOriginal")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1951 (while (string-match "[ :]" data)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1952 (setq data (replace-match "_" nil nil data)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1953 (format "%s%s%s" data
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1954 (if no-exif-data-found
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1955 "_noexif_"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1956 "_")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1957 (file-name-nondirectory file))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1958
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1959 (defun image-dired-thumbnail-set-image-description ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1960 "Set the ImageDescription EXIF tag for the original image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1961 If the image already has a value for this tag, it is used as the
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1962 default value at the prompt."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1963 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1964 (if (not (image-dired-image-at-point-p))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1965 (message "No thumbnail at point")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1966 (let* ((file (image-dired-original-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1967 (old-value (image-dired-get-exif-data file "ImageDescription")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1968 (if (eq 0
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1969 (image-dired-set-exif-data file "ImageDescription"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1970 (read-string "Value of ImageDescription: "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1971 old-value)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1972 (message "Successfully wrote ImageDescription tag.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1973 (error "Could not write ImageDescription tag")))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1974
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1975 (defun image-dired-set-exif-data (file tag-name tag-value)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1976 "In FILE, set EXIF tag TAG-NAME to value TAG-VALUE."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1977 (let (command)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1978 (setq command (format-spec
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1979 image-dired-cmd-write-exif-data-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1980 (list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1981 (cons ?p image-dired-cmd-write-exif-data-program)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1982 (cons ?f (expand-file-name file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1983 (cons ?t tag-name)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1984 (cons ?v tag-value))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1985 (call-process shell-file-name nil nil nil shell-command-switch command)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1986
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1987 (defun image-dired-get-exif-data (file tag-name)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1988 "From FILE, return EXIF tag TAG-NAME."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1989 (let ((buf (get-buffer-create "*image-dired-get-exif-data*"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1990 command tag-value)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1991 (setq command (format-spec
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1992 image-dired-cmd-read-exif-data-options
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1993 (list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1994 (cons ?p image-dired-cmd-read-exif-data-program)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1995 (cons ?f file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1996 (cons ?t tag-name))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1997 (with-current-buffer buf
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1998 (delete-region (point-min) (point-max))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1999 (if (not (eq (call-process shell-file-name nil t nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2000 shell-command-switch command) 0))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2001 (error "Could not get EXIF tag")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2002 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2003 ;; Clean buffer from newlines and carriage returns before
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2004 ;; getting final info
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2005 (while (search-forward-regexp "[\n\r]" nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2006 (replace-match "" nil t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2007 (setq tag-value (buffer-substring (point-min) (point-max)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2008 tag-value))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2009
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2010 (defun image-dired-copy-with-exif-file-name ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2011 "Copy file with unique name to main image directory.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2012 Copy current or all marked files in dired to a new file in your
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2013 main image directory, using a file name generated by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2014 `image-dired-get-exif-file-name'. A typical usage for this if when
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2015 copying images from a digital camera into the image directory.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2016
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2017 Typically, you would open up the folder with the incoming
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2018 digital images, mark the files to be copied, and execute this
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2019 function. The result is a couple of new files in
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2020 `image-dired-main-image-directory' called
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2021 2005_05_08_12_52_00_dscn0319.jpg,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2022 2005_05_08_14_27_45_dscn0320.jpg etc."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2023 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2024 (let (new-name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2025 (files (dired-get-marked-files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2026 (mapcar
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2027 (lambda (curr-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2028 (setq new-name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2029 (format "%s/%s"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2030 (file-name-as-directory
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2031 (expand-file-name image-dired-main-image-directory))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2032 (image-dired-get-exif-file-name curr-file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2033 (message "Copying %s to %s" curr-file new-name)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2034 (copy-file curr-file new-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2035 files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2036
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2037 (defun image-dired-display-next-thumbnail-original ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2038 "In thubnail buffer, move to next thumbnail and display the image."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2039 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2040 (image-dired-forward-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2041 (image-dired-display-thumbnail-original-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2042
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2043 (defun image-dired-display-previous-thumbnail-original ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2044 "Move to previous thumbnail and display image."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2045 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2046 (image-dired-backward-image)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2047 (image-dired-display-thumbnail-original-image))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2048
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2049 (defun image-dired-write-comments (file-comments)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2050 "Write file comments to database.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2051 Write file comments to one or more files. FILE-COMMENTS is an alist on
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2052 the following form:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2053 ((FILE . COMMENT) ... )"
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
2054 (image-dired-sane-db-file)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2055 (let (end comment-beg-pos comment-end-pos file comment)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2056 (with-temp-file image-dired-db-file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2057 (insert-file-contents image-dired-db-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2058 (dolist (elt file-comments)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2059 (setq file (car elt)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2060 comment (cdr elt))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2061 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2062 (if (search-forward-regexp (format "^%s.*$" file) nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2063 (progn
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2064 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2065 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2066 ;; Delete old comment, if any
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2067 (when (search-forward ";comment:" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2068 (setq comment-beg-pos (match-beginning 0))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2069 ;; Any tags after the comment?
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2070 (if (search-forward ";" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2071 (setq comment-end-pos (- (point) 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2072 (setq comment-end-pos end))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2073 ;; Delete comment tag and comment
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2074 (delete-region comment-beg-pos comment-end-pos))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2075 ;; Insert new comment
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2076 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2077 (unless (search-forward ";" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2078 (end-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2079 (insert ";"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2080 (insert (format "comment:%s;" comment)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2081 ;; File does not exist in database - add it.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2082 (goto-char (point-max))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2083 (insert (format "\n%s;comment:%s" file comment)))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2084
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2085 (defun image-dired-update-property (prop value)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2086 "Update text property PROP with value VALUE at point."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2087 (let ((inhibit-read-only t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2088 (put-text-property
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2089 (point) (1+ (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2090 prop
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2091 value)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2092
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2093 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2094 (defun image-dired-dired-comment-files ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2095 "Add comment to current or marked files in dired."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2096 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2097 (let ((comment (image-dired-read-comment)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2098 (image-dired-write-comments
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2099 (mapcar
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2100 (lambda (curr-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2101 (cons curr-file comment))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2102 (dired-get-marked-files)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2103
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2104 (defun image-dired-comment-thumbnail ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2105 "Add comment to current thumbnail in thumbnail buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2106 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2107 (let* ((file (image-dired-original-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2108 (comment (image-dired-read-comment file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2109 (image-dired-write-comments (list (cons file comment)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2110 (image-dired-update-property 'comment comment))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2111 (image-dired-display-thumb-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2112
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2113 (defun image-dired-read-comment (&optional file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2114 "Read comment for an image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2115 Read comment for an image, optionally using old comment from FILE
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2116 as initial value."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2117 (let ((comment
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2118 (read-string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2119 "Comment: "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2120 (if file (image-dired-get-comment file)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2121 comment))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2122
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2123 (defun image-dired-get-comment (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2124 "Get comment for file FILE."
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
2125 (image-dired-sane-db-file)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2126 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2127 (let (end buf comment-beg-pos comment-end-pos comment)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2128 (setq buf (find-file image-dired-db-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2129 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2130 (when (search-forward-regexp
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2131 (format "^%s" file) nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2132 (end-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2133 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2134 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2135 (cond ((search-forward ";comment:" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2136 (setq comment-beg-pos (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2137 (if (search-forward ";" end t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2138 (setq comment-end-pos (- (point) 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2139 (setq comment-end-pos end))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2140 (setq comment (buffer-substring
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2141 comment-beg-pos comment-end-pos)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2142 (kill-buffer buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2143 comment)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2144
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2145 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2146 (defun image-dired-mark-tagged-files ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2147 "Use regexp to mark files with matching tag.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2148 A `tag' is a keyword, a piece of meta data, associated with an
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2149 image file and stored in image-dired's database file. This command
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2150 lets you input a regexp and this will be matched against all tags
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2151 on all image files in the database file. The files that have a
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2152 matching tags will be marked in the dired buffer."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2153 (interactive)
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
2154 (image-dired-sane-db-file)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2155 (let ((tag (read-string "Mark tagged files (regexp): "))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2156 (hits 0)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2157 files buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2158 (save-excursion
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2159 (setq buf (find-file image-dired-db-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2160 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2161 ;; Collect matches
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2162 (while (search-forward-regexp
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2163 (concat "\\(^[^;\n]+\\);.*" tag ".*$") nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2164 (setq files (append (list (match-string 1)) files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2165 (kill-buffer buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2166 ;; Mark files
84874
e971b563a3eb (image-dired-display-thumbs, image-dired-remove-tag,
Juanma Barranquero <lekktu@gmail.com>
parents: 82140
diff changeset
2167 (mapc
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2168 ;; I tried using `dired-mark-files-regexp' but it was
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2169 ;; waaaay to slow.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2170 (lambda (curr-file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2171 ;; Don't bother about hits found in other directories than
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2172 ;; the current one.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2173 (when (string= (file-name-as-directory
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2174 (expand-file-name default-directory))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2175 (file-name-as-directory
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2176 (file-name-directory curr-file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2177 (setq curr-file (file-name-nondirectory curr-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2178 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2179 (when (search-forward-regexp (format "\\s %s$" curr-file) nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2180 (setq hits (+ hits 1))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2181 (dired-mark 1))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2182 files))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2183 (message "%d files with matching tag marked." hits)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2184
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2185 (defun image-dired-mouse-display-image (event)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2186 "Use mouse EVENT, call `image-dired-display-image' to display image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2187 Track this in associated dired buffer if `image-dired-track-movement' is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2188 non-nil."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2189 (interactive "e")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2190 (let (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2191 (mouse-set-point event)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2192 (goto-char (posn-point (event-end event)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2193 (setq file (image-dired-original-file-name))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2194 (if image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2195 (image-dired-track-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2196 (image-dired-create-display-image-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2197 (display-buffer image-dired-display-image-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2198 (image-dired-display-image file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2199
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2200 (defun image-dired-mouse-select-thumbnail (event)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2201 "Use mouse EVENT to select thumbnail image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2202 Track this in associated dired buffer if `image-dired-track-movement' is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2203 non-nil."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2204 (interactive "e")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2205 (let (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2206 (mouse-set-point event)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2207 (goto-char (posn-point (event-end event)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2208 (if image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2209 (image-dired-track-original-file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2210 (image-dired-display-thumb-properties))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2211
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2212 (defun image-dired-mouse-toggle-mark (event)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2213 "Use mouse EVENT to toggle dired mark for thumbnail.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2214 Track this in associated dired buffer if `image-dired-track-movement' is
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2215 non-nil."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2216 (interactive "e")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2217 (let (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2218 (mouse-set-point event)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2219 (goto-char (posn-point (event-end event)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2220 (if image-dired-track-movement
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2221 (image-dired-track-original-file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2222 (image-dired-toggle-mark-thumb-original-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2223
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2224 (defun image-dired-dired-display-properties ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2225 "Display properties for dired file in the echo area."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2226 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2227 (let* ((file (dired-get-filename))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2228 (file-name (file-name-nondirectory file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2229 (dired-buf (buffer-name (current-buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2230 (props (mapconcat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2231 'princ
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2232 (image-dired-list-tags file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2233 ", "))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2234 (comment (image-dired-get-comment file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2235 (if file-name
87096
a99a2e8bc21e Fix possibly buggy calls to `message'.
Deepak Goel <deego@gnufans.org>
parents: 85478
diff changeset
2236 (message "%s"
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2237 (image-dired-format-properties-string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2238 dired-buf
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2239 file-name
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2240 props
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2241 comment)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2242
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2243 (defvar image-dired-tag-file-list nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2244 "List to store tag-file structure.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2245
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2246 (defvar image-dired-file-tag-list nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2247 "List to store file-tag structure.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2248
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2249 (defvar image-dired-file-comment-list nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2250 "List to store file comments.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2251
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2252 (defun image-dired-add-to-tag-file-list (tag file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2253 "Add relation between TAG and FILE."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2254 (let (curr)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2255 (if image-dired-tag-file-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2256 (if (setq curr (assoc tag image-dired-tag-file-list))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2257 (if (not (member file curr))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2258 (setcdr curr (cons file (cdr curr))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2259 (setcdr image-dired-tag-file-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2260 (cons (list tag file) (cdr image-dired-tag-file-list))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2261 (setq image-dired-tag-file-list (list (list tag file))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2262
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2263 (defun image-dired-add-to-tag-file-lists (tag file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2264 "Helper function used from `image-dired-create-gallery-lists'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2265
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2266 Add TAG to FILE in one list and FILE to TAG in the other.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2267
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2268 Lisp structures look like the following:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2269
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2270 image-dired-file-tag-list:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2271
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2272 ((\"filename1\" \"tag1\" \"tag2\" \"tag3\" ...)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2273 (\"filename2\" \"tag1\" \"tag2\" \"tag3\" ...)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2274 ...)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2275
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2276 image-dired-tag-file-list:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2277
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2278 ((\"tag1\" \"filename1\" \"filename2\" \"filename3\" ...)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2279 (\"tag2\" \"filename1\" \"filename2\" \"filename3\" ...)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2280 ...)"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2281 ;; Add tag to file list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2282 (let (curr)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2283 (if image-dired-file-tag-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2284 (if (setq curr (assoc file image-dired-file-tag-list))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2285 (setcdr curr (cons tag (cdr curr)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2286 (setcdr image-dired-file-tag-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2287 (cons (list file tag) (cdr image-dired-file-tag-list))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2288 (setq image-dired-file-tag-list (list (list file tag))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2289 ;; Add file to tag list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2290 (if image-dired-tag-file-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2291 (if (setq curr (assoc tag image-dired-tag-file-list))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2292 (if (not (member file curr))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2293 (setcdr curr (cons file (cdr curr))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2294 (setcdr image-dired-tag-file-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2295 (cons (list tag file) (cdr image-dired-tag-file-list))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2296 (setq image-dired-tag-file-list (list (list tag file))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2297
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2298 (defun image-dired-add-to-file-comment-list (file comment)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2299 "Helper function used from `image-dired-create-gallery-lists'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2300
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2301 For FILE, add COMMENT to list.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2302
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2303 Lisp structure looks like the following:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2304
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2305 image-dired-file-comment-list:
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2306
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2307 ((\"filename1\" . \"comment1\")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2308 (\"filename2\" . \"comment2\")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2309 ...)"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2310 (if image-dired-file-comment-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2311 (if (not (assoc file image-dired-file-comment-list))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2312 (setcdr image-dired-file-comment-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2313 (cons (cons file comment)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2314 (cdr image-dired-file-comment-list))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2315 (setq image-dired-file-comment-list (list (cons file comment)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2316
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2317 (defun image-dired-create-gallery-lists ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2318 "Create temporary lists used by `image-dired-gallery-generate'."
78183
e82750b21f0c (image-dired-sane-db-file): New func.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 77585
diff changeset
2319 (image-dired-sane-db-file)
77405
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2320 (let ((buf (find-file image-dired-db-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2321 end beg file row-tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2322 (setq image-dired-tag-file-list nil)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2323 (setq image-dired-file-tag-list nil)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2324 (setq image-dired-file-comment-list nil)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2325 (goto-char (point-min))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2326 (while (search-forward-regexp "^." nil t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2327 (end-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2328 (setq end (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2329 (beginning-of-line)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2330 (setq beg (point))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2331 (if (not (search-forward ";" end nil))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2332 (error "Something is really wrong, check format of database"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2333 (setq row-tags (split-string
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2334 (buffer-substring beg end) ";"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2335 (setq file (car row-tags))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2336 (mapc
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2337 (lambda (x)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2338 (if (not (string-match "^comment:\\(.*\\)" x))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2339 (image-dired-add-to-tag-file-lists x file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2340 (image-dired-add-to-file-comment-list file (match-string 1 x))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2341 (cdr row-tags)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2342 (kill-buffer buf))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2343 ;; Sort tag-file list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2344 (setq image-dired-tag-file-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2345 (sort image-dired-tag-file-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2346 (lambda (x y)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2347 (string< (car x) (car y))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2348
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2349 (defun image-dired-hidden-p (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2350 "Return t if image FILE has a \"hidden\" tag."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2351 (let (hidden)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2352 (mapc
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2353 (lambda (tag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2354 (if (member tag image-dired-gallery-hidden-tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2355 (setq hidden t)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2356 (cdr (assoc file image-dired-file-tag-list)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2357 hidden))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2358
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2359 (defun image-dired-gallery-generate ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2360 "Generate gallery pages.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2361 First we create a couple of Lisp structures from the database to make
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2362 it easier to generate, then HTML-files are created in
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2363 `image-dired-gallery-dir'"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2364 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2365 (if (eq 'per-directory image-dired-thumbnail-storage)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2366 (error "Currently, gallery generation is not supported \
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2367 when using per-directory thumbnail file storage"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2368 (image-dired-create-gallery-lists)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2369 (let ((tags image-dired-tag-file-list)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2370 count curr tag index-buf tag-buf
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2371 comment file-tags tag-link tag-link-list)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2372 ;; Make sure gallery root exist
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2373 (if (file-exists-p image-dired-gallery-dir)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2374 (if (not (file-directory-p image-dired-gallery-dir))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2375 (error "Variable image-dired-gallery-dir is not a directory"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2376 (make-directory image-dired-gallery-dir))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2377 ;; Open index file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2378 (setq index-buf (find-file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2379 (format "%s/index.html" image-dired-gallery-dir)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2380 (erase-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2381 (insert "<html>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2382 (insert " <body>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2383 (insert " <h2>Image-Dired Gallery</h2>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2384 (insert (format "<p>\n Gallery generated %s\n <p>\n"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2385 (current-time-string)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2386 (insert " <h3>Tag index</h3>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2387 (setq count 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2388 ;; Pre-generate list of all tag links
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2389 (mapc
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2390 (lambda (curr)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2391 (setq tag (car curr))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2392 (when (not (member tag image-dired-gallery-hidden-tags))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2393 (setq tag-link (format "<a href=\"%d.html\">%s</a>" count tag))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2394 (if tag-link-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2395 (setq tag-link-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2396 (append tag-link-list (list (cons tag tag-link))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2397 (setq tag-link-list (list (cons tag tag-link))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2398 (setq count (1+ count))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2399 tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2400 (setq count 1)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2401 ;; Main loop where we generated thumbnail pages per tag
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2402 (mapc
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2403 (lambda (curr)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2404 (setq tag (car curr))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2405 ;; Don't display hidden tags
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2406 (when (not (member tag image-dired-gallery-hidden-tags))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2407 ;; Insert link to tag page in index
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2408 (insert (format " %s<br>\n" (cdr (assoc tag tag-link-list))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2409 ;; Open per-tag file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2410 (setq tag-buf (find-file
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2411 (format "%s/%s.html" image-dired-gallery-dir count)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2412 (erase-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2413 (insert "<html>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2414 (insert " <body>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2415 (insert " <p><a href=\"index.html\">Index</a></p>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2416 (insert (format " <h2>Images with tag &quot;%s&quot;</h2>" tag))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2417 ;; Main loop for files per tag page
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2418 (mapc
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2419 (lambda (file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2420 (when (not (image-dired-hidden-p file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2421 ;; Insert thumbnail with link to full image
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2422 (insert
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2423 (format "<a href=\"%s/%s\"><img src=\"%s/%s\"%s></a>\n"
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2424 image-dired-gallery-image-root-url
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2425 (file-name-nondirectory file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2426 image-dired-gallery-thumb-image-root-url
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2427 (file-name-nondirectory (image-dired-thumb-name file)) file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2428 ;; Insert comment, if any
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2429 (if (setq comment (cdr (assoc file image-dired-file-comment-list)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2430 (insert (format "<br>\n%s<br>\n" comment))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2431 (insert "<br>\n"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2432 ;; Insert links to other tags, if any
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2433 (when (> (length
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2434 (setq file-tags (assoc file image-dired-file-tag-list))) 2)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2435 (insert "[ ")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2436 (mapc
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2437 (lambda (extra-tag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2438 ;; Only insert if not file name or the main tag
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2439 (if (and (not (equal extra-tag tag))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2440 (not (equal extra-tag file)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2441 (insert
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2442 (format "%s " (cdr (assoc extra-tag tag-link-list))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2443 file-tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2444 (insert "]<br>\n"))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2445 (cdr curr))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2446 (insert " <p><a href=\"index.html\">Index</a></p>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2447 (insert " </body>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2448 (insert "</html>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2449 (save-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2450 (kill-buffer tag-buf)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2451 (setq count (1+ count))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2452 tags)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2453 (insert " </body>\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2454 (insert "</html>")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2455 (save-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2456 (kill-buffer index-buf)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2457
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2458 (defun image-dired-kill-buffer-and-window ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2459 "Kill the current buffer and, if possible, also the window."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2460 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2461 (let ((buffer (current-buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2462 (condition-case nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2463 (delete-window (selected-window))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2464 (error nil))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2465 (kill-buffer buffer)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2466
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2467 (defvar image-dired-widget-list nil
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2468 "List to keep track of meta data in edit buffer.")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2469
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2470 ;;;###autoload
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2471 (defun image-dired-dired-edit-comment-and-tags ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2472 "Edit comment and tags of current or marked image files.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2473 Edit comment and tags for all marked image files in an
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2474 easy-to-use form."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2475 (interactive)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2476 (setq image-dired-widget-list nil)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2477 ;; Setup buffer.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2478 (let ((files (dired-get-marked-files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2479 (switch-to-buffer "*Image-Dired Edit Meta Data*")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2480 (kill-all-local-variables)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2481 (make-local-variable 'widget-example-repeat)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2482 (let ((inhibit-read-only t))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2483 (erase-buffer))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2484 (remove-overlays)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2485 ;; Some help for the user.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2486 (widget-insert
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2487 "\nEdit comments and tags for each image. Separate multiple tags
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2488 with a comma. Move forward between fields using TAB or RET.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2489 Move to the previous field using backtab (S-TAB). Save by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2490 activating the Save button at the bottom of the form or cancel
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2491 the operation by activating the Cancel button.\n\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2492 ;; Here comes all images and a comment and tag field for each
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2493 ;; image.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2494 (let (thumb-file img comment-widget tag-widget)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2495
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2496 (dolist (file files)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2497
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2498 (setq thumb-file (image-dired-thumb-name file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2499 img (create-image thumb-file))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2500
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2501 (insert-image img)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2502 (widget-insert "\n\nComment: ")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2503 (setq comment-widget
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2504 (widget-create 'editable-field
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2505 :size 60
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2506 :format "%v "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2507 :value (or (image-dired-get-comment file) "")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2508 (widget-insert "\nTags: ")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2509 (setq tag-widget
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2510 (widget-create 'editable-field
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2511 :size 60
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2512 :format "%v "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2513 :value (or (mapconcat
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2514 (lambda (tag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2515 tag)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2516 (image-dired-list-tags file)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2517 ",") "")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2518 ;; Save information in all widgets so that we can use it when
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2519 ;; the user saves the form.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2520 (setq image-dired-widget-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2521 (append image-dired-widget-list
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2522 (list (list file comment-widget tag-widget))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2523 (widget-insert "\n\n")))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2524
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2525 ;; Footer with Save and Cancel button.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2526 (widget-insert "\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2527 (widget-create 'push-button
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2528 :notify
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2529 (lambda (&rest ignore)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2530 (image-dired-save-information-from-widgets)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2531 (bury-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2532 (message "Done."))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2533 "Save")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2534 (widget-insert " ")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2535 (widget-create 'push-button
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2536 :notify
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2537 (lambda (&rest ignore)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2538 (bury-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2539 (message "Operation canceled."))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2540 "Cancel")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2541 (widget-insert "\n")
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2542 (use-local-map widget-keymap)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2543 (widget-setup)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2544 ;; Jump to the first widget.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2545 (widget-forward 1)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2546
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2547 (defun image-dired-save-information-from-widgets ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2548 "Save information found in `image-dired-widget-list'.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2549 Use the information in `image-dired-widget-list' to save comments and
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2550 tags to their respective image file. Internal function used by
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2551 `image-dired-dired-edit-comment-and-tags'."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2552 (let (file comment tag-string tag-list lst)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2553 (image-dired-write-comments
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2554 (mapcar
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2555 (lambda (widget)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2556 (setq file (car widget)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2557 comment (widget-value (cadr widget)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2558 (cons file comment))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2559 image-dired-widget-list))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2560 (image-dired-write-tags
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2561 (dolist (widget image-dired-widget-list lst)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2562 (setq file (car widget)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2563 tag-string (widget-value (car (cddr widget)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2564 tag-list (split-string tag-string ","))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2565 (dolist (tag tag-list)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2566 (push (cons file tag) lst))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2567
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2568 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2569 ;;;;;;;;; TEST-SECTION ;;;;;;;;;;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2570 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2571
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2572 ;; (defvar image-dired-dir-max-size 12300000)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2573
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2574 ;; (defun image-dired-test-clean-old-files ()
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2575 ;; "Clean `image-dired-dir' from old thumbnail files.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2576 ;; \"Oldness\" measured using last access time. If the total size of all
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2577 ;; thumbnail files in `image-dired-dir' is larger than 'image-dired-dir-max-size',
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2578 ;; old files are deleted until the max size is reached."
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2579 ;; (let* ((files
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2580 ;; (sort
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2581 ;; (mapcar
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2582 ;; (lambda (f)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2583 ;; (let ((fattribs (file-attributes f)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2584 ;; ;; Get last access time and file size
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2585 ;; `(,(nth 4 fattribs) ,(nth 7 fattribs) ,f)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2586 ;; (directory-files (image-dired-dir) t ".+\.thumb\..+$"))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2587 ;; ;; Sort function. Compare time between two files.
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2588 ;; '(lambda (l1 l2)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2589 ;; (time-less-p (car l1) (car l2)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2590 ;; (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) files))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2591 ;; (while (> dirsize image-dired-dir-max-size)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2592 ;; (y-or-n-p
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2593 ;; (format "Size of thumbnail directory: %d, delete old file %s? "
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2594 ;; dirsize (cadr (cdar files))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2595 ;; (delete-file (cadr (cdar files)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2596 ;; (setq dirsize (- dirsize (car (cdar files))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2597 ;; (setq files (cdr files)))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2598
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2599 ;;;;;;;;;;;;;;;;;;;;;;,
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2600
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2601 ;; (defun dired-speedbar-buttons (dired-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2602 ;; (when (and (boundp 'image-dired-use-speedbar)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2603 ;; image-dired-use-speedbar)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2604 ;; (let ((filename (with-current-buffer dired-buffer
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2605 ;; (dired-get-filename))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2606 ;; (when (and (not (string-equal filename (buffer-string)))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2607 ;; (string-match (image-file-name-regexp) filename))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2608 ;; (erase-buffer)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2609 ;; (insert (propertize
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2610 ;; filename
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2611 ;; 'display
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2612 ;; (image-dired-get-thumbnail-image filename)))))))
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2613
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2614 ;; (setq image-dired-use-speedbar t)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2615
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2616 (provide 'image-dired)
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2617
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2618 ;; arch-tag: 9d11411d-331f-4380-8b44-8adfe3a0343e
7b2ac92c7dd7 Rename from "thumbnails.el"; all instances of "thumbnails" changed to
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2619 ;;; image-dired.el ends here