Emacs: Replace Greek Letter Names to Unicode 📜
put this in your Emacs Init File:
(defun xah-replace-greek-letter-name-to-symbol (&optional Begin End) "Replace alpha to α, beta to β etc in current block or selection. URL `http://xahlee.info/emacs/emacs/elisp_replace_greeks_to_symbols.html' Created: 2016-10-05 Version: 2025-08-18" (interactive) (let ((xfp-map (list ["Alpha" "Α"] ["Beta" "Β"] ["Gamma" "Γ"] ["Delta" "Δ"] ["Epsilon" "Ε"] ["Zeta" "Ζ"] ["Eta" "Η"] ["Theta" "Θ"] ["Iota" "Ι"] ["Kappa" "Κ"] ["Lambda" "Λ"] ["Mu" "Μ"] ["Nu" "Ν"] ["Xi" "Ξ"] ["Omicron" "Ο"] ["Pi" "Π"] ["Rho" "Ρ"] ["Sigma" "Σ"] ["Tau" "Τ"] ["Upsilon" "Υ"] ["Phi" "Φ"] ["Chi" "Χ"] ["Psi" "Ψ"] ["Omega" "Ω"] ["alpha" "α"] ["beta" "β"] ["gamma" "γ"] ["delta" "δ"] ["epsilon" "ε"] ["zeta" "ζ"] ["eta" "η"] ["theta" "θ"] ["iota" "ι"] ["kappa" "κ"] ["lambda" "λ"] ["mu" "μ"] ["nu" "ν"] ["xi" "ξ"] ["omicron" "ο"] ["pi" "π"] ["rho" "ρ"] ["sigmaf" "ς"] ["sigma" "σ"] ["tau" "τ"] ["upsilon" "υ"] ["phi" "φ"] ["chi" "χ"] ["psi" "ψ"] ["omega" "ω"] ["thetasym" "ϑ"] ["upsih" "ϒ"] ["piv" "ϖ"])) xbeg xend xfind-list xfind-regexp (xfp-hashtable (make-hash-table :test 'equal)) (case-fold-search nil)) (seq-setq (xbeg xend) (if (and Begin End) (list Begin End) (if (region-active-p) (list (region-beginning) (region-end)) (list (save-excursion (if (re-search-backward "\n[ \t]*\n" nil 1) (match-end 0) (point))) (save-excursion (if (re-search-forward "\n[ \t]*\n" nil 1) (match-beginning 0) (point))))))) (setq xfind-list (mapcar (lambda (x) (aref x 0)) xfp-map)) (mapc (lambda (x) (puthash (aref x 0) (aref x 1) xfp-hashtable)) xfp-map) (setq xfind-regexp (regexp-opt xfind-list 'words)) (goto-char xbeg) (while (re-search-forward xfind-regexp xend :NOERROR) (replace-match (gethash (match-string 0) xfp-hashtable) :FIXEDCASE :LITERAL) (overlay-put (make-overlay (match-beginning 0) (match-end 0)) 'face 'hi-yellow))))