aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2020-01-17 06:55:30 +0100
committerStefan Kangas2020-01-17 06:55:45 +0100
commit6dbe2c932a55d34448d1a3cc8eeb7e851e0d6aab (patch)
treed0608827b3797b66c17aa9d8903938c5e7563e9f
parent278f1f9c0a2efb5164bf57f4a78c58652ce2928c (diff)
downloademacs-6dbe2c932a55d34448d1a3cc8eeb7e851e0d6aab.tar.gz
emacs-6dbe2c932a55d34448d1a3cc8eeb7e851e0d6aab.zip
Make sb-image.el obsolete (Bug#37837)
* lisp/sb-image.el: Move from here... * lisp/obsolete/sb-image.el: ...to here. * lisp/speedbar.el (ezimage): Require instead of 'sb-image'. (speedbar-use-images, speedbar-expand-image-button-alist) (speedbar-insert-image-button-maybe, speedbar-image-dump): Move here from 'sb-image.el'.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/obsolete/sb-image.el46
-rw-r--r--lisp/sb-image.el107
-rw-r--r--lisp/speedbar.el70
4 files changed, 119 insertions, 108 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 7ea4bba9cd1..f5740c8b3c3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -44,6 +44,10 @@ It was declared obsolete in Emacs 27.1.
44 44
45* Changes in Specialized Modes and Packages in Emacs 28.1 45* Changes in Specialized Modes and Packages in Emacs 28.1
46 46
47---
48** The sb-image.el library is now marked obsolete.
49This file was a compatibility kludge which is no longer needed.
50
47 51
48* New Modes and Packages in Emacs 28.1 52* New Modes and Packages in Emacs 28.1
49 53
diff --git a/lisp/obsolete/sb-image.el b/lisp/obsolete/sb-image.el
new file mode 100644
index 00000000000..fd8884738d4
--- /dev/null
+++ b/lisp/obsolete/sb-image.el
@@ -0,0 +1,46 @@
1;;; sb-image --- Image management for speedbar
2
3;; Copyright (C) 1999-2003, 2005-2019 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6;; Keywords: file, tags, tools
7;; Obsolete-since: 28.1
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;; This file is obsolete.
27;;
28;; Supporting Image display for Emacs 20 and less, Emacs 21, and XEmacs,
29;; is a challenging task, which doesn't take kindly to being byte compiled.
30;; When sharing speedbar.elc between these three applications, the Image
31;; support can get lost.
32;;
33;; By splitting out that hard part into this file, and avoiding byte
34;; compilation, one copy speedbar can support all these platforms together.
35;;
36;; This file requires the `image' package if it is available.
37
38(require 'ezimage)
39
40;;; Code:
41
42(defalias 'defimage-speedbar 'defezimage)
43
44(provide 'sb-image)
45
46;;; sb-image.el ends here
diff --git a/lisp/sb-image.el b/lisp/sb-image.el
deleted file mode 100644
index 1e8b1057bc8..00000000000
--- a/lisp/sb-image.el
+++ /dev/null
@@ -1,107 +0,0 @@
1;;; sb-image --- Image management for speedbar
2
3;; Copyright (C) 1999-2003, 2005-2020 Free Software Foundation, Inc.
4
5;; Author: Eric M. Ludlam <zappo@gnu.org>
6;; Keywords: file, tags, tools
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
22
23;;; Commentary:
24;;
25;; Supporting Image display for Emacs 20 and less, Emacs 21, and XEmacs,
26;; is a challenging task, which doesn't take kindly to being byte compiled.
27;; When sharing speedbar.elc between these three applications, the Image
28;; support can get lost.
29;;
30;; By splitting out that hard part into this file, and avoiding byte
31;; compilation, one copy speedbar can support all these platforms together.
32;;
33;; This file requires the `image' package if it is available.
34
35(require 'ezimage)
36
37;;; Code:
38(defcustom speedbar-use-images ezimage-use-images
39 "Non-nil if speedbar should display icons."
40 :group 'speedbar
41 :version "21.1"
42 :type 'boolean)
43
44(defalias 'defimage-speedbar 'defezimage)
45
46(defvar speedbar-expand-image-button-alist
47 '(("<+>" . ezimage-directory-plus)
48 ("<->" . ezimage-directory-minus)
49 ("< >" . ezimage-directory)
50 ("[+]" . ezimage-page-plus)
51 ("[-]" . ezimage-page-minus)
52 ("[?]" . ezimage-page)
53 ("[ ]" . ezimage-page)
54 ("{+}" . ezimage-box-plus)
55 ("{-}" . ezimage-box-minus)
56 ("<M>" . ezimage-mail)
57 ("<d>" . ezimage-document-tag)
58 ("<i>" . ezimage-info-tag)
59 (" =>" . ezimage-tag)
60 (" +>" . ezimage-tag-gt)
61 (" ->" . ezimage-tag-v)
62 (">" . ezimage-tag)
63 ("@" . ezimage-tag-type)
64 (" @" . ezimage-tag-type)
65 ("*" . ezimage-checkout)
66 ("#" . ezimage-object)
67 ("!" . ezimage-object-out-of-date)
68 ("//" . ezimage-label)
69 ("%" . ezimage-lock)
70 )
71 "List of text and image associations.")
72
73(defun speedbar-insert-image-button-maybe (start length)
74 "Insert an image button based on text starting at START for LENGTH chars.
75If buttontext is unknown, just insert that text.
76If we have an image associated with it, use that image."
77 (when speedbar-use-images
78 (let ((ezimage-expand-image-button-alist
79 speedbar-expand-image-button-alist))
80 (ezimage-insert-image-button-maybe start length))))
81
82(defun speedbar-image-dump ()
83 "Dump out the current state of the Speedbar image alist.
84See `speedbar-expand-image-button-alist' for details."
85 (interactive)
86 (with-output-to-temp-buffer "*Speedbar Images*"
87 (with-current-buffer "*Speedbar Images*"
88 (goto-char (point-max))
89 (insert "Speedbar image cache.\n\n")
90 (let ((start (point)) (end nil))
91 (insert "Image\tText\tImage Name")
92 (setq end (point))
93 (insert "\n")
94 (put-text-property start end 'face 'underline))
95 (let ((ia speedbar-expand-image-button-alist))
96 (while ia
97 (let ((start (point)))
98 (insert (car (car ia)))
99 (insert "\t")
100 (speedbar-insert-image-button-maybe start
101 (length (car (car ia))))
102 (insert (car (car ia)) "\t" (format "%s" (cdr (car ia))) "\n"))
103 (setq ia (cdr ia)))))))
104
105(provide 'sb-image)
106
107;;; sb-image.el ends here
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 4b5129f33c7..33575d6f17c 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -115,7 +115,7 @@ this version is not backward compatible to 0.14 or earlier.")
115 115
116(require 'easymenu) 116(require 'easymenu)
117(require 'dframe) 117(require 'dframe)
118(require 'sb-image) 118(require 'ezimage)
119 119
120;; customization stuff 120;; customization stuff
121(defgroup speedbar nil 121(defgroup speedbar nil
@@ -141,6 +141,12 @@ this version is not backward compatible to 0.14 or earlier.")
141 :prefix "speedbar-" 141 :prefix "speedbar-"
142 :group 'speedbar) 142 :group 'speedbar)
143 143
144(defcustom speedbar-use-images ezimage-use-images
145 "Non-nil if speedbar should display icons."
146 :group 'speedbar
147 :version "21.1"
148 :type 'boolean)
149
144;;; Code: 150;;; Code:
145 151
146;; Note: `inversion-test' requires parts of the CEDET package that are 152;; Note: `inversion-test' requires parts of the CEDET package that are
@@ -4022,6 +4028,68 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
4022 (setq font-lock-global-modes (delq 'speedbar-mode 4028 (setq font-lock-global-modes (delq 'speedbar-mode
4023 font-lock-global-modes))))) 4029 font-lock-global-modes)))))
4024 4030
4031;;; Image management
4032
4033(defvar speedbar-expand-image-button-alist
4034 '(("<+>" . ezimage-directory-plus)
4035 ("<->" . ezimage-directory-minus)
4036 ("< >" . ezimage-directory)
4037 ("[+]" . ezimage-page-plus)
4038 ("[-]" . ezimage-page-minus)
4039 ("[?]" . ezimage-page)
4040 ("[ ]" . ezimage-page)
4041 ("{+}" . ezimage-box-plus)
4042 ("{-}" . ezimage-box-minus)
4043 ("<M>" . ezimage-mail)
4044 ("<d>" . ezimage-document-tag)
4045 ("<i>" . ezimage-info-tag)
4046 (" =>" . ezimage-tag)
4047 (" +>" . ezimage-tag-gt)
4048 (" ->" . ezimage-tag-v)
4049 (">" . ezimage-tag)
4050 ("@" . ezimage-tag-type)
4051 (" @" . ezimage-tag-type)
4052 ("*" . ezimage-checkout)
4053 ("#" . ezimage-object)
4054 ("!" . ezimage-object-out-of-date)
4055 ("//" . ezimage-label)
4056 ("%" . ezimage-lock)
4057 )
4058 "List of text and image associations.")
4059
4060(defun speedbar-insert-image-button-maybe (start length)
4061 "Insert an image button based on text starting at START for LENGTH chars.
4062If buttontext is unknown, just insert that text.
4063If we have an image associated with it, use that image."
4064 (when speedbar-use-images
4065 (let ((ezimage-expand-image-button-alist
4066 speedbar-expand-image-button-alist))
4067 (ezimage-insert-image-button-maybe start length))))
4068
4069(defun speedbar-image-dump ()
4070 "Dump out the current state of the Speedbar image alist.
4071See `speedbar-expand-image-button-alist' for details."
4072 (interactive)
4073 (with-output-to-temp-buffer "*Speedbar Images*"
4074 (with-current-buffer "*Speedbar Images*"
4075 (goto-char (point-max))
4076 (insert "Speedbar image cache.\n\n")
4077 (let ((start (point)) (end nil))
4078 (insert "Image\tText\tImage Name")
4079 (setq end (point))
4080 (insert "\n")
4081 (put-text-property start end 'face 'underline))
4082 (let ((ia speedbar-expand-image-button-alist))
4083 (while ia
4084 (let ((start (point)))
4085 (insert (car (car ia)))
4086 (insert "\t")
4087 (speedbar-insert-image-button-maybe start
4088 (length (car (car ia))))
4089 (insert (car (car ia)) "\t" (format "%s" (cdr (car ia))) "\n"))
4090 (setq ia (cdr ia)))))))
4091
4092
4025(provide 'speedbar) 4093(provide 'speedbar)
4026 4094
4027;; run load-time hooks 4095;; run load-time hooks