Define mechanism to find and execute commands from point-local comtabs
authorChris Hanson <org/chris-hanson/cph>
Tue, 10 Aug 1993 06:35:54 +0000 (06:35 +0000)
committerChris Hanson <org/chris-hanson/cph>
Tue, 10 Aug 1993 06:35:54 +0000 (06:35 +0000)
when they exist, and modify various places to use it instead of
COMTAB-ENTRY.

Fix installation of text properties: "edwin.pkg" not propertly
modified.

Change name of package for text properties.

v7/src/edwin/comred.scm
v7/src/edwin/comtab.scm
v7/src/edwin/ed-ffi.scm
v7/src/edwin/edtfrm.scm
v7/src/edwin/edwin.ldr
v7/src/edwin/edwin.pkg
v7/src/edwin/fill.scm
v7/src/edwin/hlpcom.scm
v7/src/edwin/txtprp.scm

index 4329747c08d252d9664fe5382356491af644313c..0d90cfd31c2865fcd3736da6ea13132fff47d6f6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: comred.scm,v 1.101 1993/08/09 19:38:13 jawilson Exp $
+;;;    $Id: comred.scm,v 1.102 1993/08/10 06:35:38 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
                               (let ((window (current-window)))
                                 (%dispatch-on-command
                                  window
-                                 (let ((txtprp-comtab
-                                        (get-property-at
-                                         'command-table
-                                         (mark-index
-                                          (buffer-point (window-buffer window)))
-                                         (buffer-group (window-buffer window)))))
-                                   (or
-                                    (and
-                                     txtprp-comtab
-                                     (let ((command
-                                            (comtab-entry (cadr txtprp-comtab) input)))
-                                       (if (eq? command
-                                                (ref-command-object undefined))
-                                           false
-                                           command)))
-                                       (comtab-entry
-                                        (buffer-comtabs (window-buffer window))
-                                        input)))
+                                 (local-comtab-entry (buffer-comtabs
+                                                      (window-buffer window))
+                                                     input
+                                                     (window-point window))
                                  false)))))
-                              ((dequeue! command-reader-override-queue)))))))))))))
+                      ((dequeue! command-reader-override-queue)))))))))))))
 
 (define (bind-abort-editor-command thunk)
   (call-with-current-continuation
index c005feab45d14285f97e563d4af93b7fcc4883ec..e5ae584fd524621c0947f18d10798974301213d5 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/comtab.scm,v 1.62 1992/01/14 18:34:34 cph Exp $
+;;;    $Id: comtab.scm,v 1.63 1993/08/10 06:35:40 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-92 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
                   (error "Illegal comtab datum:" datum))))))))
 \f
 (define (comtab-entry comtabs key)
+  (or (%comtab-entry comtabs key)
+      (and (not (button? key))
+          (ref-command-object undefined))))
+
+(define (local-comtab-entry comtabs key mark)
+  (or (and mark
+          (let ((local-comtabs (local-comtabs mark)))
+            (and local-comtabs
+                 (%comtab-entry local-comtabs key))))
+      (comtab-entry comtabs key)))
+
+(define (%comtab-entry comtabs key)
   (let ((object (lookup-key comtabs key)))
     (cond ((not object)
-          (and (not (button? key))
-               (ref-command-object undefined)))
+          #f)
          ((command? object)
           object)
          ((command&comtab? object)
index 229d5e3c8bec1272166675cc5c04dca302c096de..b721aab5fb477e66363f465b6331b54a5a7d3b44 100644 (file)
               syntax-table/system-internal)
     ("tximod"  (edwin)
               edwin-syntax-table)
-    ("txtprp"  (edwin text-props)
+    ("txtprp"  (edwin text-properties)
               edwin-syntax-table)
     ("undo"    (edwin undo)
               edwin-syntax-table)
index 30257a78ab161e05f1f8a70fb3965c7e0a78b1e3..801629dd91895d9c17207ffcd230ce93138ab31b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: edtfrm.scm,v 1.86 1993/08/09 19:22:40 jawilson Exp $
+;;;    $Id: edtfrm.scm,v 1.87 1993/08/10 06:35:44 cph Exp $
 ;;;
 ;;;    Copyright (c) 1985, 1989-93 Massachusetts Institute of Technology
 ;;;
          ;; Make sure the event is inside the text portion of the
          ;; buffer, not in the modeline or other decoration.
          (cond ((and (< -1 relative-x (buffer-frame-x-size frame))
-                     (< -1 relative-y (buffer-frame-y-size frame)))
-                (let* ((point (window-coordinates->mark frame relative-x relative-y))
-                       (txtprp-comtab (and point
-                                           (get-property-at
-                                            'command-table
-                                            (mark-index point)
-                                            (mark-group point)))))
-                  (let ((command
-                         (or (and txtprp-comtab (comtab-entry (cadr txtprp-comtab)
-                                                              button))
-                             (comtab-entry (buffer-comtabs (window-buffer frame))
-                                           button))))
-                    (cond (command
-                           (with-current-button-event
-                               (make-button-event frame relative-x relative-y)
-                             (lambda () (execute-command command))))
-                          ((button/down? button)
-                           (editor-beep))))))
+                     (< -1 relative-y (buffer-frame-y-size frame))
+                     (local-comtab-entry
+                      (buffer-comtabs (window-buffer frame))
+                      button
+                      (window-coordinates->mark frame
+                                                relative-x
+                                                relative-y)))
+                => (lambda (command)
+                     (with-current-button-event
+                         (make-button-event frame relative-x relative-y)
+                       (lambda () (execute-command command)))))
                ((button/down? button)
-                (editor-beep)))))))
+                (editor-beep)))))))
\ No newline at end of file
index ddb99827ecb8bd782341fac20e768f534309a7a5..bf25e9710b1ded34d6f952cebae334158f92210b 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Id: edwin.ldr,v 1.39 1993/08/09 19:20:36 jawilson Exp $
+$Id: edwin.ldr,v 1.40 1993/08/10 06:35:46 cph Exp $
 
-Copyright (c) 1989-1992 Massachusetts Institute of Technology
+Copyright (c) 1989-93 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -94,11 +94,12 @@ MIT in each case. |#
        (load "clscon" (->environment '(EDWIN CLASS-CONSTRUCTOR)))
        (load "clsmac" (->environment '(EDWIN CLASS-MACROS)))
        (load "xform"
-             (->environment '(EDWIN CLASS-MACROS TRANSFORM-INSTANCE-VARIABLES)))
+             (->environment
+              '(EDWIN CLASS-MACROS TRANSFORM-INSTANCE-VARIABLES)))
        (load "paths" environment)
        (load "struct" environment)
        (load "grpops" (->environment '(EDWIN GROUP-OPERATIONS)))
-       (load "txtprp" (->environment '(EDWIN TEXT-PROPS)))
+       (load "txtprp" (->environment '(EDWIN TEXT-PROPERTIES)))
        (load "regops" environment)
        (load "motion" environment)
        (load "search" environment)
index 9a1b774624f92eb61380d6e4764a0e140bd68065..7ea12c0eff530c7a96221a60c4f6c1003c83bd2d 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: edwin.pkg,v 1.123 1993/08/02 23:54:24 cph Exp $
+$Id: edwin.pkg,v 1.124 1993/08/10 06:35:49 cph Exp $
 
 Copyright (c) 1989-1993 Massachusetts Institute of Technology
 
@@ -193,6 +193,7 @@ MIT in each case. |#
          comtab?
          define-key
          define-prefix-key
+         local-comtab-entry
          make-comtab
          prefix-key-list?))
 
@@ -211,6 +212,7 @@ MIT in each case. |#
          undo-more
          undo-record-deletion!
          undo-record-insertion!
+         undo-record-property-changes!
          undo-start
          with-group-undo-disabled))
 
@@ -1116,6 +1118,33 @@ MIT in each case. |#
          edwin-variable$rmail-primary-inbox-list
          edwin-variable$rmail-reply-with-re
          rmail-spool-directory))
+
+(define-package (edwin text-properties)
+  (files "txtprp")
+  (parent (edwin))
+  (export (edwin)
+         add-text-properties
+         get-property
+         get-property-at
+         group-extract-properties
+         group-reinsert-properties!
+         local-comtabs
+         next-property-change
+         next-specific-property-change
+         prev-specific-property-change
+         previous-property-change
+         remove-text-properties
+         set-text-properties
+         text-not-deleteable?
+         text-not-insertable?
+         text-properties-at
+         update-intervals-for-deletion!
+         update-intervals-for-insertion!)
+  (export (edwin window)
+         find-interval
+         interval-end
+         interval-property
+         next-interval))
 #|
 (define-package (edwin bochser)
   (files "bochser"
index f0e4298585d96930711a763672da3835e0b75ba0..dac3b31ba54e0bbbc3fc1a5ada4faa62624bbf9e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: fill.scm,v 1.58 1993/02/22 19:32:01 cph Exp $
+;;;    $Id: fill.scm,v 1.59 1993/08/10 06:35:50 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
@@ -378,7 +378,7 @@ With argument, turn auto-fill mode on iff argument is positive."
   ;; invoked, and performs the auto-fill action only when the context
   ;; is the expected one.
   (let ((command
-        (comtab-entry
+        (local-comtab-entry
          (let ((comtabs (current-comtabs)))
            (let ((tail
                   (memq (minor-mode-comtab (ref-mode-object auto-fill))
@@ -386,7 +386,8 @@ With argument, turn auto-fill mode on iff argument is positive."
              (if (or (null? tail) (null? (cdr tail)))
                  comtabs
                  (cdr tail))))
-         (current-command-key))))
+         (current-command-key)
+         (current-point))))
     (if (or (eq? command overriding)
            (eq? command overridden)
            (eq? command (ref-command-object undefined)))
index 310f74ec636295efc332202026458b8a110c047e..e9bf384121b5cc1730fdc75541e1162bb513d13f 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: hlpcom.scm,v 1.105 1992/11/13 22:16:17 cph Exp $
+;;;    $Id: hlpcom.scm,v 1.106 1993/08/10 06:35:52 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989-92 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -167,7 +167,7 @@ Prints the full documentation for the given command."
 Prints the brief documentation for that command."
   "kDescribe key briefly"
   (lambda (key)
-    (let ((command (comtab-entry (current-comtabs) key)))
+    (let ((command (local-comtab-entry (current-comtabs) key (current-point))))
       (if (eq? command (ref-command-object undefined))
          (help-describe-unbound-key key)
          (message (xkey->name key)
@@ -179,7 +179,7 @@ Prints the brief documentation for that command."
 Prints the full documentation for that command."
   "kDescribe key"
   (lambda (key)
-    (let ((command (comtab-entry (current-comtabs) key)))
+    (let ((command (local-comtab-entry (current-comtabs) key (current-point))))
       (if (eq? command (ref-command-object undefined))
          (help-describe-unbound-key key)
          (help-describe-command command)))))
index 526225dd54ef6b0b14572155e2f10eaae2ce5490..0d0bb177fecf71609ba353e138de9547411a463f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Id: txtprp.scm,v 1.1 1993/08/09 19:12:51 jawilson Exp $
+;;;    $Id: txtprp.scm,v 1.2 1993/08/10 06:35:54 cph Exp $
 ;;;
 ;;;    Copyright (c) 1993 Massachusetts Institute of Technology
 ;;;
       (get-property prop (interval-properties (find-interval group index)))
       #f))
 
+(define (local-comtabs mark)
+  (let ((property
+        (get-property-at 'COMMAND-TABLE (mark-index mark) (mark-group mark))))
+    (and property
+        (cadr property))))
+
 ;;; The next four procedures are all about the same
 ;;; and none have been tested.
 
               (and next
                    (fix:> end (interval-start next))
                    (loop next)))))))
-
+\f
 ;; export
 #|
 (define (update-intervals-for-deletion! group start end)
                  (if (and (fix:= start start*)
                           (fix:= end end*))
                      (delete-interval interval group)
-                     (add-amount-up-tree interval (fix:- 0 (fix:- end start))))
+                     (add-amount-up-tree interval
+                                         (fix:- 0 (fix:- end start))))
                  (begin
                    (if (fix:= start start*)
                        (delete-interval interval group)
-                       (add-amount-up-tree interval (fix:- 0 (fix:- end* start))))
+                       (add-amount-up-tree interval
+                                           (fix:- 0 (fix:- end* start))))
                    (loop end*)))))))))
 |#
 (define (update-intervals-for-deletion! group start end)
       (connect-left! c y2)
       
       (set-interval-total-length! a (fix:+ (fix:+ lx ly1) la))
-      (set-interval-total-length! b (fix:+ (fix:+ (fix:+ lx ly1) (fix:+ ly2 lz))
-                                          (fix:+ (fix:+ la lc) lb)))
+      (set-interval-total-length! b
+                                 (fix:+ (fix:+ (fix:+ lx ly1) (fix:+ ly2 lz))
+                                        (fix:+ (fix:+ la lc) lb)))
       (set-interval-total-length! c (fix:+ (fix:+ ly2 lz) lc))
       (set-interval-size! a (fix:+ (fix:+ nx ny1) 1))
       (set-interval-size! c (fix:+ (fix:+ ny2 nz) 1))
       (connect-right! c y2)
 
       (set-interval-total-length! a (fix:+ (fix:+ lx ly1) la))
-      (set-interval-total-length! b (fix:+ (fix:+ (fix:+ lx ly1) (fix:+ ly2 lz))
-                                          (fix:+ (fix:+ la lb) lc)))
+      (set-interval-total-length! b
+                                 (fix:+ (fix:+ (fix:+ lx ly1) (fix:+ ly2 lz))
+                                        (fix:+ (fix:+ la lb) lc)))
       (set-interval-total-length! c (fix:+ (fix:+ ly2 lz) lc))
 
       (set-interval-size! a (fix:+ (fix:+ ny1 nx) 1))
              (else
               (set-interval-size! t (fix:+ (interval-size t)
                                            size-inc-amount))
-              (balance (interval-parent t) group size-inc-amount))))))
-\f
-;; Edwin Variables:
-;; scheme-environment: '(edwin text-props)
-;; scheme-syntax-table: (access edwin-syntax-table (->environment '(edwin)))
-;; End:
\ No newline at end of file
+              (balance (interval-parent t) group size-inc-amount))))))
\ No newline at end of file