(enriched-encode): Allow the 3rd argument ORIG-BUF for old Emacsen.
[elisp/apel.git] / EMU-ELS
1 ;;; EMU-ELS --- list of EMU modules to install. -*-Emacs-Lisp-*-
2
3 ;;; Commentary:
4
5 ;; APEL-MK imports `emu-modules' and `emu-modules-to-compile' from here.
6
7 ;;; Code:
8
9 (defvar emu-modules-not-to-compile nil)
10 (defvar emu-modules-to-compile nil)
11
12 ;; We use compile-time evaluation heavily.  So, order of compilation is
13 ;; very significant.  For example, loading some module before compiling
14 ;; it will cause "compile-time" evaluation many times.
15 (defvar emu-modules
16   (nconc
17    ;; modules are sorted by compilation order.
18    '(static broken)
19
20    ;; product information.
21    '(product apel-ver)
22
23    ;; poe modules; poe modules depend on static.
24    '(pym)
25    (cond
26     ;; XEmacs.
27     ((featurep 'xemacs)
28      '(poe-xemacs poe))
29     ;; Emacs 19.29 and earlier. (yes, includes Emacs 19.29.)
30     ((and (= emacs-major-version 19)
31           (<= emacs-minor-version 29))
32      '(localhook poe))
33     ;; Emacs 19.30 and later.
34     ((>= emacs-major-version 19)
35      '(poe))
36     (t
37      ;; v18.
38      '(localhook env poe-18 poe)))
39
40    ;; pcustom modules; pcustom modules depend on poe.
41    (if (and (module-installed-p 'custom)
42             ;; new custom requires widget.
43             (module-installed-p 'widget))
44        ;; if both 'custom and 'widget are found, we have new custom.
45        '(pcustom)
46      ;; pcustom does (require 'custom) at compile-time, and tinycustom
47      ;; need to test existence of some custom macros at compile-time!
48      ;; so, we must compile tinycustom first.
49      '(tinycustom pcustom))
50
51    ;; pccl modules; pccl modules depend on broken.
52    (cond
53     ((featurep 'mule)
54      (cond
55       ;; XEmacs 21 w/ mule.
56       ((and (featurep 'xemacs)
57             (>= emacs-major-version 21))
58        '(pccl-20 pccl))
59       ;; Emacs 20.
60       ((>= emacs-major-version 20)
61        '(pccl-20 pccl))
62       (t
63        ;; Mule 1.* and 2.*.
64        '(pccl-om pccl))))
65      (t
66       '(pccl)))
67
68    ;; pces modules; pces modules depend on poe.
69    (cond
70     ((featurep 'xemacs)
71      (cond
72       ((featurep 'mule)
73        ;; XEmacs w/ mule.
74        ;; pces-xfc depends pces-20, so we compile pces-20 first.
75        '(pces-20 pces-xm pces-xfc pces))
76       ((featurep 'file-coding)
77        ;; XEmacs w/ file-coding.
78        ;; pces-xfc depends pces-20, so we compile pces-20 first.
79        '(pces-20 pces-xfc pces))
80       (t
81        '(pces-raw pces))))
82     ((featurep 'mule)
83      (cond
84       ;; Emacs 20.3 and later.
85       ((and (fboundp 'set-buffer-multibyte)
86             (subrp (symbol-function 'set-buffer-multibyte)))
87        ;; pces-e20 depends pces-20, so we compile pces-20 first.
88        '(pces-20 pces-e20 pces))
89       ;; Emacs 20.1 and 20.2.
90       ((= emacs-major-version 20)
91        ;; pces-e20 depends pces-20, so we compile pces-20 first.
92        '(pces-20 pces-e20_2 pces-e20 pces))
93       (t
94        ;; Mule 1.* and 2.*.
95        '(pces-om pces))))
96     ((boundp 'NEMACS)
97      ;; Nemacs.
98      '(pces-nemacs pces))
99     (t
100      '(pces-raw pces)))
101
102    ;; poem modules; poem modules depend on pces.
103    (cond
104     ((featurep 'mule)
105      (cond
106       ((featurep 'xemacs)
107        ;; XEmacs w/ mule.
108        '(poem-xm poem))
109       ((>= emacs-major-version 20)
110        (if (and (fboundp 'set-buffer-multibyte)
111                 (subrp (symbol-function 'set-buffer-multibyte)))
112            ;; Emacs 20.3 and later.
113            '(poem-e20_3 poem-e20 poem)
114          ;; Emacs 20.1 and 20.2.
115          '(poem-e20_2 poem-e20 poem)))
116       (t
117        ;; Mule 1.* and 2.*.
118        '(poem-om poem))))
119     ((boundp 'NEMACS)
120      '(poem-nemacs poem))
121     (t
122      '(poem-ltn1 poem)))
123
124    ;; mcharset modules; mcharset modules depend on poem and pcustom.
125    (cond
126     ((featurep 'mule)
127      (cond
128       ((featurep 'xemacs)
129        ;; XEmacs w/ mule.
130        (if (featurep 'utf-2000)
131            ;; XEmacs w/ UTF-2000.
132            (setq emu-modules-not-to-compile
133                  (cons 'mcs-xmu emu-modules-not-to-compile)))
134        ;; mcs-xm depends mcs-20, so we compile mcs-20 first.
135        '(mcs-20 mcs-xmu mcs-xm mcharset))
136       ((>= emacs-major-version 20)
137        ;; Emacs 20 and later.
138        ;; mcs-e20 depends mcs-20, so we compile mcs-20 first.
139        '(mcs-20 mcs-e20 mcharset))
140       (t
141        ;; Mule 1.* and 2.*.
142        '(mcs-om mcharset))))
143     ((boundp 'NEMACS)
144      ;; Nemacs.
145      '(mcs-nemacs mcharset))
146     (t
147      '(mcs-ltn1 mcharset)))
148
149    ;; time-stamp.el; First appeared in Emacs 19.16.
150    (if (and (not (featurep 'xemacs))
151             (or (< emacs-major-version 19)
152                 (and (= emacs-major-version 19)
153                      (< emacs-minor-version 16))))
154        '(time-stamp)
155      ;; no problem.
156      '())
157
158    ;; timezone.el; Some versions have Y2K problem.
159    (condition-case nil
160        (let ((load-path (delete (expand-file-name ".")
161                                 (copy-sequence load-path))))
162          ;; v18 does not have timezone.el.
163          (require 'timezone)
164          ;; Is timezone.el APEL version?
165          (if (product-find 'timezone)
166              (error "timezone.el is APEL version. Install newer version."))
167          ;; Y2K test.
168          (or (string= (aref (timezone-parse-date "Sat, 1 Jan 00 00:00:00 GMT")
169                             0)
170                       "2000")
171              (error "timezone.el has Y2K problem. Install fixed version."))
172          ;; no problem.
173          '())
174      (error
175       '(timezone)))
176
177    ;; invisible modules; provided for backward compatibility with old "tm".
178    (cond
179     ((featurep 'xemacs)
180      ;; XEmacs.
181      '(inv-xemacs invisible))
182     ((>= emacs-major-version 19)
183      ;; Emacs 19 and later.
184      '(inv-19 invisible))
185     (t
186      ;; v18.
187      '(inv-18 invisible)))
188
189    ;; emu modules; provided for backward compatibility with old "tm".
190    (if (and (featurep 'mule)
191             (< emacs-major-version 20))
192        ;; Mule 1.* and 2.*.
193        '(emu-mule emu)
194      '(emu))
195
196    ;; emu submodules; text/richtext and text/enriched support.
197    (if (if (featurep 'xemacs)
198            (or (>= emacs-major-version 20)
199                (and (= emacs-major-version 19)
200                     (>= emacs-minor-version 14)))
201          (or (>= emacs-major-version 20)
202              (and (= emacs-major-version 19)
203                   (>= emacs-minor-version 29))))
204        ;; XEmacs 19.14 and later, or Emacs 19.29 and later.
205        '(richtext)
206      '(tinyrich))
207
208    ;; mule-caesar.el; part of apel-modules, but it is version-dependent.
209    '(mule-caesar)))
210
211 ;; Generate `emu-modules-to-compile' from `emu-modules-not-to-compile'
212 ;; and `emu-modules'.
213 (let ((modules emu-modules-not-to-compile))
214   (setq emu-modules-to-compile (copy-sequence emu-modules))
215   (while modules
216     (setq emu-modules-to-compile (delq (car modules) emu-modules-to-compile)
217           modules (cdr modules))))
218
219 ;;; EMU-ELS ends here