Emacs: Latin to Rune (แšฑแšขแšฟแ›‚) ๐Ÿš€

By Xah Lee. Date: . Last updated: .

Here's a command that convert Latin alphabet characters to Unicode Runic characters.

แšผแ›‚แšฑแ›‚'แ›Œ แ›† แ›แšฎแ›˜แ›˜แ›†แšฟแ›‘ แ›แšผแ›†แ› แ›แšฎแšฟแšกแ›‚แšฑแ› แ›šแ›†แ›แ›แšฟ แ›†แ›šแ›”แšผแ›†แ›’แ›‚แ› แ›แšผแ›†แšฑแ›†แ›แ›แ›‚แšฑแ›Œ แ›แšฎ แšขแšฟแ›แ›แšฎแ›‘แ›‚ แšฑแšขแšฟแ›แ› แ›แšผแ›†แšฑแ›†แ›แ›แ›‚แšฑแ›Œ.

put this in your Emacs Init File:

(defun xah-convert-latin-to-rune (Begin End ToLatinQ)
  "Replace english alphabet to runic characters.
For example, f โ†’ แš .
When called interactively, work on current line or text selection.

If `universal-argument' is called first, reverse direction.
Note: original letter case are not preserved. B may become b.

URL `http://xahlee.info/emacs/misc/elisp_latin_to_rune.html'
Version: 2019-06-07 2021-07-31 2023-05-12"
  (interactive
   (if (use-region-p)
       (list (region-beginning) (region-end) current-prefix-arg)
     (list (line-beginning-position) (line-end-position) current-prefix-arg)))
  (let (xtoLower xtoLatin xtoRune xuseMap)
    ;; this, because we no want to change case of other lang's chars
    (setq xtoLower [["A" "a"] ["B" "b"] ["C" "c"] ["D" "d"] ["E" "e"] ["F" "f"] ["G" "g"] ["H" "h"] ["I" "i"] ["J" "j"] ["K" "k"] ["L" "l"] ["M" "m"] ["N" "n"] ["O" "o"] ["P" "p"] ["Q" "q"] ["R" "r"] ["S" "s"] ["T" "t"] ["U" "u"] ["V" "v"] ["W" "w"] ["X" "x"] ["Y" "y"] ["Z" "z"] ]          )
    (setq xtoLatin [ ["แ›†" "a"] ["แ›’" "b"] ["แ›" "c"] ["แ›‘" "d"] ["แšง" "รฐ"] ["แ›‚" "e"] ["แš " "f"] ["แšต" "g"] ["แšผ" "h"] ["แ›" "i"] ["แšด" "k"] ["แ›š" "l"] ["แ›˜" "m"] ["แšฟ" "n"] ["แšฎ" "o"] ["แ›”" "p"] ["แ›•" "p"] ["แ›ฉ" "q"] ["แšฑ" "r"] ["แ›Œ" "s"] ["แ›‹" "s"] ["แ›" "t"] ["แšข" "u"] ["แšก" "v"] ["แšข" "v"] ["แšฅ" "w"] ["แ›ช" "x"] ["แ›ฆ" "y"] ["แšค" "y"] ["แ›จ" "y"] ["แ›Ž" "z"] ["แšฆ" "รพ"] ["แ›…" "รฆ"] ["แ›†" "รค"] ["แšฏ" "รธ"] ["แšฏ" "รถ"] ])
    (setq xtoRune (mapcar (lambda (xx) (vector (aref xx 1) (aref xx 0))) xtoLatin))
    (setq xuseMap (if ToLatinQ xtoLatin xtoRune))
    (save-excursion
      (save-restriction
        (narrow-to-region Begin End)
        (when (not ToLatinQ)
          ;; change to lower case, but only for English letters, not for example greek etc.
          (mapc
           (lambda (xx)
             (goto-char (point-min))
             (while (search-forward (elt xx 0) nil t)
               (replace-match (elt xx 1) t t)))
           xtoLower))
        (let ((case-fold-search nil))
          (mapc
           (lambda (xx)
             (goto-char (point-min))
             (while (search-forward (elt xx 0) nil t)
               (replace-match (elt xx 1) t t)))
           xuseMap))))))

For JavaScript version, see Unicode: Rune แš 

Xah Talk Show 2019-03-07 Emacs Lisp, Write a Command to Convert English to Rune

Emacs, Convert English to Other