From 2e83b7a960c32be52130642bc48ce110c768c94c Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 18 Jun 2022 16:00:26 +0530 Subject: Implement translations that simulate keypresses. * thogai.el (thogai-insert-translation): Implement translations that simulate keypresses. --- thogai.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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" "") + ("return" "RET") + ("space" "SPC") + ("tab" "TAB") + (key-name (concat "<" key-name ">"))))))) ;; Simple literal translation (_ (unless non-first-part-p -- cgit v1.2.3