Detect errors that are generated by the X primitives when the
authorChris Hanson <org/chris-hanson/cph>
Tue, 18 Aug 1992 03:27:22 +0000 (03:27 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 18 Aug 1992 03:27:22 +0000 (03:27 +0000)
connection to the X server is broken, and kill the editor when that
occurs.

v7/src/edwin/editor.scm

index 1c01dd1852edb15cce36683e5cc9aef0abfd736e..fc66607d1778c6554c253754207f8ae1015a2047 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/editor.scm,v 1.221 1992/04/22 21:03:05 mhwu Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/editor.scm,v 1.222 1992/08/18 03:27:22 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-92 Massachusetts Institute of Technology
 ;;;
@@ -260,7 +260,16 @@ with the contents of the startup message."
 (add-gc-daemon! editor-gc-daemon)
 \f
 (define (internal-error-handler condition)
-  (cond (debug-internal-errors?
+  (cond ((and (eq? condition-type:primitive-procedure-error
+                  (condition/type condition))
+             (let ((operator (access-condition condition 'OPERATOR)))
+               (or (eq? operator (ucode-primitive x-display-process-events 2))
+                   (eq? operator (ucode-primitive x-display-flush 1)))))
+        ;; This error indicates that the connection to the X server
+        ;; has been broken.  The safest thing to do is to kill the
+        ;; editor.
+        (exit-editor))
+       (debug-internal-errors?
         (error condition))
        ((ref-variable debug-on-internal-error)
         (debug-scheme-error condition "internal"))
@@ -311,7 +320,7 @@ This does not affect editor errors or evaluation errors."
 (define (%editor-error)
   (editor-beep)
   (abort-current-command))
-
+\f
 (define (quit-editor-and-signal-error condition)
   (quit-editor-and (lambda () (error condition))))
 
@@ -334,7 +343,7 @@ This does not affect editor errors or evaluation errors."
 
 (define (exit-scheme)
   (within-continuation editor-abort %exit))
-\f
+
 (define (^G-signal)
   (let ((handler *^G-interrupt-handler*))
     (if handler