Don't signal an error if a file has a "find-file initialization" that
authorChris Hanson <org/chris-hanson/cph>
Fri, 6 Jan 1995 01:06:09 +0000 (01:06 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 6 Jan 1995 01:06:09 +0000 (01:06 +0000)
specifies an non-existent environment or syntax table.  Instead, just
print a warning message and set the environment to the default.

v7/src/edwin/evlcom.scm
v7/src/edwin/filcom.scm

index 9073ff77479e3059b89a284368e56f7d340f4a3e..ad06c1f4a006ab40d48c5e3ccf17a03b39895a49 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: evlcom.scm,v 1.50 1994/09/16 20:19:23 cph Exp $
+;;;    $Id: evlcom.scm,v 1.51 1995/01/06 01:05:56 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-94 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-95 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
 If 'DEFAULT, use the default (REP loop) environment."
   'DEFAULT
   #f
-  (lambda (object) (if (eq? 'DEFAULT object) object (->environment object))))
+  (lambda (object)
+    (if (eq? 'DEFAULT object)
+       object
+       (call-with-current-continuation
+        (lambda (k)
+          (bind-condition-handler (list condition-type:error)
+              (lambda (condition)
+                condition
+                (k 'DEFAULT))
+            (lambda ()
+              (->environment object))))))))
 
 (define-variable scheme-syntax-table
   "The syntax table used by the evaluation commands, or #F.
@@ -97,7 +107,7 @@ If #F, use the default (REP loop) syntax-table."
 This does not affect editor errors."
   #t
   boolean?)
-
+\f
 (define-variable evaluation-input-recorder
   "A procedure that receives each input region before evaluation.
 If #F, disables input recording."
@@ -126,7 +136,7 @@ Also, the inferior REPL's run light appears in all Scheme mode buffers.
 Otherwise, expressions are evaluated directly by the commands."
   #t
   boolean?)
-\f
+
 (define-variable transcript-buffer-name
   "Name of evaluation transcript buffer.
 This can also be a buffer object."
@@ -401,12 +411,13 @@ may be available.  The following commands are special to this mode:
           (nearest-repl/syntax-table))
          ((scheme-syntax-table? syntax-table)
           syntax-table)
-         ((and (symbol? syntax-table)
-               (not (lexical-unreferenceable? environment syntax-table))
-               (let ((syntax-table
-                      (lexical-reference environment syntax-table)))
-                 (and (scheme-syntax-table? syntax-table)
-                      syntax-table))))
+         ((symbol? syntax-table)
+          (or (and (not (lexical-unreferenceable? environment syntax-table))
+                   (let ((syntax-table
+                          (lexical-reference environment syntax-table)))
+                     (and (scheme-syntax-table? syntax-table)
+                          syntax-table)))
+              (nearest-repl/syntax-table)))
          (else
           (editor-error "Illegal syntax table: " syntax-table)))))
 
index 1d6a4aae9765548eecd7f9c3783b70360c82a9dd..d9c0d76d7473951a40984a23ec0a7535fb69cd24 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: filcom.scm,v 1.180 1994/12/19 19:40:32 cph Exp $
+;;;    $Id: filcom.scm,v 1.181 1995/01/06 01:06:09 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-94 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-95 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -232,9 +232,18 @@ invocation."
            (define-variable-local-value! buffer
                (ref-variable-object scheme-environment)
              (cadr entry))
-           (define-variable-local-value! buffer
-               (ref-variable-object scheme-syntax-table)
-             (caddr entry)))))))
+           (if (and (eq? 'DEFAULT (ref-variable scheme-environment buffer))
+                    (not (eq? 'default (cadr entry))))
+               (begin
+                 (message "Ignoring bad evaluation environment: "
+                          (cadr entry))
+                 (editor-beep)
+                 (define-variable-local-value! buffer
+                     (ref-variable-object scheme-syntax-table)
+                   'DEFAULT))
+               (define-variable-local-value! buffer
+                   (ref-variable-object scheme-syntax-table)
+                 (caddr entry))))))))
 \f
 (define (find-file-revert buffer)
   (if (not (verify-visited-file-modification-time? buffer))