Conditionalize calls to text-property operations on an open-coded test
authorChris Hanson <org/chris-hanson/cph>
Tue, 10 Aug 1993 23:36:03 +0000 (23:36 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 10 Aug 1993 23:36:03 +0000 (23:36 +0000)
for the existence of properties in the group being modified.

v7/src/edwin/grpops.scm

index 17d824e2a69a5d3916ef72fb2bf8f5cf66ffaa1c..c166ac241eddfa120e435fec0b168be0772e8d15 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: grpops.scm,v 1.19 1993/08/09 19:19:27 jawilson Exp $
+;;;    $Id: grpops.scm,v 1.20 1993/08/10 23:36:03 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
 
 ;;;; Group Operations
 
-(declare (usual-integrations string-allocate))
-\f
 ;;; These high-performance ops deal directly with groups and indices
 ;;; for speed and the least consing.  Since indices are not in general
 ;;; valid across modifications to the group, they can only be used in
 ;;; limited ways.  To save an index across a modification, it must be
 ;;; consed into a permanent mark.
 
+(declare (usual-integrations string-allocate))
+\f
 ;;;; Extractions
 
 (define (group-extract-string group start end)
 
 (define (prepare-gap-for-insert! group new-start n)
   (if (or (group-read-only? group)
-         (text-not-insertable? group new-start))
+         (and (group-text-properties group)
+              (text-not-insertable? group new-start)))
       (barf-if-read-only))
-  (if (not (group-modified? group))
-      (check-first-group-modification group))
+  (if (not (group-modified? group)) (check-first-group-modification group))
   (cond ((fix:< (group-gap-length group) n)
         (grow-group! group new-start n))
        ((fix:< new-start (group-gap-start group))
                         (fix:+ (mark-index (system-pair-car marks)) n))))
   (vector-set! group group-index:modified-tick
               (fix:+ (group-modified-tick group) 1))
-  ;; The MODIFIED? bit must be set *after* the undo recording.
   (undo-record-insertion! group index (fix:+ index n))
+  ;; The MODIFIED? bit must be set *after* the undo recording.
   (set-group-modified! group true)
-  (update-intervals-for-insertion! group index n))
+  (if (group-text-properties group)
+      (update-intervals-for-insertion! group index n)))
 \f
 ;;;; Deletions
 
        (let ((text (group-text group))
              (gap-length (group-gap-length group)))
          (if (or (group-read-only? group)
-                 (text-not-deleteable? group start end))
+                 (and (group-text-properties group)
+                      (text-not-deleteable? group start end)))
              (barf-if-read-only))
          (if (not (group-modified? group))
              (check-first-group-modification group))
                     (fix:+ (group-modified-tick group) 1))
        ;; The MODIFIED? bit must be set *after* the undo recording.
        (set-group-modified! group true)
-       (update-intervals-for-deletion! group start end)
+       (if (group-text-properties group)
+           (update-intervals-for-deletion! group start end))
        (set-interrupt-enables! interrupt-mask)
        unspecific)))
 \f