aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-10-09 02:53:11 +0200
committerLars Ingebrigtsen2019-10-09 02:53:11 +0200
commit11d3e309b3a93e864886e8b4a8246b8f6cb7934a (patch)
treeb5fae4e3f40941b0e48dcc4113d5dbe9c225654e
parent97702f5292307c71c9c124604bf85b6c629f3bb6 (diff)
downloademacs-11d3e309b3a93e864886e8b4a8246b8f6cb7934a.tar.gz
emacs-11d3e309b3a93e864886e8b4a8246b8f6cb7934a.zip
Remove some XEmacs compat code from tree-widget.el
* lisp/tree-widget.el (tree-widget-themes-load-path) (tree-widget-use-image-p, tree-widget-create-image) (tree-widget-image-formats, tree-widget-image-properties) (tree-widget-lookup-image): Remove XEmacs compat code.
-rw-r--r--lisp/tree-widget.el80
1 files changed, 25 insertions, 55 deletions
diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el
index b28448654c1..e4f73d4e942 100644
--- a/lisp/tree-widget.el
+++ b/lisp/tree-widget.el
@@ -131,20 +131,15 @@
131 131
132(defvar tree-widget-themes-load-path 132(defvar tree-widget-themes-load-path
133 '(load-path 133 '(load-path
134 (let ((dir (if (fboundp 'locate-data-directory) 134 (let ((dir data-directory))
135 (locate-data-directory "tree-widget") ;; XEmacs 135 (and dir (list dir (expand-file-name "images" dir)))))
136 data-directory)))
137 (and dir (list dir (expand-file-name "images" dir))))
138 )
139 "List of locations in which to search for the themes sub-directory. 136 "List of locations in which to search for the themes sub-directory.
140Each element is an expression that will be recursively evaluated until 137Each element is an expression that will be recursively evaluated until
141it returns a single directory or a list of directories. 138it returns a single directory or a list of directories.
142The default is to search in the `load-path' first, then in the 139The default is to search in the `load-path' first, then in the
143\"images\" sub directory in the data directory, then in the data 140\"images\" sub directory in the data directory, then in the data
144directory. 141directory.
145The data directory is the value of the variable `data-directory' on 142The data directory is the value of the variable `data-directory'.")
146Emacs, and what `(locate-data-directory \"tree-widget\")' returns on
147XEmacs.")
148 143
149(defcustom tree-widget-themes-directory "tree-widget" 144(defcustom tree-widget-themes-directory "tree-widget"
150 "Name of the directory in which to look for an image theme. 145 "Name of the directory in which to look for an image theme.
@@ -215,49 +210,26 @@ See Info node `(elisp)Specified Space'."
215 210
216;;; Image support 211;;; Image support
217;; 212;;
218(eval-and-compile ;; Emacs/XEmacs compatibility stuff 213(defsubst tree-widget-use-image-p ()
219 (cond 214 "Return non-nil if image support is currently enabled."
220 ;; XEmacs 215 (and tree-widget-image-enable
221 ((featurep 'xemacs) 216 widget-image-enable
222 (defsubst tree-widget-use-image-p () 217 (display-images-p)))
223 "Return non-nil if image support is currently enabled." 218
224 (and tree-widget-image-enable 219(defsubst tree-widget-create-image (type file &optional props)
225 widget-glyph-enable 220 "Create an image of type TYPE from FILE, and return it.
226 (console-on-window-system-p)))
227 (defsubst tree-widget-create-image (type file &optional props)
228 "Create an image of type TYPE from FILE, and return it.
229Give the image the specified properties PROPS." 221Give the image the specified properties PROPS."
230 (apply 'make-glyph `([,type :file ,file ,@props]))) 222 (declare (obsolete create-image "27.1"))
231 (defsubst tree-widget-image-formats () 223 (apply 'create-image `(,file ,type nil ,@props)))
232 "Return the alist of image formats/file name extensions. 224
233See also the option `widget-image-file-name-suffixes'." 225(defsubst tree-widget-image-formats ()
234 (delq nil 226 "Return the alist of image formats/file name extensions.
235 (mapcar
236 #'(lambda (fmt)
237 (and (valid-image-instantiator-format-p (car fmt)) fmt))
238 widget-image-file-name-suffixes)))
239 )
240 ;; Emacs
241 (t
242 (defsubst tree-widget-use-image-p ()
243 "Return non-nil if image support is currently enabled."
244 (and tree-widget-image-enable
245 widget-image-enable
246 (display-images-p)))
247 (defsubst tree-widget-create-image (type file &optional props)
248 "Create an image of type TYPE from FILE, and return it.
249Give the image the specified properties PROPS."
250 (apply 'create-image `(,file ,type nil ,@props)))
251 (defsubst tree-widget-image-formats ()
252 "Return the alist of image formats/file name extensions.
253See also the option `widget-image-conversion'." 227See also the option `widget-image-conversion'."
254 (delq nil 228 (delq nil
255 (mapcar 229 (mapcar
256 #'(lambda (fmt) 230 #'(lambda (fmt)
257 (and (image-type-available-p (car fmt)) fmt)) 231 (and (image-type-available-p (car fmt)) fmt))
258 widget-image-conversion))) 232 widget-image-conversion)))
259 ))
260 )
261 233
262;; Buffer local cache of theme data. 234;; Buffer local cache of theme data.
263(defvar tree-widget--theme nil) 235(defvar tree-widget--theme nil)
@@ -391,9 +363,7 @@ XEmacs in the variables `tree-widget-image-properties-emacs', and
391 (cons :pointer 363 (cons :pointer
392 (cons (or (cdr (assoc name tree-widget--cursors)) 'hand) 364 (cons (or (cdr (assoc name tree-widget--cursors)) 'hand)
393 (tree-widget-set-image-properties 365 (tree-widget-set-image-properties
394 (if (featurep 'xemacs) 366 tree-widget-image-properties-emacs))))
395 tree-widget-image-properties-xemacs
396 tree-widget-image-properties-emacs)))))
397 367
398(defun tree-widget-lookup-image (name) 368(defun tree-widget-lookup-image (name)
399 "Look up in current theme for an image with NAME. 369 "Look up in current theme for an image with NAME.
@@ -411,9 +381,9 @@ found."
411 (and (file-readable-p file) 381 (and (file-readable-p file)
412 (file-regular-p file) 382 (file-regular-p file)
413 (throw 'found 383 (throw 'found
414 (tree-widget-create-image 384 (apply #'create-image
415 (car fmt) file 385 (car fmt) file nil
416 (tree-widget-image-properties name)))))))) 386 (tree-widget-image-properties name))))))))
417 nil))) 387 nil)))
418 388
419(defun tree-widget-find-image (name) 389(defun tree-widget-find-image (name)