diff options
| author | Lars Ingebrigtsen | 2019-10-04 15:23:54 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-10-04 15:29:47 +0200 |
| commit | b0ef37758ea4b15816e9adb36120862f1eb551d9 (patch) | |
| tree | f56176bfac50b8b851587734be09e4b94f67ca73 | |
| parent | 094e48e4e7d71ca2d26ab047494afaa703ca85eb (diff) | |
| download | emacs-b0ef37758ea4b15816e9adb36120862f1eb551d9.tar.gz emacs-b0ef37758ea4b15816e9adb36120862f1eb551d9.zip | |
Remove some XEmacs compat code from ezimage.el
* lisp/ezimage.el (defezimage): Remove XEmacs compat code.
| -rw-r--r-- | lisp/ezimage.el | 78 |
1 files changed, 5 insertions, 73 deletions
diff --git a/lisp/ezimage.el b/lisp/ezimage.el index 2b06878f8e4..6c590f16ac8 100644 --- a/lisp/ezimage.el +++ b/lisp/ezimage.el | |||
| @@ -48,80 +48,12 @@ | |||
| 48 | :type 'boolean) | 48 | :type 'boolean) |
| 49 | 49 | ||
| 50 | ;;; Create our own version of defimage | 50 | ;;; Create our own version of defimage |
| 51 | (eval-and-compile | 51 | (defmacro defezimage (variable imagespec docstring) |
| 52 | 52 | "Define VARIABLE as an image if `defimage' is not available. | |
| 53 | (if (featurep 'emacs) | ||
| 54 | (progn | ||
| 55 | (defmacro defezimage (variable imagespec docstring) | ||
| 56 | "Define VARIABLE as an image if `defimage' is not available. | ||
| 57 | IMAGESPEC is the image data, and DOCSTRING is documentation for the image." | ||
| 58 | `(progn | ||
| 59 | (defimage ,variable ,imagespec ,docstring) | ||
| 60 | (put (quote ,variable) 'ezimage t))) | ||
| 61 | |||
| 62 | ;; This hack is for the ezimage install which has an icons directory for | ||
| 63 | ;; the default icons to be used. | ||
| 64 | ;; (add-to-list 'load-path | ||
| 65 | ;; (concat (file-name-directory | ||
| 66 | ;; (locate-library "ezimage.el")) | ||
| 67 | ;; "icons")) | ||
| 68 | |||
| 69 | ) | ||
| 70 | |||
| 71 | ;; XEmacs. | ||
| 72 | (if (not (fboundp 'make-glyph)) | ||
| 73 | |||
| 74 | (defmacro defezimage (variable _imagespec docstring) | ||
| 75 | "Don't bother loading up an image... | ||
| 76 | Argument VARIABLE is the variable to define. | ||
| 77 | Argument IMAGESPEC is the list defining the image to create. | ||
| 78 | Argument DOCSTRING is the documentation for VARIABLE." | ||
| 79 | `(defvar ,variable nil ,docstring)) | ||
| 80 | |||
| 81 | (defun ezimage-find-image-on-load-path (image) | ||
| 82 | "Find the image file IMAGE on the load path." | ||
| 83 | (let ((l (cons | ||
| 84 | ;; In XEmacs, try the data directory first (for an | ||
| 85 | ;; install in XEmacs proper.) Search the load | ||
| 86 | ;; path next (for user installs) | ||
| 87 | (locate-data-directory "ezimage") | ||
| 88 | load-path)) | ||
| 89 | (r nil)) | ||
| 90 | (while (and l (not r)) | ||
| 91 | (if (file-exists-p (concat (car l) "/" image)) | ||
| 92 | (setq r (concat (car l) "/" image)) | ||
| 93 | (if (file-exists-p (concat (car l) "/icons/" image)) | ||
| 94 | (setq r (concat (car l) "/icons/" image)) | ||
| 95 | )) | ||
| 96 | (setq l (cdr l))) | ||
| 97 | r)) | ||
| 98 | |||
| 99 | (defun ezimage-convert-emacs21-imagespec-to-xemacs (spec) | ||
| 100 | "Convert the Emacs21 image SPEC into an XEmacs image spec. | ||
| 101 | The Emacs 21 spec is what I first learned, and is easy to convert." | ||
| 102 | (let* ((sl (car spec)) | ||
| 103 | (itype (nth 1 sl)) | ||
| 104 | (ifile (nth 3 sl))) | ||
| 105 | (vector itype ':file (ezimage-find-image-on-load-path ifile)))) | ||
| 106 | |||
| 107 | (defmacro defezimage (variable imagespec docstring) | ||
| 108 | "Define VARIABLE as an image if `defimage' is not available. | ||
| 109 | IMAGESPEC is the image data, and DOCSTRING is documentation for the image." | 53 | IMAGESPEC is the image data, and DOCSTRING is documentation for the image." |
| 110 | `(progn | 54 | `(progn |
| 111 | (defvar ,variable | 55 | (defimage ,variable ,imagespec ,docstring) |
| 112 | ;; The Emacs21 version of defimage looks just like the XEmacs image | 56 | (put (quote ,variable) 'ezimage t))) |
| 113 | ;; specifier, except that it needs a :type keyword. If we line | ||
| 114 | ;; stuff up right, we can use this cheat to support XEmacs specifiers. | ||
| 115 | (condition-case nil | ||
| 116 | (make-glyph | ||
| 117 | (make-image-specifier | ||
| 118 | (ezimage-convert-emacs21-imagespec-to-xemacs (quote ,imagespec))) | ||
| 119 | 'buffer) | ||
| 120 | (error nil)) | ||
| 121 | ,docstring) | ||
| 122 | (put ',variable 'ezimage t))) | ||
| 123 | |||
| 124 | ))) | ||
| 125 | 57 | ||
| 126 | (defezimage ezimage-directory | 58 | (defezimage ezimage-directory |
| 127 | ((:type xpm :file "ezimage/dir.xpm" :ascent center)) | 59 | ((:type xpm :file "ezimage/dir.xpm" :ascent center)) |