-
Notifications
You must be signed in to change notification settings - Fork 0
/
emacs-keys.el
48 lines (47 loc) · 2.57 KB
/
emacs-keys.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(when nil
(dolist (multi '(("`" (("a" "à") ("e" "è") ("i" "ì") ("o" "ò") ("u" "ù")
("A" "À") ("E" "È") ("I" "Ì") ("O" "Ò") ("U" "Ù")))
("'" (("a" "á") ("e" "é") ("i" "í") ("o" "ó") ("u" "ú") ("y" "ý")
("A" "Á") ("E" "É") ("I" "Í") ("O" "Ó") ("U" "Ú") ("Y" "Ý")))
("^" (("a" "â") ("e" "ê") ("i" "î") ("o" "ô") ("u" "û")
("A" "Â") ("E" "Ê") ("I" "Î") ("O" "Ô") ("U" "Û")))
("~" (("A" "Ã") ("N" "Ñ") ("O" "Õ")
("a" "ã") ("n" "ñ") ("o" "õ")))
("\"" (("a" "ä") ("e" "ë") ("i" "ï") ("o" "ö") ("u" "ü") ("y" "ÿ")
("A" "Ä") ("E" "Ë") ("I" "Ï") ("O" "Ö") ("U" "Ü")))
("s" (("s" "ß")))
("t" (("h" "þ") ("H" "þ")))
("T" (("h" "Þ") ("H" "Þ")))
("d" (("h" "ð") ("H" "ð")))
("D" (("h" "Ð") ("H" "Ð")))
("A" (("E" "Æ") ("e" "Æ") ("o" "Å")("O" "Å")))
("a" (("E" "æ") ("e" "æ") ("o" "å")("O" "å")))
("/" ((":" "÷") ("o" "ø") ("O" "Ø")))
("," (("C" "Ç") ("c" "ç")))))
(let* ((first (first multi))
(name (intern (format "hyper-%s-map"
(cond
((string= "`" first) "grave")
((string= "'" first) "acute")
((string= "^" first) "circumflex")
((string= "~" first) "tilde")
((string= "\"" first) "umlaut")
((string= "/" first) "slash")
((string= "," first) "comma")
(t first)))))
(table (define-prefix-command name)))
(message "%S" `(global-set-key (kbd ,(format "H-%s" first)) ,name))
(global-set-key (kbd (format "H-%s" first)) name)
(dolist (entry (second multi))
(let ((second (first entry))
(result (second entry)))
(message "%S" `(define-key ,name (kbd ,(format "%s" first second))
(lambda (n)
(interactive "p")
(dotimes (i n)
(insert ,result)))))
(define-key name (kbd (format "%s" first second))
(lambda (n)
(interactive "p")
(dotimes (i n)
(insert result)))))))))