From 26f029b6d50b663fce4ed235b7bdad5eaa1fe50c Mon Sep 17 00:00:00 2001 From: zongor Date: Fri, 24 Oct 2025 13:29:34 -0400 Subject: [PATCH] Update .emacs --- .emacs | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/.emacs b/.emacs index 17036af..7b59989 100755 --- a/.emacs +++ b/.emacs @@ -147,6 +147,71 @@ and position the cursor inside the comment. Additionally insert the word under t (global-set-key (kbd "C-M-z") 'doc-comment) +(defun ascii-to-futhark (start end) + "Convert ASCII text in region to Futhark runes. +If no region is active, convert the entire buffer." + (interactive + (if (use-region-p) + (list (region-beginning) (region-end)) + (list (point-min) (point-max)))) + + ;; Define the conversion table as an alist + ;; Order matters: longer sequences first to avoid partial matches + (let ((conversion-table + '(("ee" . "ᛟ") + ("oo" . "ᛳ") + ("ea" . "ᛠ") + ("eo" . "ᛇ") + ("ng" . "ᛝ") + ("st" . "ᛥ") + ("th" . "ᚦ") + ("sh" . "ᛲ") + ("q" . "ᚳᚹ") ; Handle 'q' as 'qw' + ("a" . "ᚫ") + ("b" . "ᛒ") + ("c" . "ᚳ") + ("d" . "ᛞ") + ("e" . "ᛖ") + ("f" . "ᚠ") + ("g" . "ᚷ") + ("h" . "ᚻ") + ("i" . "ᛁ") + ("j" . "ᛁ") + ("k" . "ᛱ") + ("l" . "ᛚ") + ("m" . "ᛗ") + ("n" . "ᚾ") + ("o" . "ᚩ") + ("p" . "ᛈ") + ("r" . "ᚱ") + ("s" . "ᛋ") + ("t" . "ᛏ") + ("u" . "ᚢ") + ("v" . "ᚢ") + ("w" . "ᚹ") + ("x" . "ᛉ") + ("y" . "ᚣ") + ("z" . "ᛣ") + ("." . "᛫") + ("," . "᛭") + ("!" . ":")))) + + (save-excursion + (save-restriction + (narrow-to-region start end) + ;; Convert to lowercase first + (downcase-region (point-min) (point-max)) + + ;; Perform replacements in order (longer sequences first) + (dolist (mapping conversion-table) + (let ((from (car mapping)) + (to (cdr mapping))) + (goto-char (point-min)) + (while (search-forward from nil t) + (replace-match to nil t)))))))) + +(global-set-key (kbd "C-c f") 'ascii-to-futhark) + (defun markdown-convert-buffer-to-org () "Convert the current buffer's content from markdown to orgmode format and save it with the current buffer's file name but with .org extension." (interactive)