diff options
author | Arun Isaac | 2022-06-17 23:28:21 +0530 |
---|---|---|
committer | Arun Isaac | 2022-06-17 23:28:21 +0530 |
commit | 817a42b6b913b162adf5cc37a8ca720bc09d6a07 (patch) | |
tree | 243383db8cd76de406e64f964546a6e400aae075 | |
parent | 4f456c36a4b56dec2e7053ba1d3d0475b70ed3ac (diff) | |
download | thogai-817a42b6b913b162adf5cc37a8ca720bc09d6a07.tar.gz thogai-817a42b6b913b162adf5cc37a8ca720bc09d6a07.tar.lz thogai-817a42b6b913b162adf5cc37a8ca720bc09d6a07.zip |
Support mapping strokes to commands.
* thogai.el (thogai-process-stroke): Support mapping strokes to
commands.
-rw-r--r-- | thogai.el | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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. |