diff options
author | Arun Isaac | 2022-06-19 15:48:15 +0530 |
---|---|---|
committer | Arun Isaac | 2022-06-19 15:50:55 +0530 |
commit | b6a015a0a211208a20e4ec784165cecdd2ee0ed0 (patch) | |
tree | b10186bc627bc975392215fb549c22fe4df69216 | |
parent | 1d3800a7cd2be55d5bf2ac0ba6ef8502161da97b (diff) | |
download | thogai-b6a015a0a211208a20e4ec784165cecdd2ee0ed0.tar.gz thogai-b6a015a0a211208a20e4ec784165cecdd2ee0ed0.tar.lz thogai-b6a015a0a211208a20e4ec784165cecdd2ee0ed0.zip |
Protect gemini protocol filter from interruption.
* thogai.el (thogai-gemini-decode-stroke): Protect gemini protocol
filter from interruption.
-rw-r--r-- | thogai.el | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -566,15 +566,18 @@ BYTES is a list of 6 bytes in the Gemini protocol." ;; The Gemini protocol represents each stroke by 6 ;; bytes. Decode stroke once 6 bytes are received. (when (= (length bytes) bytes-per-stroke) - (let ((stroke (thogai-gemini-decode-stroke (reverse bytes)))) - ;; Log to paper tape. - (with-current-buffer (process-buffer process) - (insert stroke) - (insert "\n")) - ;; Insert into stroke ring, and process translation. - (ring-insert thogai-stroke-ring stroke) - (thogai-process-stroke thogai-stroke-ring)) - (setq bytes nil)))))) + ;; Stroke processing could result in errors, typically from + ;; user commands bound to strokes. Hence, unwind-protect. + (unwind-protect + (let ((stroke (thogai-gemini-decode-stroke (reverse bytes)))) + ;; Log to paper tape. + (with-current-buffer (process-buffer process) + (insert stroke) + (insert "\n")) + ;; Insert into stroke ring, and process translation. + (ring-insert thogai-stroke-ring stroke) + (thogai-process-stroke thogai-stroke-ring)) + (setq bytes nil))))))) (defun thogai-gemini-connect (port speed) "Connect to steno machine via the Gemini protocol. |