annotate lisp/ezimage.el @ 66668:857eb702a3f1

Use insert-buffer-substring, not insert-buffer.
author Richard M. Stallman <rms@gnu.org>
date Thu, 03 Nov 2005 21:34:54 +0000
parents 7572dd565420
children 26cf94e56f83
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; ezimage --- Generalized Image management
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
66608
7572dd565420 * vc-sccs.el: Update copyright year.
Romain Francoise <romain@orebokech.com>
parents: 65780
diff changeset
3 ;;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
7572dd565420 * vc-sccs.el: Update copyright year.
Romain Francoise <romain@orebokech.com>
parents: 65780
diff changeset
4 ;;; 2005 Free Software Foundation, Inc.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Keywords: file, tags, tools
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; any later version.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
65780
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65779
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6e229fd94815 * speedbar.el: Remove RCS tag.
Chong Yidong <cyd@stupidchicken.com>
parents: 65779
diff changeset
24 ;; Boston, MA 02110-1301, USA.
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;;; Commentary:
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; A few routines for placing an image over text that will work for any
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; Emacs implementation without error. When images are not supported, then
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; they are justnot displayed.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 ;; The idea is that gui buffers (trees, buttons, etc) will have text
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 ;; representations of the GUI elements. These routines will replace the text
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 ;; with an image when images are available.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;;
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;; This file requires the `image' package if it is available.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 (condition-case nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (require 'image)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 (error nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 ;;; Code:
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 (defcustom ezimage-use-images
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (and (or (fboundp 'defimage) ; emacs 21
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (fboundp 'make-image-specifier)) ; xemacs
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (if (fboundp 'display-graphic-p) ; emacs 21
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (display-graphic-p)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 window-system) ; old emacs & xemacs
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 (or (not (fboundp 'image-type-available-p)) ; xemacs?
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 (image-type-available-p 'xpm))) ; emacs 21
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 "*Non-nil if ezimage should display icons."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 :group 'ezimage
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 :version "21.1"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 :type 'boolean)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 ;;; Create our own version of defimage
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 (eval-and-compile
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 (if (fboundp 'defimage)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 (progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 (defmacro defezimage (variable imagespec docstring)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 "Define VARIABLE as an image if `defimage' is not available.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 IMAGESPEC is the image data, and DOCSTRING is documentation for the image."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 `(progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (defimage ,variable ,imagespec ,docstring)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 (put (quote ,variable) 'ezimage t)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 ; (defalias 'defezimage 'defimage)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 ;; This hack is for the ezimage install which has an icons direcory for
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 ;; the default icons to be used.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 ;; (add-to-list 'load-path
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 ;; (concat (file-name-directory
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 ;; (locate-library "ezimage.el"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 ;; "icons"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 (if (not (fboundp 'make-glyph))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 (defmacro defezimage (variable imagespec docstring)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 "Don't bother loading up an image...
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 Argument VARIABLE is the variable to define.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 Argument IMAGESPEC is the list defining the image to create.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 Argument DOCSTRING is the documentation for VARIABLE."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 `(defvar ,variable nil ,docstring))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 ;; ELSE
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 (with-no-warnings
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 (defun ezimage-find-image-on-load-path (image)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 "Find the image file IMAGE on the load path."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 (let ((l (cons
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 ;; In XEmacs, try the data directory first (for an
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;; install in XEmacs proper.) Search the load
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 ;; path next (for user installs)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 (locate-data-directory "ezimage")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 load-path))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (r nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (while (and l (not r))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (if (file-exists-p (concat (car l) "/" image))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (setq r (concat (car l) "/" image))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (if (file-exists-p (concat (car l) "/icons/" image))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 (setq r (concat (car l) "/icons/" image))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 ))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (setq l (cdr l)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 r))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 );with-no-warnings
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 (with-no-warnings
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 (defun ezimage-convert-emacs21-imagespec-to-xemacs (spec)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 "Convert the Emacs21 image SPEC into an XEmacs image spec.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 The Emacs 21 spec is what I first learned, and is easy to convert."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (let* ((sl (car spec))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (itype (nth 1 sl))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (ifile (nth 3 sl)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (vector itype ':file (ezimage-find-image-on-load-path ifile))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 );with-no-warnings
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (defmacro defezimage (variable imagespec docstring)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 "Define VARIABLE as an image if `defimage' is not available.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 IMAGESPEC is the image data, and DOCSTRING is documentation for the image."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 `(progn
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (defvar ,variable
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 ;; The Emacs21 version of defimage looks just like the XEmacs image
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 ;; specifier, except that it needs a :type keyword. If we line
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 ;; stuff up right, we can use this cheat to support XEmacs specifiers.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (condition-case nil
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (make-glyph
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (make-image-specifier
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (ezimage-convert-emacs21-imagespec-to-xemacs (quote ,imagespec)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 'buffer)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 (error nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 ,docstring)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (put ',variable 'ezimage t)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 )))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 (defezimage ezimage-directory
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 ((:type xpm :file "ezimage/dir.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 "Image used for empty directories.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (defezimage ezimage-directory-plus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 ((:type xpm :file "ezimage/dir-plus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 "Image used for closed directories with stuff in them.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (defezimage ezimage-directory-minus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 ((:type xpm :file "ezimage/dir-minus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 "Image used for open directories with stuff in them.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (defezimage ezimage-page-plus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 ((:type xpm :file "ezimage/page-plus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 "Image used for closed files with stuff in them.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (defezimage ezimage-page-minus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 ((:type xpm :file "ezimage/page-minus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 "Image used for open files with stuff in them.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (defezimage ezimage-page
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 ((:type xpm :file "ezimage/page.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 "Image used for files with nothing interesting in it.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (defezimage ezimage-tag
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 ((:type xpm :file "ezimage/tag.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 "Image used for tags.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 (defezimage ezimage-tag-plus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 ((:type xpm :file "ezimage/tag-plus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 "Image used for closed tag groups.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 (defezimage ezimage-tag-minus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 ((:type xpm :file "ezimage/tag-minus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 "Image used for open tags.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (defezimage ezimage-tag-gt
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 ((:type xpm :file "ezimage/tag-gt.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 "Image used for closed tags (with twist arrow).")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (defezimage ezimage-tag-v
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 ((:type xpm :file "ezimage/tag-v.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 "Image used for open tags (with twist arrow).")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (defezimage ezimage-tag-type
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 ((:type xpm :file "ezimage/tag-type.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 "Image used for tags that represent a data type.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (defezimage ezimage-box-plus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 ((:type xpm :file "ezimage/box-plus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 "Image of a closed box.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (defezimage ezimage-box-minus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 ((:type xpm :file "ezimage/box-minus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 "Image of an open box.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (defezimage ezimage-mail
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 ((:type xpm :file "ezimage/mail.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 "Image if an envelope.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (defezimage ezimage-checkout
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 ((:type xpm :file "ezimage/checkmark.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 "Image representing a checkmark. For files checked out of a VC.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (defezimage ezimage-object
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 ((:type xpm :file "ezimage/bits.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 "Image representing bits (an object file.)")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (defezimage ezimage-object-out-of-date
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 ((:type xpm :file "ezimage/bitsbang.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 "Image representing bits with a ! in it. (an out of data object file.)")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 (defezimage ezimage-label
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 ((:type xpm :file "ezimage/label.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 "Image used for label prefix.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (defezimage ezimage-lock
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 ((:type xpm :file "ezimage/lock.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 "Image of a lock. Used for Read Only, or private.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 (defezimage ezimage-unlock
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 ((:type xpm :file "ezimage/unlock.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 "Image of an unlocked lock.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 (defezimage ezimage-key
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 ((:type xpm :file "ezimage/key.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 "Image of a key.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (defezimage ezimage-document-tag
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 ((:type xpm :file "ezimage/doc.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 "Image used to indicate documentation available.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (defezimage ezimage-document-plus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 ((:type xpm :file "ezimage/doc-plus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 "Image used to indicate closed documentation.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (defezimage ezimage-document-minus
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 ((:type xpm :file "ezimage/doc-minus.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 "Image used to indicate open documentation.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 (defezimage ezimage-info-tag
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 ((:type xpm :file "ezimage/info.xpm" :ascent center))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 "Image used to indicate more information available.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 (defvar ezimage-expand-image-button-alist
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 '(
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 ;; here are some standard representations
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ("<+>" . ezimage-directory-plus)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 ("<->" . ezimage-directory-minus)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 ("< >" . ezimage-directory)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 ("[+]" . ezimage-page-plus)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 ("[-]" . ezimage-page-minus)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 ("[?]" . ezimage-page)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 ("[ ]" . ezimage-page)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 ("{+}" . ezimage-box-plus)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 ("{-}" . ezimage-box-minus)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 ;; Some vaguely representitive entries
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 ("*" . ezimage-checkout)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 ("#" . ezimage-object)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 ("!" . ezimage-object-out-of-date)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 ("%" . ezimage-lock)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 "List of text and image associations.")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (defun ezimage-insert-image-button-maybe (start length &optional string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 "Insert an image button based on text starting at START for LENGTH chars.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 If buttontext is unknown, just insert that text.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 If we have an image associated with it, use that image.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 Optional argument STRING is a st ring upon which to add text properties."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (when ezimage-use-images
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 (let* ((bt (buffer-substring start (+ length start)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (a (assoc bt ezimage-expand-image-button-alist)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 ;; Regular images (created with `insert-image' are intangible
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 ;; which (I suppose) make them more compatible with XEmacs 21.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 ;; Unfortunatly, there is a giant pile o code dependent on the
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 ;; underlying text. This means if we leave it tangible, then I
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 ;; don't have to change said giant piles o code.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 (if (and a (symbol-value (cdr a)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 (ezimage-insert-over-text (symbol-value (cdr a))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 start
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 (+ start (length bt))))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 (defun ezimage-image-over-string (string &optional alist)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 "Insert over the text in STRING an image found in ALIST.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 Return STRING with properties applied."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (if ezimage-use-images
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 (let ((a (assoc string alist)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (if (and a (symbol-value (cdr a)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (ezimage-insert-over-text (symbol-value (cdr a))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 0 (length string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 string))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 string))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 (defun ezimage-insert-over-text (image start end &optional string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 "Place IMAGE over the text between START and END.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 Assumes the image is part of a gui and can be clicked on.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 Optional argument STRING is a string upon which to add text properties."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (when ezimage-use-images
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 (if (featurep 'xemacs)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 (add-text-properties start end
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 (list 'end-glyph image
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 'rear-nonsticky (list 'display)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 'invisible t
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 'detachable t)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (add-text-properties start end
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (list 'display image
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 'rear-nonsticky (list 'display))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 string)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 string)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 (defun ezimage-image-association-dump ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 "Dump out the current state of the Ezimage image alist.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 See `ezimage-expand-image-button-alist' for details."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 (interactive)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 (with-output-to-temp-buffer "*Ezimage Images*"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (set-buffer "*Ezimage Images*")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (goto-char (point-max))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 (insert "Ezimage image cache.\n\n")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 (let ((start (point)) (end nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 (insert "Image\tText\tImage Name")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 (setq end (point))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (insert "\n")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 (put-text-property start end 'face 'underline))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 (let ((ia ezimage-expand-image-button-alist))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 (while ia
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (let ((start (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (insert (car (car ia)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 (insert "\t")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 (ezimage-insert-image-button-maybe start
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (length (car (car ia))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 (insert (car (car ia)) "\t" (format "%s" (cdr (car ia))) "\n"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 (setq ia (cdr ia)))))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 (defun ezimage-image-dump ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 "Dump out the current state of the Ezimage image alist.
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 See `ezimage-expand-image-button-alist' for details."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (interactive)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 (with-output-to-temp-buffer "*Ezimage Images*"
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (save-excursion
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 (set-buffer "*Ezimage Images*")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 (goto-char (point-max))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 (insert "Ezimage image cache.\n\n")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 (let ((start (point)) (end nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 (insert "Image\tImage Name")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 (setq end (point))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 (insert "\n")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 (put-text-property start end 'face 'underline))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (let ((ia (ezimage-all-images)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 (while ia
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 (let ((start (point)))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 (insert "cm")
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 (ezimage-insert-over-text (symbol-value (car ia)) start (point))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 (insert "\t" (format "%s" (car ia)) "\n"))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (setq ia (cdr ia)))))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (defun ezimage-all-images ()
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 "Return a list of all variables containing ez images."
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (let ((ans nil))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 (mapatoms (lambda (sym)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (if (get sym 'ezimage) (setq ans (cons sym ans))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (setq ans (sort ans (lambda (a b)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (string< (symbol-name a) (symbol-name b)))))
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 ans)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 )
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 (provide 'ezimage)
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370
65779
103ed0b7e567 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 65752
diff changeset
371 ;; arch-tag: d4ea2d93-3c7a-4cb3-b5a6-c1b9178183aa
65752
12e5c2513853 * speedbar.el: New version 1.0pre3.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 ;;; sb-image.el ends here