tags:

views:

172

answers:

1

I am trying to get http://www.emacswiki.org/emacs/PrettyGreek working for emacs 21.3.1 on Windows. I have put the following in my .emacs after downloading the European intlfonts from http://ftp.gnu.org/gnu/intlfonts/:

; ======= Pretty Greek Characters =======

(setq bdf-directory-list '("D:/emacs/intlfonts/European"))

(setq w32-bdf-filename-alist (w32-find-bdf-fonts bdf-directory-list))

(create-fontset-from-fontset-spec 
 "-*-fixed-medium-r-normal-*-16-*-*-*-c-*-fontset-bdf,
greek-iso8859-7:-*-*-medium-r-normal-*-16-*-*-*-c-*-iso8859-7" t)

(defun pretty-greek ()
  (let ((greek '("alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta" "theta" "iota" "kappa" "lambda" "mu" "nu" "xi" "omicron" "pi" "rho" "sigma_final" "sigma" "tau" "upsilon" "phi" "chi" "psi" "omega")))
    (loop for word in greek
          for code = 225 then (+ 1 code)
          do  (let ((greek-char (make-char 'greek-iso8859-7 code))) 
                (font-lock-add-keywords nil
                                        `((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[a-zA-Z]")
                                           (0 (progn (decompose-region (match-beginning 2) (match-end 2))
                                                     nil)))))
                (font-lock-add-keywords nil 
                                        `((,(concatenate 'string "\\(^\\|[^a-zA-Z0-9]\\)\\(" word "\\)[^a-zA-Z]")
                                           (0 (progn (compose-region (match-beginning 2) (match-end 2)
                                                                     ,greek-char)
                                                     nil)))))))))

(add-hook 'lisp-mode-hook 'pretty-greek)
(add-hook 'emacs-lisp-mode-hook 'pretty-greek)
(add-hook 'python-mode-hook 'pretty-greek)
(add-hook 'csharp-mode-hook 'pretty-greek)

However, when I try alpha beta gamma, I get the plus/minus character, superscript 2 and superscript 3. Does anyone know how to fix this?

A: 

I upgraded from Emacs 21 to Emacs 23, and now the code is working fine. The transition was actually not too painful, and I would have needed to make the transition sometime anyway.

Nikwin