PrettyGreek

This is BenignoUria generalization of PrettyLambda. It displays Greek letters in place of the names of Greek letters. Very nice if you use such names as parameters in parts of your code.

 (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 = 97 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)

If using Pretty Greek you don’t need PrettyLambda, but that doesn’t hurt either.

See also: PrettySymbol.


This did not work with my version of emacs (22.2.1). However, I edited and extended this to include the majuscule and miniscule forms of the letters, differentiated by a capital first letter of the corresponding english word (i.e. Lambda is majuscule and lambda is miniscule).

Attached: [1]


CategoryDisplay