From 32179d7b9506bf223b7794c6944f409d0bab888a Mon Sep 17 00:00:00 2001 From: David Aspinall Date: Sun, 3 Feb 2008 14:21:41 +0000 Subject: Attempt at Emacs 23 compatibility, not quite working. --- x-symbol/lisp/x-symbol-emacs.el | 48 +++++++++++++++++++++++++---------------- x-symbol/lisp/x-symbol.el | 21 ++++++++++++------ 2 files changed, 43 insertions(+), 26 deletions(-) (limited to 'x-symbol') diff --git a/x-symbol/lisp/x-symbol-emacs.el b/x-symbol/lisp/x-symbol-emacs.el index 71307e56..02648e66 100644 --- a/x-symbol/lisp/x-symbol-emacs.el +++ b/x-symbol/lisp/x-symbol-emacs.el @@ -272,7 +272,10 @@ test." (aset char-coding-system-table (make-char name) t)) (when registry (set-fontset-font "fontset-default" name (cons "*" registry)) - (when (eq graphic 0) (set-font-encoding registry name 0)) +; da: set-font-encoding call breaks on Emacs 23 +; (when (eq graphic 0) (set-font-encoding registry name 0)) +; this patch not good enough: characters in xsymb font still lost + (when (eq graphic 0) (set-font-encoding registry name)) (when ccl-program (add-to-list 'font-ccl-encoder-alist (cons registry ccl-program)))) name))) @@ -417,25 +420,32 @@ are separated with SEPARATOR (\", \" by default)." (defalias 'x-symbol-window-width 'window-width) -;; da: emacs-u-22 version: problematic (get invalid codes later for is88859-3) -;; (defun x-symbol-set-face-font (face font charsets default) -;; (let ((fontset (replace-in-string (symbol-name face) "-" ""))) -;; (unless (query-fontset fontset) -;; (create-fontset-from-ascii-font font nil fontset)) -;; (dolist (charset charsets) -;; (when charset (set-fontset-font fontset charset font))) -;; (set-face-font face fontset))) - +(if + (>= emacs-major-version 23) + ;; da: emacs-23 version: maybe OK... (defun x-symbol-set-face-font (face font charsets default) - (let ((fontset (concat "fontset-" (symbol-name face)))) - (unless (query-fontset fontset) - ;; We assume that the first time around we're using latin-8859-1 - (new-fontset fontset - (x-complement-fontset-spec (make-vector 14 "*") - (list (cons 'ascii font))))) - (dolist (charset charsets) - (when charset (set-fontset-font fontset charset font))) - (set-face-font face fontset))) + (let* ((fontset-name (concat "fontset-" + (replace-in-string + (symbol-name face) "-" ""))) + (decomposed (x-decompose-font-name font)) + fontset) + (aset decomposed 11 fontset-name) + (setq fontset (new-fontset (x-compose-font-name decomposed) + (list (cons 'ascii font)))) + (dolist (charset charsets) + (when charset (set-fontset-font fontset charset font))) + (set-face-font face fontset))) +;; Otherwise, emacs-21/22 version + (defun x-symbol-set-face-font (face font charsets default) + (let ((fontset (concat "fontset-" (symbol-name face)))) + (unless (query-fontset fontset) + ;; We assume that the first time around we're using latin-8859-1 + (new-fontset fontset + (x-complement-fontset-spec (make-vector 14 "*") + (list (cons 'ascii font))))) + (dolist (charset charsets) + (when charset (set-fontset-font fontset charset font))) + (set-face-font face fontset)))) (defun x-symbol-event-matches-key-specifier-p (event specifier) (if (consp specifier) (setq specifier (event-convert-list specifier))) diff --git a/x-symbol/lisp/x-symbol.el b/x-symbol/lisp/x-symbol.el index f7618178..079e771a 100644 --- a/x-symbol/lisp/x-symbol.el +++ b/x-symbol/lisp/x-symbol.el @@ -4231,7 +4231,8 @@ uses it with TOKEN and CHARSYM." (breve 162 . t) (sterling 163 . t) (currency 164 . t) - (unused-l3/165 165 . unused) +;; da: error in Emacs 23 anyway +;; (unused-l3/165 165 . unused) (Hcircumflex 166 (circumflex "H" hcircumflex)) (section 167 . t) (diaeresis 168 . t) @@ -4240,7 +4241,8 @@ uses it with TOKEN and CHARSYM." (Gbreve 171 (breve "G" gbreve)) (Jcircumflex 172 (circumflex "J" jcircumflex)) (hyphen 173 . t) - (unused-l3/174 174 . unused) +;; da: error in Emacs 23 anyway +;; (unused-l3/174 174 . unused) (Zdotaccent 175 . t) (degree 176 . t) (hbar 177 (slash "h" Hbar)) @@ -4256,12 +4258,14 @@ uses it with TOKEN and CHARSYM." (gbreve 187 (breve "g" Gbreve)) (jcircumflex 188 (circumflex "j" Jcircumflex)) (onehalf 189 . t) - (unused-l3/190 190 . unused) +;; da: error in Emacs 23 anyway +;; (unused-l3/190 190 . unused) (zdotaccent 191 . t) (Agrave 192 . t) (Aacute 193 . t) (Acircumflex 194 . t) - (unused-l3/195 195 . unused) +;; da: error in Emacs 23 anyway +;; (unused-l3/195 195 . unused) (Adiaeresis 196 . t) (Cdotaccent 197 (dotaccent "C" cdotaccent)) (Ccircumflex 198 (circumflex "C" ccircumflex)) @@ -4274,7 +4278,8 @@ uses it with TOKEN and CHARSYM." (Iacute 205 . t) (Icircumflex 206 . t) (Idiaeresis 207 . t) - (unused-l3/208 208 . unused) +;; da: error in Emacs 23 anyway +;; (unused-l3/208 208 . unused) (Ntilde 209 . t) (Ograve 210 . t) (Oacute 211 . t) @@ -4293,7 +4298,8 @@ uses it with TOKEN and CHARSYM." (agrave 224 . t) (aacute 225 . t) (acircumflex 226 . t) - (unused-l3/227 227 . unused) +;; da: error in Emacs 23 anyway +;; (unused-l3/227 227 . unused) (adiaeresis 228 . t) (cdotaccent 229 (dotaccent "c" Cdotaccent)) (ccircumflex 230 (circumflex "c" Ccircumflex)) @@ -4306,7 +4312,8 @@ uses it with TOKEN and CHARSYM." (iacute 237 . t) (icircumflex 238 . t) (idiaeresis 239 . t) - (unused-l3/240 240 . unused) +;; da: error in Emacs 23 anyway +;; (unused-l3/240 240 . unused) (ntilde 241 . t) (ograve 242 . t) (oacute 243 . t) -- cgit v1.2.3