about summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2022-06-18 16:00:26 +0530
committerArun Isaac2022-06-18 16:00:26 +0530
commit2e83b7a960c32be52130642bc48ce110c768c94c (patch)
tree10050de0522bdc076e1d1410d84bd40a46080331
parent5edc8a43602296e30b61fbaaa09b1b27024b4190 (diff)
downloadthogai-2e83b7a960c32be52130642bc48ce110c768c94c.tar.gz
thogai-2e83b7a960c32be52130642bc48ce110c768c94c.tar.lz
thogai-2e83b7a960c32be52130642bc48ce110c768c94c.zip
Implement translations that simulate keypresses.
* thogai.el (thogai-insert-translation): Implement translations that
simulate keypresses.
-rw-r--r--thogai.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/thogai.el b/thogai.el
index daa9372..3039583 100644
--- a/thogai.el
+++ b/thogai.el
@@ -347,6 +347,23 @@ External callers should always pass nil as the value."
         (save-excursion
           (left-word)
           (delete-char -1)))
+       ;; Key
+       ((pred (lambda (translation)
+                (member (downcase translation)
+                        (list "{#left}" "{#right}" "{#up}" "{#down}"
+                              "{#backspace}" "{#delete}" "{#return}"
+                              "{#space}" "{#tab}"))))
+        (call-interactively
+         (key-binding
+          (kbd (pcase (downcase
+                       (string-remove-prefix
+                        "{#" (string-remove-suffix "}" translation)))
+                 ("backspace" "DEL")
+                 ("delete" "<deletechar>")
+                 ("return" "RET")
+                 ("space" "SPC")
+                 ("tab" "TAB")
+                 (key-name (concat "<" key-name ">")))))))
        ;; Simple literal translation
        (_
         (unless non-first-part-p