Update .emacs

This commit is contained in:
zongor 2025-10-24 13:29:34 -04:00
parent b34d0b8e32
commit 26f029b6d5
1 changed files with 65 additions and 0 deletions

65
.emacs
View File

@ -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)