;;; Only for 21.5 and newer.
-(unless (and (fboundp 'encode-char)
- (eq #x31C (with-fboundp '(encode-char decode-char)
- (encode-char (decode-char 'ucs #x31C) 'ucs))))
- (error "Unicode support needed for this file not available!"))
+(eval-when-compile (require 'ccl))
- (and (> emacs-major-version 20)
- (> emacs-minor-version 4)
+;; Check at runtime that the Unicode support is available, and that its
+;; coverage is good enough.
+(unless (if-fboundp 'encode-char
+ (with-fboundp '(encode-char decode-char)
+ (eq #x31C (encode-char (decode-char 'ucs #x31C) 'ucs))))
+ (error 'text-conversion-error
+ "Unicode support needed is not available in your XEmacs."))
- ;; If we're being compiled by 21.5, use the actual define-ccl-program
- ;; macro, but evaluated at runtime.
- ;; (eval-when-compile (and (featurep 'mule) (macroexpand
- ;; '(define-ccl-program ...))
- ;; in order to have the macro evaluated at compile time, results
- ;; in the statement being empty in the compiled file, which as I
- ;; understand it is a bug.
- '(define-ccl-program fsf-compat-ccl-encode-to-ucs-2
- (mule-to-unicode r0 r1)
- "CCL program to transform Mule characters to UCS-2."))
- ;; Pre-expand the macro for 21.4. 21.4 will error on loading this file, but
- ;; it may compile it. define-ccl-program should not be a macro, but that's
- (let ((prog [1 10 131127 8 98872 65823 147513 8 82009 255 22]))
- (defconst fsf-compat-ccl-encode-to-ucs-2 prog
- "CCL program to transform Mule characters to UCS-2.")
- (put (quote fsf-compat-ccl-encode-to-ucs-2)
- (quote ccl-program-idx)
- (register-ccl-program (quote fsf-compat-ccl-encode-to-ucs-2) prog))
+;; For redisplay of these character sets, provide a CCL program to address
+;; iso10646-1 X11 fonts.
+ (let ((pre-existing [1 10 131127 7 98872 65823 147513 7 82009 127 22]))
+ (when (and (> emacs-major-version 20) (> emacs-minor-version 4)
+ ;; In the event that we're compiling on 21.5, check that the
+ ;; pre-existing constant reflects the intended CCL
+ ;; program. Otherwise, just go ahead and use it.
+ (assert (equal pre-existing
+ (mule-to-unicode r0 r1)
+ "The pre-compiled CCL program appears broken. "))
+ "CCL program required by `fsf-compat-init-mule-unicode-charsets'.")
(defun fsf-compat-init-mule-unicode-charsets ()
"Make some Mule character sets that the FSF uses available in XEmacs.
"Unicode subset (U+%04X..U+%04X) for FSF compatibility."
- 'registries ["iso10646-1"]
- 'short-name (format "Unicode subset %c" final)
- 'long-name (format "Unicode subset (U+%04X..U+%04X)"
- 'ccl-program 'fsf-compat-ccl-encode-to-ucs-2))
+ registries ["iso10646-1"]
+ short-name ,(format "Unicode subset %c" final)
+ long-name ,(format "Unicode subset (U+%04X..U+%04X)"
+ ccl-program ,fsf-compat-ccl-program))
;; The names of the character sets lie, at least as of GNU Emacs
;; 184.108.40.206. The difference appears to be that they keep assigning
;; code points until the end of the 96x96 space of the character sets.