From dbf9b7606dd665f3ee31e383bef02a4e981bf1ef Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 2 Jan 2019 01:30:06 -0500 Subject: [PATCH] Fix problem with crashing in Emacs interface. --- src/runtime/emacs.scm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/runtime/emacs.scm b/src/runtime/emacs.scm index 451a79073..614db701f 100644 --- a/src/runtime/emacs.scm +++ b/src/runtime/emacs.scm @@ -178,22 +178,21 @@ USA. (define (emacs/gc-start port) (output-port/flush-output port) - (cwb (output-port-channel port) gc-start-bytes)) + (cwb console-output-channel gc-start-bytes)) (define (emacs/gc-finish port) - (cwb (output-port-channel port) gc-end-bytes)) + (declare (ignore port)) + (cwb console-output-channel gc-end-bytes)) (define (transmit-signal port type) - (let ((channel (output-port-channel port)) - (buffer (string->utf8 (string #\esc type)))) + (let ((buffer (string->utf8 (string #\esc type)))) (output-port/flush-output port) (with-absolutely-no-interrupts (lambda () - (cwb channel buffer))))) + (cwb console-output-channel buffer))))) (define (transmit-signal-with-argument port type string) - (let ((channel (output-port-channel port)) - (buffer + (let ((buffer (let ((builder (bytevector-builder))) (builder (char->integer #\esc)) (builder (char->integer type)) @@ -203,7 +202,7 @@ USA. (output-port/flush-output port) (with-absolutely-no-interrupts (lambda () - (cwb channel buffer))))) + (cwb console-output-channel buffer))))) (define (cwb channel bytes) ;; This is a private copy of CHANNEL-WRITE-BLOCK that bypasses all @@ -226,6 +225,7 @@ USA. (define gc-start-bytes) (define gc-end-bytes) +(define console-output-channel) (define vanilla-console-port-type) (define emacs-console-port-type) @@ -236,6 +236,7 @@ USA. (set! gc-end-bytes (bytevector (char->integer #\esc) (char->integer #\e))) + (set! console-output-channel (output-port-channel the-console-port)) (set! vanilla-console-port-type (textual-port-type the-console-port)) (set! emacs-console-port-type (make-textual-port-type -- 2.25.1