aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--thogai.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/thogai.el b/thogai.el
index 1803405..d9511ad 100644
--- a/thogai.el
+++ b/thogai.el
@@ -388,11 +388,16 @@ current state, and should typically be `thogai-stroke-ring'."
;; this translation. If no strokes were matched, skip this step.
(unless (null matched-strokes)
(thogai-reverse-strokes (butlast matched-strokes)))
- ;; Insert literal stroke if it is not in the dictionary. Else,
- ;; insert the actual translation.
+ ;; Insert literal stroke if it is not in the dictionary.
(if (null matched-strokes)
(thogai-insert-translation (ring-ref stroke-ring 0))
- (thogai-insert-translation (thogai-lookup (string-join matched-strokes "/")))))))
+ ;; Else, insert or run the translation.
+ (let ((translation (thogai-lookup (string-join matched-strokes "/"))))
+ (cond
+ ((stringp translation)
+ (thogai-insert-translation translation))
+ ((commandp translation)
+ (call-interactively translation))))))))
(defun thogai-byte-to-bits (byte)
"Convert BYTE to a list of 8 bits.