annotate lisp/image.el @ 88254:dd2fd4664465

*** empty log message ***
author Henrik Enberg <henrik.enberg@telia.com>
date Sat, 21 Jan 2006 03:39:48 +0000
parents d7ddb3e565de
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; image.el --- image API
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003,
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
4 ;; 2004, 2005 Free Software Foundation, Inc.
42316
b1023d722287 Add Maintainer header.
Pavel Janík <Pavel@Janik.cz>
parents: 38884
diff changeset
5
b1023d722287 Add Maintainer header.
Pavel Janík <Pavel@Janik.cz>
parents: 38884
diff changeset
6 ;; Maintainer: FSF
25309
6842eb73559c Add Keywords.
Dave Love <fx@gnu.org>
parents: 25003
diff changeset
7 ;; Keywords: multimedia
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; any later version.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
24 ;; Boston, MA 02110-1301, USA.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 ;;; Code:
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29
32166
e3be69cf6c81 (image): New group.
Miles Bader <miles@gnu.org>
parents: 31635
diff changeset
30
e3be69cf6c81 (image): New group.
Miles Bader <miles@gnu.org>
parents: 31635
diff changeset
31 (defgroup image ()
e3be69cf6c81 (image): New group.
Miles Bader <miles@gnu.org>
parents: 31635
diff changeset
32 "Image support."
e3be69cf6c81 (image): New group.
Miles Bader <miles@gnu.org>
parents: 31635
diff changeset
33 :group 'multimedia)
e3be69cf6c81 (image): New group.
Miles Bader <miles@gnu.org>
parents: 31635
diff changeset
34
e3be69cf6c81 (image): New group.
Miles Bader <miles@gnu.org>
parents: 31635
diff changeset
35
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
36 (defconst image-type-header-regexps
38746
0fc8e4a27edc (image-type-regexps): Allow whitespace at the start
Gerd Moellmann <gerd@gnu.org>
parents: 38732
diff changeset
37 '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
38709
00a56d6da660 (image-type-regexps): Use `\`' instead of `^' in
Gerd Moellmann <gerd@gnu.org>
parents: 37035
diff changeset
38 ("\\`P[1-6]" . pbm)
00a56d6da660 (image-type-regexps): Use `\`' instead of `^' in
Gerd Moellmann <gerd@gnu.org>
parents: 37035
diff changeset
39 ("\\`GIF8" . gif)
00a56d6da660 (image-type-regexps): Use `\`' instead of `^' in
Gerd Moellmann <gerd@gnu.org>
parents: 37035
diff changeset
40 ("\\`\211PNG\r\n" . png)
38746
0fc8e4a27edc (image-type-regexps): Allow whitespace at the start
Gerd Moellmann <gerd@gnu.org>
parents: 38732
diff changeset
41 ("\\`[\t\n\r ]*#define" . xbm)
38884
afaef792868d (image-type-regexps): Make sure that the TIFF
Gerd Moellmann <gerd@gnu.org>
parents: 38794
diff changeset
42 ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
38746
0fc8e4a27edc (image-type-regexps): Allow whitespace at the start
Gerd Moellmann <gerd@gnu.org>
parents: 38732
diff changeset
43 ("\\`[\t\n\r ]*%!PS" . postscript)
38732
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
44 ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 When the first bytes of an image file match REGEXP, it is assumed to
38732
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
47 be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol. If not a symbol,
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
48 IMAGE-TYPE must be a pair (PREDICATE . TYPE). PREDICATE is called
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
49 with one argument, a string containing the image data. If PREDICATE returns
49589
de51db566826 (image-type-regexps): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 49588
diff changeset
50 a non-nil value, TYPE is the image's type.")
38732
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
51
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
52 (defconst image-type-file-name-regexps
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
53 '(("\\.png\\'" . png)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
54 ("\\.gif\\'" . gif)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
55 ("\\.jpe?g\\'" . jpeg)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
56 ("\\.bmp\\'" . bmp)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
57 ("\\.xpm\\'" . xpm)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
58 ("\\.pbm\\'" . pbm)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
59 ("\\.xbm\\'" . xbm)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
60 ("\\.ps\\'" . postscript)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
61 ("\\.tiff?\\'" . tiff))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
62 "Alist of (REGEXP . IMAGE-TYPE) pairs used to identify image files.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
63 When the name of an image file match REGEXP, it is assumed to
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
64 be of image type IMAGE-TYPE.")
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
65
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
66
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
67 (defvar image-load-path nil
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
68 "List of locations in which to search for image files.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
69 If an element is a string, it defines a directory to search.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
70 If an element is a variable symbol whose value is a string, that
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
71 value defines a directory to search.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
72 If an element is a variable symbol whose value is a list, the
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
73 value is used as a list of directories to search.")
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
74
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
75 (eval-at-startup
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
76 (setq image-load-path
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
77 (list (file-name-as-directory (expand-file-name "images" data-directory))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
78 'data-directory 'load-path)))
38732
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
79
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
80 (defun image-jpeg-p (data)
46810
65ad7b458435 (image-jpeg-p): Accept "Exif" marker.
Richard M. Stallman <rms@gnu.org>
parents: 43834
diff changeset
81 "Value is non-nil if DATA, a string, consists of JFIF image data.
65ad7b458435 (image-jpeg-p): Accept "Exif" marker.
Richard M. Stallman <rms@gnu.org>
parents: 43834
diff changeset
82 We accept the tag Exif because that is the same format."
38732
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
83 (when (string-match "\\`\xff\xd8" data)
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
84 (catch 'jfif
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
85 (let ((len (length data)) (i 2))
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
86 (while (< i len)
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
87 (when (/= (aref data i) #xff)
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
88 (throw 'jfif nil))
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
89 (setq i (1+ i))
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
90 (when (>= (+ i 2) len)
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
91 (throw 'jfif nil))
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
92 (let ((nbytes (+ (lsh (aref data (+ i 1)) 8)
38776
a679a282d5cb (image-jpeg-p): Test for APPn markers in the range
Gerd Moellmann <gerd@gnu.org>
parents: 38746
diff changeset
93 (aref data (+ i 2))))
a679a282d5cb (image-jpeg-p): Test for APPn markers in the range
Gerd Moellmann <gerd@gnu.org>
parents: 38746
diff changeset
94 (code (aref data i)))
a679a282d5cb (image-jpeg-p): Test for APPn markers in the range
Gerd Moellmann <gerd@gnu.org>
parents: 38746
diff changeset
95 (when (and (>= code #xe0) (<= code #xef))
38732
24fe4f884e82 (image-type-regexps): Allow predicates. Change the way
Gerd Moellmann <gerd@gnu.org>
parents: 38711
diff changeset
96 ;; APP0 LEN1 LEN2 "JFIF\0"
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48130
diff changeset
97 (throw 'jfif
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
98 (string-match "JFIF\\|Exif"
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
99 (substring data i (min (+ i nbytes) len)))))
38746
0fc8e4a27edc (image-type-regexps): Allow whitespace at the start
Gerd Moellmann <gerd@gnu.org>
parents: 38732
diff changeset
100 (setq i (+ i 1 nbytes))))))))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 ;;;###autoload
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
104 (defun image-type-from-data (data)
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
105 "Determine the image type from image data DATA.
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
106 Value is a symbol specifying the image type or nil if type cannot
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
107 be determined."
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
108 (let ((types image-type-header-regexps)
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
109 type)
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
110 (while types
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
111 (let ((regexp (car (car types)))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
112 (image-type (cdr (car types))))
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
113 (if (or (and (symbolp image-type)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
114 (string-match regexp data))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
115 (and (consp image-type)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
116 (funcall (car image-type) data)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
117 (setq image-type (cdr image-type))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
118 (setq type image-type
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
119 types nil)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
120 (setq types (cdr types)))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
121 type))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
122
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
123
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
124 ;;;###autoload
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
125 (defun image-type-from-buffer ()
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
126 "Determine the image type from data in the current buffer.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
127 Value is a symbol specifying the image type or nil if type cannot
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
128 be determined."
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
129 (let ((types image-type-header-regexps)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
130 type
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
131 (opoint (point)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
132 (goto-char (point-min))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
133 (while types
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
134 (let ((regexp (car (car types)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
135 (image-type (cdr (car types)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
136 data)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
137 (if (or (and (symbolp image-type)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
138 (looking-at regexp))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
139 (and (consp image-type)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
140 (funcall (car image-type)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
141 (or data
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
142 (setq data
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
143 (buffer-substring
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
144 (point-min)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
145 (min (point-max)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
146 (+ (point-min) 256))))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
147 (setq image-type (cdr image-type))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
148 (setq type image-type
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
149 types nil)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
150 (setq types (cdr types)))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
151 (goto-char opoint)
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
152 type))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
153
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
154
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
155 ;;;###autoload
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 (defun image-type-from-file-header (file)
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157 "Determine the type of image file FILE from its first few bytes.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 Value is a symbol specifying the image type, or nil if type cannot
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
159 be determined."
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
160 (unless (or (file-readable-p file)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
161 (file-name-absolute-p file))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
162 (setq file (image-search-load-path file)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
163 (and file
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
164 (file-readable-p file)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
165 (with-temp-buffer
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
166 (set-buffer-multibyte nil)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
167 (insert-file-contents-literally file nil 0 256)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
168 (image-type-from-buffer))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
169
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
170
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
171 ;;;###autoload
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
172 (defun image-type-from-file-name (file)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
173 "Determine the type of image file FILE from its name.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
174 Value is a symbol specifying the image type, or nil if type cannot
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
175 be determined."
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
176 (let ((types image-type-file-name-regexps)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
177 type)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
178 (while types
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
179 (if (string-match (car (car types)) file)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
180 (setq type (cdr (car types))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
181 types nil)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
182 (setq types (cdr types))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
183 type))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 ;;;###autoload
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (defun image-type-available-p (type)
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
188 "Return non-nil if image type TYPE is available.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 Image types are symbols like `xbm' or `jpeg'."
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
190 (and (fboundp 'init-image-library)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
191 (init-image-library type image-library-alist)))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 ;;;###autoload
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
195 (defun create-image (file-or-data &optional type data-p &rest props)
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
196 "Create an image.
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
197 FILE-OR-DATA is an image file name or image data.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 Optional TYPE is a symbol describing the image type. If TYPE is omitted
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
199 or nil, try to determine the image type from its first few bytes
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
200 of image data. If that doesn't work, and FILE-OR-DATA is a file name,
34378
5ae7af279df7 (create-image): Doc fix; spotted by Per Cederqvist <ceder@lysator.liu.se>.
Eli Zaretskii <eliz@gnu.org>
parents: 32166
diff changeset
201 use its file extension as image type.
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
202 Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203 Optional PROPS are additional image attributes to assign to the image,
31635
208d8385ccae (create-image): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 30952
diff changeset
204 like, e.g. `:mask MASK'.
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
205 Value is the image created, or nil if images of type TYPE are not supported.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
206
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
207 Images should not be larger than specified by `max-image-size'."
27075
893ec72bd6b1 (create-image, defimage): Don't assume image data is a
Gerd Moellmann <gerd@gnu.org>
parents: 27073
diff changeset
208 (when (and (not data-p) (not (stringp file-or-data)))
893ec72bd6b1 (create-image, defimage): Don't assume image data is a
Gerd Moellmann <gerd@gnu.org>
parents: 27073
diff changeset
209 (error "Invalid image file name `%s'" file-or-data))
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
210 (cond ((null data-p)
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
211 ;; FILE-OR-DATA is a file name.
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
212 (unless (or type
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
213 (setq type (image-type-from-file-header file-or-data)))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
214 (let ((extension (file-name-extension file-or-data)))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
215 (unless extension
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
216 (error "Cannot determine image type"))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
217 (setq type (intern extension)))))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
218 (t
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
219 ;; FILE-OR-DATA contains image data.
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
220 (unless type
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
221 (setq type (image-type-from-data file-or-data)))))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
222 (unless type
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
223 (error "Cannot determine image type"))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224 (unless (symbolp type)
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
225 (error "Invalid image type `%s'" type))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226 (when (image-type-available-p type)
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
227 (append (list 'image :type type (if data-p :data :file) file-or-data)
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
228 props)))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231 ;;;###autoload
29470
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
232 (defun put-image (image pos &optional string area)
25617
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
233 "Put image IMAGE in front of POS in the current buffer.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234 IMAGE must be an image created with `create-image' or `defimage'.
25816
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
235 IMAGE is displayed by putting an overlay into the current buffer with a
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
236 `before-string' STRING that has a `display' property whose value is the
29470
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
237 image. STRING is defaulted if you omit it.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
238 POS may be an integer or marker.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239 AREA is where to display the image. AREA nil or omitted means
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
240 display it in the text area, a value of `left-margin' means
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
241 display it in the left marginal area, a value of `right-margin'
25816
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
242 means display it in the right marginal area."
29626
ecb96a7369d3 Fix last change to be in insert-image as intended.
Dave Love <fx@gnu.org>
parents: 29624
diff changeset
243 (unless string (setq string "x"))
25617
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
244 (let ((buffer (current-buffer)))
29470
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
245 (unless (eq (car-safe image) 'image)
25617
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
246 (error "Not an image: %s" image))
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
247 (unless (or (null area) (memq area '(left-margin right-margin)))
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
248 (error "Invalid area %s" area))
25816
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
249 (setq string (copy-sequence string))
25617
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
250 (let ((overlay (make-overlay pos pos buffer))
25816
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
251 (prop (if (null area) image (list (list 'margin area) image))))
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
252 (put-text-property 0 (length string) 'display prop string)
25617
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
253 (overlay-put overlay 'put-image t)
697b28471784 (put-image): Remove optional buffer parameter.
Gerd Moellmann <gerd@gnu.org>
parents: 25309
diff changeset
254 (overlay-put overlay 'before-string string))))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257 ;;;###autoload
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
258 (defun insert-image (image &optional string area slice)
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 "Insert IMAGE into current buffer at point.
25816
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
260 IMAGE is displayed by inserting STRING into the current buffer
29470
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
261 with a `display' property whose value is the image. STRING is
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
262 defaulted if you omit it.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 AREA is where to display the image. AREA nil or omitted means
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 display it in the text area, a value of `left-margin' means
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 display it in the left marginal area, a value of `right-margin'
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
266 means display it in the right marginal area.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
267 SLICE specifies slice of IMAGE to insert. SLICE nil or omitted
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
268 means insert whole image. SLICE is a list (X Y WIDTH HEIGHT)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
269 specifying the X and Y positions and WIDTH and HEIGHT of image area
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
270 to insert. A float value 0.0 - 1.0 means relative to the width or
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
271 height of the image; integer values are taken as pixel values."
29626
ecb96a7369d3 Fix last change to be in insert-image as intended.
Dave Love <fx@gnu.org>
parents: 29624
diff changeset
272 ;; Use a space as least likely to cause trouble when it's a hidden
ecb96a7369d3 Fix last change to be in insert-image as intended.
Dave Love <fx@gnu.org>
parents: 29624
diff changeset
273 ;; character in the buffer.
ecb96a7369d3 Fix last change to be in insert-image as intended.
Dave Love <fx@gnu.org>
parents: 29624
diff changeset
274 (unless string (setq string " "))
29470
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
275 (unless (eq (car-safe image) 'image)
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 (error "Not an image: %s" image))
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
277 (unless (or (null area) (memq area '(left-margin right-margin)))
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
278 (error "Invalid area %s" area))
29607
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
279 (if area
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
280 (setq image (list (list 'margin area) image))
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
281 ;; Cons up a new spec equal but not eq to `image' so that
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
282 ;; inserting it twice in a row (adjacently) displays two copies of
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
283 ;; the image. Don't try to avoid this by looking at the display
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
284 ;; properties on either side so that we DTRT more often with
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
285 ;; cut-and-paste. (Yanking killed image text next to another copy
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
286 ;; of it loses anyway.)
42d156d8d8eb (insert-image): Save a little consing.
Dave Love <fx@gnu.org>
parents: 29470
diff changeset
287 (setq image (cons 'image (cdr image))))
25816
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
288 (let ((start (point)))
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
289 (insert string)
2d53a03a3baa (put-image, insert-image): Add string argument.
Gerd Moellmann <gerd@gnu.org>
parents: 25617
diff changeset
290 (add-text-properties start (point)
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
291 `(display ,(if slice
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
292 (list (cons 'slice slice) image)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
293 image) rear-nonsticky (display)))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
294
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
295
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
296 ;;;###autoload
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
297 (defun insert-sliced-image (image &optional string area rows cols)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
298 "Insert IMAGE into current buffer at point.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
299 IMAGE is displayed by inserting STRING into the current buffer
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
300 with a `display' property whose value is the image. STRING is
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
301 defaulted if you omit it.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
302 AREA is where to display the image. AREA nil or omitted means
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
303 display it in the text area, a value of `left-margin' means
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
304 display it in the left marginal area, a value of `right-margin'
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
305 means display it in the right marginal area.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
306 The image is automatically split into ROW x COLS slices."
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
307 (unless string (setq string " "))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
308 (unless (eq (car-safe image) 'image)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
309 (error "Not an image: %s" image))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
310 (unless (or (null area) (memq area '(left-margin right-margin)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
311 (error "Invalid area %s" area))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
312 (if area
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
313 (setq image (list (list 'margin area) image))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
314 ;; Cons up a new spec equal but not eq to `image' so that
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
315 ;; inserting it twice in a row (adjacently) displays two copies of
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
316 ;; the image. Don't try to avoid this by looking at the display
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
317 ;; properties on either side so that we DTRT more often with
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
318 ;; cut-and-paste. (Yanking killed image text next to another copy
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
319 ;; of it loses anyway.)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
320 (setq image (cons 'image (cdr image))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
321 (let ((x 0.0) (dx (/ 1.0001 (or cols 1)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
322 (y 0.0) (dy (/ 1.0001 (or rows 1))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
323 (while (< y 1.0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
324 (while (< x 1.0)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
325 (let ((start (point)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
326 (insert string)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
327 (add-text-properties start (point)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
328 `(display ,(list (list 'slice x y dx dy) image)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
329 rear-nonsticky (display)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
330 (setq x (+ x dx))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
331 (setq x 0.0
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
332 y (+ y dy))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
333 (insert (propertize "\n" 'line-height t)))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
334
26007
774b2504710b (insert-image): Copy the image spec and add an intangible property.
Dave Love <fx@gnu.org>
parents: 25872
diff changeset
335
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 ;;;###autoload
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 (defun remove-images (start end &optional buffer)
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339 "Remove images between START and END in BUFFER.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 Remove only images that were put in BUFFER with calls to `put-image'.
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 BUFFER nil or omitted means use the current buffer."
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 (unless buffer
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 (setq buffer (current-buffer)))
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344 (let ((overlays (overlays-in start end)))
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345 (while overlays
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 (let ((overlay (car overlays)))
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347 (when (overlay-get overlay 'put-image)
25857
fdc2bd91cf63 (defimage): Remove redundant code. Substitute file on image plist.
Dave Love <fx@gnu.org>
parents: 25816
diff changeset
348 (delete-overlay overlay)))
fdc2bd91cf63 (defimage): Remove redundant code. Substitute file on image plist.
Dave Love <fx@gnu.org>
parents: 25816
diff changeset
349 (setq overlays (cdr overlays)))))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
350
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
351 (defun image-search-load-path (file &optional path)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
352 (unless path
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
353 (setq path image-load-path))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
354 (let (element found filename)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
355 (while (and (not found) (consp path))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
356 (setq element (car path))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
357 (cond
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
358 ((stringp element)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
359 (setq found
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
360 (file-readable-p
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
361 (setq filename (expand-file-name file element)))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
362 ((and (symbolp element) (boundp element))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
363 (setq element (symbol-value element))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
364 (cond
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
365 ((stringp element)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
366 (setq found
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
367 (file-readable-p
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
368 (setq filename (expand-file-name file element)))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
369 ((consp element)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
370 (if (setq filename (image-search-load-path file element))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
371 (setq found t))))))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
372 (setq path (cdr path)))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
373 (if found filename)))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375 ;;;###autoload
28721
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
376 (defun find-image (specs)
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
377 "Find an image, choosing one of a list of image specifications.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378
29470
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
379 SPECS is a list of image specifications.
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381 Each image specification in SPECS is a property list. The contents of
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382 a specification are image type dependent. All specifications must at
27059
6bb2a4a0413e * image.el (defimage): Images with the :data keyword should be considered valid as well.
William M. Perry <wmperry@aventail.com>
parents: 26007
diff changeset
383 least contain the properties `:type TYPE' and either `:file FILE' or
6bb2a4a0413e * image.el (defimage): Images with the :data keyword should be considered valid as well.
William M. Perry <wmperry@aventail.com>
parents: 26007
diff changeset
384 `:data DATA', where TYPE is a symbol specifying the image type,
6bb2a4a0413e * image.el (defimage): Images with the :data keyword should be considered valid as well.
William M. Perry <wmperry@aventail.com>
parents: 26007
diff changeset
385 e.g. `xbm', FILE is the file to load the image from, and DATA is a
29470
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
386 string containing the actual image data. The specification whose TYPE
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
387 is supported, and FILE exists, is used to construct the image
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
388 specification to be returned. Return nil if no specification is
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
389 satisfied.
7bde123bed95 (find-image): Doc fix. Return nil if image not found.
Dave Love <fx@gnu.org>
parents: 28958
diff changeset
390
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
391 The image is looked for in `image-load-path'.
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
392
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
393 Image files should not be larger than specified by `max-image-size'."
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 (let (image)
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 (while (and specs (null image))
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 (let* ((spec (car specs))
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
397 (type (plist-get spec :type))
27059
6bb2a4a0413e * image.el (defimage): Images with the :data keyword should be considered valid as well.
William M. Perry <wmperry@aventail.com>
parents: 26007
diff changeset
398 (data (plist-get spec :data))
27921
ea0a2a4f20b7 (defimage): Look for image files in load-path.
Gerd Moellmann <gerd@gnu.org>
parents: 27075
diff changeset
399 (file (plist-get spec :file))
ea0a2a4f20b7 (defimage): Look for image files in load-path.
Gerd Moellmann <gerd@gnu.org>
parents: 27075
diff changeset
400 found)
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
401 (when (image-type-available-p type)
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
402 (cond ((stringp file)
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
403 (if (setq found (image-search-load-path file))
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
404 (setq image
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
405 (cons 'image (plist-put (copy-sequence spec)
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
406 :file found)))))
27075
893ec72bd6b1 (create-image, defimage): Don't assume image data is a
Gerd Moellmann <gerd@gnu.org>
parents: 27073
diff changeset
407 ((not (null data))
27073
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
408 (setq image (cons 'image spec)))))
aad0a025b1e3 (defimage): Handle specifications containing :data
Gerd Moellmann <gerd@gnu.org>
parents: 27059
diff changeset
409 (setq specs (cdr specs))))
28721
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
410 image))
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
411
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
412
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
413 ;;;###autoload
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
414 (defmacro defimage (symbol specs &optional doc)
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
415 "Define SYMBOL as an image.
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
416
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
417 SPECS is a list of image specifications. DOC is an optional
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
418 documentation string.
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
419
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
420 Each image specification in SPECS is a property list. The contents of
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
421 a specification are image type dependent. All specifications must at
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
422 least contain the properties `:type TYPE' and either `:file FILE' or
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
423 `:data DATA', where TYPE is a symbol specifying the image type,
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
424 e.g. `xbm', FILE is the file to load the image from, and DATA is a
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
425 string containing the actual image data. The first image
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
426 specification whose TYPE is supported, and FILE exists, is used to
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
427 define SYMBOL.
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
428
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
429 Example:
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
430
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
431 (defimage test-image ((:type xpm :file \"~/test1.xpm\")
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
432 (:type xbm :file \"~/test1.xbm\")))"
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
433 (declare (doc-string 3))
28721
b4ea18c92e38 (find-image): New function.
Gerd Moellmann <gerd@gnu.org>
parents: 27921
diff changeset
434 `(defvar ,symbol (find-image ',specs) ,doc))
25003
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (provide 'image)
bb68fe3c72f8 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438
88155
d7ddb3e565de sync with trunk
Henrik Enberg <henrik.enberg@telia.com>
parents: 49589
diff changeset
439 ;; arch-tag: 8e76a07b-eb48-4f3e-a7a0-1a7ba9f096b3
25872
6ae50308e8a3 Fix footer comment.
Dave Love <fx@gnu.org>
parents: 25857
diff changeset
440 ;;; image.el ends here