guile-clipboard-speaker

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit d32ecd2f4b8baa22c634a20f640bfe6e36e8dfc1
parent cdc637caf729cc91d39ff9228e97357e9190f65d
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Sat,  6 Jan 2024 06:09:26 +0200

Put clipboard-output into its own limited let expression.

Diffstat:
Mclipboard-speaker.scm | 28+++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/clipboard-speaker.scm b/clipboard-speaker.scm @@ -272,12 +272,11 @@ (loop (get-line fifo-read-port))))) (define (make-pipes buffering-type) - (define pipes (pipe)) + (let ((pipes (pipe))) + (setvbuf (car pipes) buffering-type) + (setvbuf (cdr pipes) buffering-type) - (setvbuf (car pipes) buffering-type) - (setvbuf (cdr pipes) buffering-type) - - pipes) + pipes)) (define (kill-server options) (cond @@ -299,7 +298,6 @@ (define (main args) (let ((options (config:getopt-config-auto args config))) - (when (config:option-ref options 'kill) (kill-server options)) @@ -307,17 +305,17 @@ ;; Make / open read and write fifo files. (let-values (((fifo-r fifo-w) (make-fifo-ports (config:option-ref options - 'fifo-file-path))) - ((clipboard-output) - (read-clipboard (config:option-ref options - 'clipboard-type)))) + 'fifo-file-path)))) + (let ((clipboard-output + (read-clipboard (config:option-ref options + 'clipboard-type)))) - (format #t "Client sends: ~A~%" clipboard-output) + (format #t "Client sends: ~A~%" clipboard-output) - ;; Write clipboard contents into the FIFO file for the TTS server to - ;; read. - (put-string fifo-w - clipboard-output) + ;; Write clipboard contents into the FIFO file for the TTS server to + ;; read. + (put-string fifo-w + clipboard-output)) ;; XXX: These ports are line buffered. Always write to ports with ;; a newline at their end if you want the other side to read them ;; now.