* Complete redesign of command argument code. New code more closely
authorChris Hanson <org/chris-hanson/cph>
Thu, 2 May 1991 01:14:50 +0000 (01:14 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 2 May 1991 01:14:50 +0000 (01:14 +0000)
  resembles that of Emacs, with some differences, but most importantly
  the argument state is stored in a single object that can be passed
  around.

* Rename M-x backward-delete-char to M-x delete-backward-char to match
  Emacs.

* Add BACKUP-MODE argument to WRITE-BUFFER-INTERACTIVE and
  SAVE-BUFFER, to control the creation of backup files.

* New procedures give absolute limits of buffer, independent of
  current narrowing:
GROUP-ABSOLUTE-START
GROUP-ABSOLUTE-END
MARK-ABSOLUTE-START
MARK-ABSOLUTE-END
BUFFER-ABSOLUTE-START
BUFFER-ABSOLUTE-END

* New procedures
WITH-GROUP-UNDO-DISABLED
LAST-COMMAND-CHAR

* Extend REF-VARIABLE macro to take optional second arg: a buffer,
  meaning the buffer-local value of the variable in that buffer.

* Replace WITH-NARROWED-REGION! with the slightly more useful
  WITH-TEXT-CLIPPED.  Add new procedures TEXT-CLIP and GROUP-TEXT-CLIP
  to round out the set of text clipping procedures.

26 files changed:
v7/src/edwin/argred.scm
v7/src/edwin/autold.scm
v7/src/edwin/autosv.scm
v7/src/edwin/basic.scm
v7/src/edwin/bufcom.scm
v7/src/edwin/buffer.scm
v7/src/edwin/bufmnu.scm
v7/src/edwin/comred.scm
v7/src/edwin/edwin.pkg
v7/src/edwin/filcom.scm
v7/src/edwin/fileio.scm
v7/src/edwin/fill.scm
v7/src/edwin/kilcom.scm
v7/src/edwin/lincom.scm
v7/src/edwin/macros.scm
v7/src/edwin/make.scm
v7/src/edwin/modefs.scm
v7/src/edwin/motcom.scm
v7/src/edwin/prompt.scm
v7/src/edwin/replaz.scm
v7/src/edwin/sendmail.scm
v7/src/edwin/shell.scm
v7/src/edwin/struct.scm
v7/src/edwin/tagutl.scm
v7/src/edwin/undo.scm
v7/src/edwin/wincom.scm

index 33bb40bb240f1ed7d62e231a015185a9e62037ea..92530db76427df9fbb32955537f9bc554c9025d3 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/argred.scm,v 1.29 1989/04/28 22:46:49 cph Rel $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/argred.scm,v 1.30 1991/05/02 01:11:56 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
 ;;;; Command Argument Reader
 
 (declare (usual-integrations))
-
-;;; 1.  The reader keeps track of:
-;;;
-;;; [] The MAGNITUDE of the argument.  If there are no digits, the
-;;;    magnitude is false.
-;;; [] The SIGN of the argument.
-;;; [] The MULTIPLIER-EXPONENT, which is the number of C-U's typed.
-;;; [] Whether or not "Autoargument mode" is in effect.  In autoarg
-;;;    mode, ordinary digits are interpreted as part of the argument;
-;;;    normally they are self-inserting.
-;;;
-;;; 2.  From these, it can compute:
-;;;
-;;; [] VALUE = (* MAGNITUDE (EXPT 4 MULTIPLIER-EXPONENT)).
-;;;    If the magnitude is false, then the value is too.
 \f
-;;;; Commands
-
 (define-command universal-argument
-  "Increments the argument multiplier and enters Autoarg mode.
-In Autoarg mode, - negates the numeric argument, and the
-digits 0, ..., 9 accumulate it."
-  ()
-  (lambda ()
-    (command-argument-increment-multiplier-exponent!)
-    (enter-autoargument-mode!)
-    (update-argument-prompt!)
-    (read-and-dispatch-on-char)))
+  "Begin a numeric argument for the following command.
+Digits or minus sign following this command make up the numeric argument.
+If no digits or minus sign follow, this command by itself provides 4 as argument.
+Used more than once, this command multiplies the argument by 4 each time."
+  "P"
+  (lambda (argument)
+    (set-command-argument! (list (* (if (pair? argument) (car argument) 1) 4)))
+    (set-command-message! 'AUTO-ARGUMENT (char-name (last-command-char)))))
 
 (define-command digit-argument
-  "Sets the numeric argument for the next command.
-Several such digits typed consecutively accumulate to form
-the argument.  This command should *only* be placed on a character
-which is a digit (modulo control/meta bits)."
-  ()
-  (lambda ()
-    (command-argument-accumulate-digit! (char-base (current-command-char)))
-    (update-argument-prompt!)
-    (read-and-dispatch-on-char)))
+  "Part of the numeric argument for the next command."
+  "P"
+  (lambda (argument)
+    (let ((digit (char->digit (char-base (last-command-char)))))
+      (if digit
+         (begin
+           (set-command-argument!
+            (cond ((eq? '- argument) (- digit))
+                  ((not (number? argument)) digit)
+                  ((negative? argument) (- (* 10 argument) digit))
+                  (else (+ (* 10 argument) digit))))
+           (set-command-message! 'AUTO-ARGUMENT (auto-argument-mode?)))))))
 
 (define-command negative-argument
-  "Negates the numeric argument for the next command.
-If no argument has yet been given, the argument defaults to -1."
-  ()
-  (lambda ()
-    (command-argument-negate!)
-    (update-argument-prompt!)
-    (read-and-dispatch-on-char)))
-
-(define (command-argument-self-insert? procedure)
-  (and (or (eq? procedure (ref-command auto-digit-argument))
-          (and (eq? procedure (ref-command auto-negative-argument))
-               (command-argument-beginning?)))
-       (not *autoargument-mode?*)))
+  "Begin a negative numeric argument for the next command."
+  "P"
+  (lambda (argument)
+    (set-command-argument!
+     (cond ((eq? '- argument) false)
+          ((number? argument) (- argument))
+          (else '-)))
+    (set-command-message! 'AUTO-ARGUMENT (auto-argument-mode?))))
 
 (define-command auto-digit-argument
-  "In Autoargument mode, sets numeric argument to the next command.
-Otherwise, the digit inserts itself.  This just dispatches to either
-\\[digit-argument] or \\[self-insert-command], depending on the mode."
-  ()
-  (lambda ()
-    (dispatch-on-command
-     (if (autoargument-mode?)
-        (ref-command-object digit-argument)
-        (ref-command-object self-insert-command)))))
+  "When reading a command argument, part of the numeric argument.
+Otherwise, the digit inserts itself."
+  "P"
+  (lambda (argument)
+    (if (auto-argument-mode?)
+       ((ref-command digit-argument) argument)
+       ((ref-command self-insert-command) argument))))
 
 (define-command auto-negative-argument
-  "In Autoargument mode, sets numeric sign to the next command.
-Otherwise, the character inserts itself.  This just dispatches to either
-\\[negative-argument] or \\[insert-self-command], depending on the mode."
-  ()
-  (lambda ()
-    (dispatch-on-command
-     (if (and *autoargument-mode?* (command-argument-beginning?))
-        (ref-command-object negative-argument)
-        (ref-command-object self-insert-command)))))
+  "When reading a command argument, begin a negative argument.
+Otherwise, the character inserts itself."
+  "P"
+  (lambda (argument)
+    (if (and (auto-argument-mode?)
+            (not (number? argument)))
+       ((ref-command negative-argument) argument)
+       ((ref-command self-insert-command) argument))))
 
 (define-command auto-argument
-  "Used to start a command argument and enter Autoargument mode.
-This should only be placed on digits or -, with or without control
-or meta bits."
+  "Start a command argument.
+Digits following this command become part of the argument."
   "P"
   (lambda (argument)
-    (let ((char (char-base (current-command-char))))
-      (cond ((not (eq? char #\-))
-            (enter-autoargument-mode!)
-            (dispatch-on-command (ref-command-object digit-argument)))
-           ((command-argument-beginning?)
-            (enter-autoargument-mode!)
-            (dispatch-on-command (ref-command-object negative-argument)))
-           (else
-            (insert-chars char argument))))))
+    (if (char=? #\- (char-base (last-command-char)))
+       (if (not (number? argument))
+           ((ref-command negative-argument) argument))
+       ((ref-command digit-argument) argument))
+    (if (not argument)
+       (set-command-message! 'AUTO-ARGUMENT true))))
 \f
-;;;; Primitives
+(define (command-argument-self-insert? command)
+  (and (or (eq? command (ref-command-object auto-digit-argument))
+          (and (eq? command (ref-command-object auto-negative-argument))
+               (not (number? (command-argument)))))
+       (not (auto-argument-mode?))))
 
-(define (with-command-argument-reader thunk)
-  (fluid-let ((*magnitude*)
-             (*negative?*)
-             (*multiplier-exponent*)
-             (*multiplier-value*)
-             (*autoargument-mode?*)
-             (*previous-prompt*))
-    (thunk)))
-
-(define (reset-command-argument-reader!)
-  ;; Call this at the beginning of a command cycle.
-  (set! *magnitude* false)
-  (set! *negative?* false)
-  (set! *multiplier-exponent* 0)
-  (set! *multiplier-value* 1)
-  (set! *autoargument-mode?* false)
-  (set! *previous-prompt* ""))
+(define (auto-argument-mode?)
+  (command-message-receive 'AUTO-ARGUMENT (lambda (x) x) (lambda () false)))
 
 (define (command-argument-prompt)
-  (or *previous-prompt* (%command-argument-prompt)))
-
-(define *previous-prompt*)
-
-(define (update-argument-prompt!)
-  (let ((prompt (%command-argument-prompt)))
-    (set! *previous-prompt* prompt)
-    (set-command-prompt! prompt)))
-
-(define (%command-argument-prompt)
-  (if (and (not *magnitude*)
-          (if (autoargument-mode?)
-              (and (not *negative?*)
-                   (= *multiplier-exponent* 1))
-              *negative?*))
-      (xchar->name (current-command-char))
-      (let ((prefix (if (autoargument-mode?) "Autoarg" "Arg"))
-           (value (command-argument-value)))
-       (cond (value (string-append-separated prefix (write-to-string value)))
-             (*negative?* (string-append-separated prefix "-"))
-             (else "")))))
-
-;;;; Argument Number
-
-(define *magnitude*)
-(define *negative?*)
-
-(define (command-argument-accumulate-digit! digit-char)
-  (set! *multiplier-exponent* 0)
-  (set! *multiplier-value* 1)
-  (let ((digit (or (char->digit digit-char 10)
-                  (error "Not a valid digit" digit-char))))
-    (set! *magnitude*
-         (if (not *magnitude*)
-             digit
-             (+ digit (* 10 *magnitude*))))))
-
-(define (command-argument-negate!)
-  (set! *multiplier-exponent* 0)
-  (set! *multiplier-value* 1)
-  (set! *negative?* (not *negative?*)))
-
-(define (command-argument-magnitude)
-  *magnitude*)
-
-(define (command-argument-negative?)
-  *negative?*)
-\f
-;;;; Argument Multiplier
-
-(define *multiplier-exponent*)
-(define *multiplier-value*)
-
-(define (command-argument-increment-multiplier-exponent!)
-  (set! *magnitude* false)
-  (set! *negative?* false)
-  (set! *multiplier-exponent* (1+ *multiplier-exponent*))
-  (set! *multiplier-value* (* 4 *multiplier-value*)))
-
-(define (command-argument-multiplier-exponent)
-  *multiplier-exponent*)
-
-;;;; Autoargument Mode
-
-(define *autoargument-mode?*)
-
-(define (enter-autoargument-mode!)
-  (set! *autoargument-mode?* true))
-
-(define (autoargument-mode?)
-  *autoargument-mode?*)
-
-;;;; Value
-
-(define (command-argument-standard-value?)
-  (or *magnitude*
-      (not (zero? *multiplier-exponent*))
-      *negative?*))
-
-(define (command-argument-standard-value)
-  (or (command-argument-value)
-      (and *negative?* -1)))
-
-(define (command-argument-value)
-  ;; This returns the numeric value of the argument, or false if none.
-  (cond (*magnitude*
-        (* (if *negative?* (- *magnitude*) *magnitude*)
-           *multiplier-value*))
-       ((not (zero? *multiplier-exponent*))
-        (if *negative?* (- *multiplier-value*) *multiplier-value*))
-       (else false)))
-
-(define (command-argument-multiplier-only?)
-  (and (not *magnitude*)
-       (not (zero? *multiplier-exponent*))
-       *multiplier-exponent*))
-
-(define (command-argument-negative-only?)
-  (and (not *magnitude*)
-       (zero? *multiplier-exponent*)
-       *negative?*))
-
-(define (command-argument-beginning?)
-  (and (not *magnitude*)
-       (not *negative?*)
-       (< *multiplier-exponent* 2)))
\ No newline at end of file
+  (let ((arg (command-argument)))
+    (if (not arg)
+       ""
+       (let ((mode (auto-argument-mode?)))
+         (string-append
+          (if (and (pair? arg) (string? mode))
+              (let loop ((n (car arg)))
+                (if (= n 4)
+                    mode
+                    (string-append mode " " (loop (quotient n 4)))))
+              (string-append
+               (cond ((string? mode) mode)
+                     (mode "Autoarg")
+                     (else "Arg"))
+               " "
+               (if (eq? '- arg)
+                   "-"
+                   (number->string (if (pair? arg) (car arg) arg)))))
+          " -")))))
+
+(define (command-argument-multiplier-only? argument)
+  (pair? argument))
+
+(define (command-argument-negative-only? argument)
+  (eq? '- argument))
+
+(define (command-argument-value argument)
+  (cond ((not argument) false)
+       ((eq? '- argument) -1)
+       ((pair? argument) (car argument))
+       (else argument)))
+
+(define (command-argument-numeric-value argument)
+  (or (command-argument-value argument) 1))
\ No newline at end of file
index d2e21c68ba133a3d562efb21671f548503639d3f..574351885dc28270ae608478f01a011222b89d11 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/autold.scm,v 1.49 1991/02/15 18:12:16 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/autold.scm,v 1.50 1991/05/02 01:12:03 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -190,13 +190,12 @@ Second arg FORCE? controls what happens if the library is already loaded:
 Second arg is prefix arg when called interactively."
   (lambda ()
     (list
-     (car
-      (prompt-for-alist-value "Load library"
-                             (map (lambda (library)
-                                    (cons (symbol->string (car library))
-                                          library))
-                                  known-libraries)))
-     (command-argument-standard-value)))
+     (car (prompt-for-alist-value "Load library"
+                                 (map (lambda (library)
+                                        (cons (symbol->string (car library))
+                                              library))
+                                      known-libraries)))
+     (command-argument)))
   (lambda (name force?)
     (let ((do-it
           (let ((library 
index d627aef4c9b37cd3ee2e9b3ec31fd7451d0f5caa..0ab336f3fcb61993132788f05b76490e91112937 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/autosv.scm,v 1.25 1991/04/21 00:48:49 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/autosv.scm,v 1.26 1991/05/02 01:12:10 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -74,7 +74,8 @@ when the buffer is saved for real."
 With arg, turn auto-saving on if arg is positive, else off."
   "P"
   (lambda (argument)
-    (let ((buffer (current-buffer)))
+    (let ((argument (command-argument-value argument))
+         (buffer (current-buffer)))
       (if (if argument
              (positive? argument)
              (not (buffer-auto-save-pathname buffer)))
index 4231466e4bbceeeb4515485afb26e1f17cc084ed..4138523e6ba4a865148e4ddd895dd8e2277e7d93 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/basic.scm,v 1.108 1991/04/24 00:36:19 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/basic.scm,v 1.109 1991/05/02 01:12:16 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
 With an argument, insert the character that many times."
   "P"
   (lambda (argument)
-    (insert-chars (current-command-char) (or argument 1))))
+    (insert-chars (last-command-char)
+                 (command-argument-numeric-value argument))))
 
 (define-command quoted-insert
   "Reads a character and inserts it."
-  "P"
+  "p"
   (lambda (argument)
     (let ((read-char
           (lambda ()
@@ -76,7 +77,7 @@ With an argument, insert the character that many times."
                                 (let ((digit3 (read-digit)))
                                   (+ (* (+ (* digit 8) digit2) 8) digit3))))
                              char)))
-                     (or argument 1))))))
+                     argument)))))
 
 (define-command open-line
   "Insert a newline after point.
@@ -86,7 +87,7 @@ With an argument, inserts several newlines."
   "P"
   (lambda (argument)
     (let ((m* (mark-right-inserting (current-point))))
-      (insert-newlines (or argument 1))
+      (insert-newlines (or (command-argument-value argument) 1))
       (set-current-point! m*))))
 
 (define-command narrow-to-region
@@ -243,7 +244,7 @@ For a normal exit, you should use \\[exit-recursive-edit], NOT this command."
 With argument, saves visited file first."
   "P"
   (lambda (argument)
-    (if argument ((ref-command save-buffer) false))
+    (if argument (save-buffer (current-buffer) false))
     (set! edwin-finalization
          (lambda ()
            (set! edwin-finalization false)
@@ -338,31 +339,33 @@ With just minus as arg, kill any comment on this line.
 Otherwise, set the comment column to the argument."
   "P"
   (lambda (argument)
-    (cond ((command-argument-negative-only?)
-          ((ref-command kill-comment)))
-         (else
-          (set-variable! comment-column (or argument (current-column)))
-          (message "comment-column set to " (ref-variable comment-column))))))
+    (if (command-argument-negative-only? argument)
+       ((ref-command kill-comment))
+       (let ((column
+              (or (command-argument-value argument)
+                  (current-column))))
+         (set-variable! comment-column column)
+         (message "comment-column set to " column)))))
 \f
 (define-command indent-for-comment
   "Indent this line's comment to comment column, or insert an empty comment."
   ()
   (lambda ()
     (if (not (ref-variable comment-locator-hook))
-       (editor-error "No comment syntax defined")
-       (let ((start (line-start (current-point) 0))
-             (end (line-end (current-point) 0)))
-         (let ((com ((ref-variable comment-locator-hook) start)))
-           (set-current-point! (if com (car com) end))
-           (let ((comment-end (and com (mark-permanent! (cdr com)))))
-             (let ((indent
-                    ((ref-variable comment-indent-hook) (current-point))))
-               (maybe-change-column indent)
-               (if comment-end
-                   (set-current-point! comment-end)
-                   (begin
-                     (insert-string (ref-variable comment-start))
-                     (insert-comment-end))))))))))
+       (editor-error "No comment syntax defined"))
+    (let ((start (line-start (current-point) 0))
+         (end (line-end (current-point) 0)))
+      (let ((com ((ref-variable comment-locator-hook) start)))
+       (set-current-point! (if com (car com) end))
+       (let ((comment-end (and com (mark-permanent! (cdr com)))))
+         (let ((indent
+                ((ref-variable comment-indent-hook) (current-point))))
+           (maybe-change-column indent)
+           (if comment-end
+               (set-current-point! comment-end)
+               (begin
+                 (insert-string (ref-variable comment-start))
+                 (insert-comment-end)))))))))
 
 (define-variable comment-multi-line
   "True means \\[indent-new-comment-line] should continue same comment
index 4cd7934de264a64fc1cf0f718347b71577a3df69..d98764f4f3d4088c5b2ec65045f40fd9bfe31455 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufcom.scm,v 1.86 1990/10/09 16:23:12 cph Rel $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufcom.scm,v 1.87 1991/05/02 01:12:22 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989, 1990 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -188,7 +188,7 @@ Just like what happens when the file is first visited."
            (string-append "Buffer "
                           (buffer-name buffer)
                           " contains changes.  Write them out")))
-      (write-buffer-interactive buffer)))
+      (write-buffer-interactive buffer false)))
 
 (define (new-buffer name)
   (create-buffer
index b2396607eb1413a70bcbaacb66435eca4ad51e95..1d8f0cc2aa9551286074623d4a9ea30d9ea7c9d4 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/buffer.scm,v 1.144 1991/04/24 00:42:08 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/buffer.scm,v 1.145 1991/05/02 01:12:28 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -176,7 +176,7 @@ The buffer is guaranteed to be deselected at that time."
 
 (define-integrable (set-buffer-comtabs! buffer comtabs)
   (vector-set! buffer buffer-index:comtabs comtabs))
-
+\f
 (define (buffer-point buffer)
   (if (current-buffer? buffer)
       (current-point)
@@ -184,7 +184,7 @@ The buffer is guaranteed to be deselected at that time."
 
 (define-integrable (%set-buffer-point! buffer mark)
   (set-group-point! (buffer-group buffer) mark))
-\f
+
 (define-integrable (minibuffer? buffer)
   (char=? (string-ref (buffer-name buffer) 0) #\Space))
 
@@ -209,6 +209,12 @@ The buffer is guaranteed to be deselected at that time."
 (define-integrable (buffer-end buffer)
   (group-end-mark (buffer-group buffer)))
 
+(define-integrable (buffer-absolute-start buffer)
+  (group-absolute-start (buffer-group buffer)))
+
+(define-integrable (buffer-absolute-end buffer)
+  (group-absolute-end (buffer-group buffer)))
+
 (define (add-buffer-window! buffer window)
   (vector-set! buffer
               buffer-index:windows
@@ -221,7 +227,7 @@ The buffer is guaranteed to be deselected at that time."
 
 (define-integrable (set-buffer-display-start! buffer mark)
   (vector-set! buffer buffer-index:display-start mark))
-
+\f
 (define-integrable (buffer-visible? buffer)
   (not (null? (buffer-windows buffer))))
 
index 5b700a4f5c1eb3234d41a3cd78fe238bd5bcf7e3..e719548c2c611c911be90ba7df40f05543c5e5bf 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufmnu.scm,v 1.113 1991/04/21 00:49:05 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/bufmnu.scm,v 1.114 1991/05/02 01:12:36 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -297,8 +297,8 @@ You can mark buffers with the \\[buffer-menu-mark] command."
   (for-each buffer-menu-kill! (find-buffers-marked 0 #\D)))
 
 (define (buffer-menu-save! lstart)
-  (save-buffer (buffer-menu-buffer lstart))
-  (set-buffer-menu-mark! lstart 1 #\Space))
+  (save-buffer (buffer-menu-buffer lstart) false)
+  (set-buffer-menu-mark! lstart 1 #\space))
 
 (define (buffer-menu-kill! lstart)
   (define (erase-line)
index 53965b3d543a0fb5b4b8aac73ef8285b7759d2c3..219f5bd28d13de39ceb6a4d7c46ae94b626bc124 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/comred.scm,v 1.85 1991/03/16 00:01:28 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/comred.scm,v 1.86 1991/05/02 01:12:45 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -49,6 +49,8 @@
 (define *command-continuation*)        ;Continuation of current command
 (define *command-char*)                ;Character read to find current command
 (define *command*)             ;The current command
+(define *command-argument*)    ;Argument from last command
+(define *next-argument*)       ;Argument to next command
 (define *command-message*)     ;Message from last command
 (define *next-message*)                ;Message to next command
 (define *non-undo-count*)      ;# of self-inserts since last undo boundary
     (call-with-current-continuation
      (lambda (continuation)
        (fluid-let ((*command-continuation* continuation)
-                  (*command-char*)
+                  (*command-char* false)
                   (*command*)
+                  (*next-argument* false)
                   (*next-message* false))
         (bind-condition-handler (list condition-type:editor-error)
             editor-error-handler
     (let ((char (with-editor-interrupts-disabled keyboard-read-char)))
       (set! *command-char* char)
       (clear-message)
-      (set-command-prompt! (char-name char))
+      (set-command-prompt!
+       (if (not *command-argument*)
+          (char-name char)
+          (string-append-separated (command-argument-prompt)
+                                   (char-name char))))
       (let ((window (current-window)))
        (%dispatch-on-command window
                              (comtab-entry (buffer-comtabs
                              false)))
     (start-next-command))
 
-  (fluid-let ((*command-message*)
+  (fluid-let ((*command-argument*)
+             (*command-message*)
              (*non-undo-count* 0))
-    (with-command-argument-reader
-     (lambda ()
-       (if (and (not (default-object? initialization)) initialization)
-          (with-command-variables
-           (lambda ()
-             (reset-command-state!)
-             (initialization))))
-       (command-reader-loop)))))
+    (if (and (not (default-object? initialization)) initialization)
+       (with-command-variables
+        (lambda ()
+          (reset-command-state!)
+          (initialization))))
+    (command-reader-loop)))
 
 (define (reset-command-state!)
-  (reset-command-argument-reader!)
-  (reset-command-prompt!)
+  (set! *command-argument* *next-argument*)
+  (set! *next-argument* false)
   (set! *command-message* *next-message*)
   (set! *next-message* false)
+  (if *command-argument*
+      (set-command-prompt! (command-argument-prompt))
+      (reset-command-prompt!))
   (if *defining-keyboard-macro?* (keyboard-macro-finalize-chars)))
 \f
 ;;; The procedures for executing commands come in two flavors.  The
 (define-integrable (current-command-char)
   *command-char*)
 
+(define (last-command-char)
+  (if (char? *command-char*)
+      *command-char*
+      (car (last-pair *command-char*))))
+
 (define-integrable (current-command)
   *command*)
 
+(define (set-command-argument! argument)
+  (set! *next-argument* argument)
+  unspecific)
+
+(define-integrable (command-argument)
+  *command-argument*)
+
 (define (set-command-message! tag . arguments)
   (set! *next-message* (cons tag arguments))
   unspecific)
             (set! *non-undo-count* 0)
             (undo-boundary! point)
             (apply procedure (interactive-arguments command record?)))))
-      (cond ((or *executing-keyboard-macro?*
-                (command-argument-standard-value?))
+      (cond ((or *executing-keyboard-macro?* (command-argument))
             (set! *non-undo-count* 0)
             (apply procedure (interactive-arguments command record?)))
            ((window-needs-redisplay? window)
             (normal))
-           ((eq? procedure (ref-command forward-char))
+           ((eq? command (ref-command-object forward-char))
             (if (and (not (group-end? point))
                      (char-graphic? (mark-right-char point))
                      (< point-x (- (window-x-size window) 2)))
                 (window-direct-output-forward-char! window)
                 (normal)))
-           ((eq? procedure (ref-command backward-char))
+           ((eq? command (ref-command-object backward-char))
             (if (and (not (group-start? point))
                      (char-graphic? (mark-left-char point))
                      (positive? point-x)
                      (< point-x (-1+ (window-x-size window))))
                 (window-direct-output-backward-char! window)
                 (normal)))
-           ((or (eq? procedure (ref-command self-insert-command))
-                (and (eq? procedure (ref-command auto-fill-space))
+           ((or (eq? command (ref-command-object self-insert-command))
+                (and (eq? command (ref-command-object auto-fill-space))
                      (not (auto-fill-break? point)))
-                (command-argument-self-insert? procedure))
+                (command-argument-self-insert? command))
             (let ((char *command-char*))
               (if (let ((buffer (window-buffer window)))
                     (and (buffer-auto-save-modified? buffer)
       ((#\n)
        (prompting (prompt-for-number prompt false)))
       ((#\N)
-       (prefix
-       (or (command-argument-standard-value)
-           (prompt-for-number prompt false))))
+       (prefix (or (command-argument) (prompt-for-number prompt false))))
       ((#\p)
-       (prefix (or (command-argument-standard-value) 1)))
+       (prefix (or (command-argument-value (command-argument)) 1)))
       ((#\P)
-       (prefix (command-argument-standard-value)))
+       (prefix (command-argument)))
       ((#\r)
        (varies (current-region) '(CURRENT-REGION)))
       ((#\s)
index b33cb57ed0d071b84c82ec6f11c1d56473bb3c9c..4b70d7d84dcc42afdcac5793278c1b0dd6f5150a 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/edwin.pkg,v 1.34 1991/04/29 10:42:35 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/edwin.pkg,v 1.35 1991/05/02 01:12:54 cph Exp $
 
 Copyright (c) 1989-91 Massachusetts Institute of Technology
 
@@ -190,7 +190,8 @@ MIT in each case. |#
          undo-boundary!
          undo-done!
          undo-record-deletion!
-         undo-record-insertion!))
+         undo-record-insertion!
+         with-group-undo-disabled))
 
 (define-package (edwin display-type)
   (files "display")
@@ -402,6 +403,7 @@ MIT in each case. |#
   (parent (edwin))
   (export (edwin)
          abort-current-command
+         command-argument
          command-history-list
          command-message-receive
          command-reader
@@ -415,7 +417,9 @@ MIT in each case. |#
          execute-command-history-entry
          initialize-command-reader!
          keyboard-chars-read
+         last-command-char
          read-and-dispatch-on-char
+         set-command-argument!
          set-command-message!
          top-level-command-reader))
 
@@ -552,18 +556,18 @@ MIT in each case. |#
   (files "argred")
   (parent (edwin))
   (export (edwin)
-         command-argument-beginning?
-         command-argument-multiplier-exponent
          command-argument-multiplier-only?
          command-argument-negative-only?
-         command-argument-negative?
+         command-argument-numeric-value
          command-argument-prompt
          command-argument-self-insert?
-         command-argument-standard-value
-         command-argument-standard-value?
          command-argument-value
-         reset-command-argument-reader!
-         with-command-argument-reader))
+         edwin-command$auto-argument
+         edwin-command$auto-digit-argument
+         edwin-command$auto-negative-argument
+         edwin-command$digit-argument
+         edwin-command$negative-argument
+         edwin-command$universal-argument))
 
 (define-package (edwin buffer-menu)
   (files "bufmnu")
index 27ee14830c6597bb0ede9caa01aa8d925c21a496..f2f480afe144439740e07dad09f0d8759e04a083 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/filcom.scm,v 1.150 1991/04/23 06:32:03 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/filcom.scm,v 1.151 1991/05/02 01:13:01 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -256,47 +256,6 @@ Argument means don't offer to use auto-save file."
            (local-set-variable! scheme-environment (cadr entry))
            (local-set-variable! scheme-syntax-table (caddr entry)))))))
 \f
-(define (save-buffer buffer)
-  (if (buffer-modified? buffer)
-      (let ((exponent (command-argument-multiplier-only?)))
-       (if (buffer-pathname buffer)
-           (save-buffer-prepare-version buffer)
-           (set-visited-pathname
-            buffer
-            (prompt-for-pathname
-             (string-append "Write buffer " (buffer-name buffer) " to file")
-             false false)))
-       (if (memv exponent '(2 3)) (set-buffer-backed-up?! buffer false))
-       (write-buffer-interactive buffer)
-       (if (memv exponent '(1 3)) (set-buffer-backed-up?! buffer false)))
-      (temporary-message "(No changes need to be written)")))
-
-(define (save-some-buffers #!optional no-confirmation?)
-  (let ((buffers
-        (list-transform-positive (buffer-list)
-          (lambda (buffer)
-            (and (buffer-modified? buffer)
-                 (buffer-pathname buffer))))))
-    (if (null? buffers)
-       (temporary-message "(No files need saving)")
-       (for-each (lambda (buffer)
-                   (save-buffer-prepare-version buffer)
-                   (if (or (and (not (default-object? no-confirmation?))
-                                no-confirmation?)
-                           (prompt-for-confirmation?
-                            (string-append
-                             "Save file "
-                             (pathname->string (buffer-pathname buffer)))))
-                       (write-buffer-interactive buffer)))
-                 buffers))))
-
-(define (save-buffer-prepare-version buffer)
-  (if pathname-newest
-      (let ((pathname (buffer-pathname buffer)))
-       (if (and pathname (integer? (pathname-version pathname)))
-           (set-buffer-pathname! buffer
-                                 (pathname-new-version pathname 'NEWEST))))))
-
 (define-command save-buffer
   "Save current buffer in visited file if modified.  Versions described below.
 
@@ -320,19 +279,54 @@ We don't want excessive versions piling up, so there are variables
  Defaults are 2 old versions and 2 new.
 If `trim-versions-without-asking' is false, system will query user
  before trimming versions.  Otherwise it does it silently."
-  "P"
+  "p"
   (lambda (argument)
-    (let ((do-it (lambda () (save-buffer (current-buffer)))))
-      (if (eqv? argument 0)
-         (with-variable-value! (ref-variable-object make-backup-files) false
-           do-it)
-         (do-it)))))
+    (save-buffer (current-buffer)
+                (case argument
+                  ((0) 'NO-BACKUP)
+                  ((4) 'BACKUP-NEXT)
+                  ((16) 'BACKUP-PREVIOUS)
+                  ((64) 'BACKUP-BOTH)
+                  (else false)))))
 
 (define-command save-some-buffers
   "Saves some modified file-visiting buffers.  Asks user about each one.
 With argument, saves all with no questions."
   "P"
-  save-some-buffers)
+  (lambda (no-confirmation?)
+    (save-some-buffers no-confirmation?)))
+
+(define (save-buffer buffer backup-mode)
+  (if (buffer-modified? buffer)
+      (begin
+       (if (not (buffer-pathname buffer))
+           (set-visited-pathname
+            buffer
+            (prompt-for-pathname
+             (string-append "Write buffer " (buffer-name buffer) " to file")
+             false false)))
+       (write-buffer-interactive buffer backup-mode))
+      (message "(No changes need to be written)")))
+
+(define (save-some-buffers #!optional no-confirmation?)
+  (let ((buffers
+        (list-transform-positive (buffer-list)
+          (lambda (buffer)
+            (and (buffer-modified? buffer)
+                 (buffer-pathname buffer))))))
+    (if (null? buffers)
+       (temporary-message "(No files need saving)")
+       (for-each (if (and (not (default-object? no-confirmation?))
+                          no-confirmation?)
+                     (lambda (buffer)
+                       (write-buffer-interactive buffer false))
+                     (lambda (buffer)
+                       (if (prompt-for-confirmation?
+                            (string-append
+                             "Save file "
+                             (pathname->string (buffer-pathname buffer))))
+                           (write-buffer-interactive buffer false))))
+                 buffers))))
 \f
 (define-command set-visited-file-name
   "Change name of file visited in current buffer.
@@ -375,7 +369,7 @@ Makes buffer visit that file, and marks it not modified."
           (not (string-null? filename)))
       (set-visited-pathname buffer (->pathname filename)))
   (buffer-modified! buffer)
-  (save-buffer buffer))
+  (save-buffer buffer false))
 
 (define-command write-region
   "Write current region into specified file."
index 39cbf2cf878fe4b10b54b42c2f9498e637fcccdc..0858087685076ff908e8c6832ab223c4a65ae778 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/fileio.scm,v 1.97 1991/04/23 06:45:42 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/fileio.scm,v 1.98 1991/05/02 01:13:09 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
   (association-procedure string-ci=? car))
 
 (define (parse-buffer-mode-header buffer)
-  (with-variable-value! (ref-variable-object case-fold-search) true
-    (lambda ()
-      (let ((start (buffer-start buffer)))
-       (let ((end (line-end start 0)))
-         (let ((start (re-search-forward "-\\*-[ \t]*" start end)))
-           (and start
-                (re-search-forward "[ \t]*-\\*-" start end)
-                (parse-mode-header start (re-match-start 0)))))))))
-
-(define (parse-mode-header start end)
-  (if (not (char-search-forward #\: start end))
-      (extract-string start end)
-      (let ((mode-mark (re-search-forward "mode:[ \t]*" start end)))
-       (and mode-mark
-            (extract-string mode-mark
-                            (if (re-search-forward "[ \t]*;" mode-mark end)
-                                (re-match-start 0)
-                                end))))))
+  (let ((start (buffer-start buffer)))
+    (let ((end (line-end start 0)))
+      (let ((start (re-search-forward "-\\*-[ \t]*" start end false)))
+       (and start
+            (re-search-forward "[ \t]*-\\*-" start end false)
+            (let ((end (re-match-start 0)))
+              (if (not (char-search-forward #\: start end false))
+                  (extract-string start end)
+                  (let ((m (re-search-forward "mode:[ \t]*" start end true)))
+                    (and m
+                         (extract-string
+                          m
+                          (if (re-search-forward "[ \t]*;" m end false)
+                              (re-match-start 0)
+                              end)))))))))))
 
 )
 \f
@@ -198,13 +195,10 @@ at the end of a file."
 (named-lambda (initialize-buffer-local-variables! buffer)
   (let ((end (buffer-end buffer)))
     (let ((start
-          (with-narrowed-region!
-           (make-region (mark- end
-                               (ref-variable local-variable-search-limit)
-                               'LIMIT)
-                        end)
-           (lambda ()
-             (backward-one-page end)))))
+          (with-text-clipped
+           (mark- end (ref-variable local-variable-search-limit) 'LIMIT)
+           end
+           (lambda () (backward-one-page end)))))
       (if start
          (if (re-search-forward "Edwin Variables:[ \t]*" start end true)
              (parse-local-variables buffer
@@ -323,7 +317,7 @@ See documentation of variable  make-backup-files."
 Otherwise asks confirmation."
   false)
 \f
-(define (write-buffer-interactive buffer)
+(define (write-buffer-interactive buffer backup-mode)
   (let ((truename (pathname->output-truename (buffer-pathname buffer))))
     (let ((writable? (file-writable? truename)))
       (if (or writable?
@@ -339,9 +333,7 @@ Otherwise asks confirmation."
                         (prompt-for-yes-or-no?
                          "Disk file has changed since visited or saved.  Save anyway")))
                (editor-error "Save not confirmed"))
-           (let ((modes
-                  (and (not (buffer-backed-up? buffer))
-                       (backup-buffer! buffer truename))))
+           (let ((modes (backup-buffer! buffer truename backup-mode)))
              (require-newline buffer)
              (if (not (or writable? modes))
                  (begin
@@ -458,7 +450,7 @@ Otherwise asks confirmation."
                                (fix:+ end gap-length))))))
 \f
 (define (require-newline buffer)
-  (let ((require-final-newline? (ref-variable require-final-newline)))
+  (let ((require-final-newline? (ref-variable require-final-newline buffer)))
     (if require-final-newline?
        (without-group-clipped! (buffer-group buffer)
          (lambda ()
@@ -473,53 +465,53 @@ Otherwise asks confirmation."
                               " does not end in newline.  Add one")))))
                  (insert-newline end))))))))
 
-(define (backup-buffer! buffer truename)
-  (let ((continue-with-false (lambda () false)))
-    (and truename
-        (ref-variable make-backup-files)
-        (not (buffer-backed-up? buffer))
-        (file-exists? truename)
-        (os/backup-buffer? truename)
-        (catch-file-errors
-         continue-with-false
-         (lambda ()
-           (with-values (lambda () (os/buffer-backup-pathname truename))
-             (lambda (backup-pathname targets)
-               (let ((modes
-                      (catch-file-errors
-                       (lambda ()
-                         (let ((filename (os/default-backup-filename)))
-                           (temporary-message
-                            "Cannot write backup file; backing up in "
-                            filename)
-                           (copy-file truename
-                                      (string->pathname filename))
-                           false))
-                       (lambda ()
-                         (if (or (file-symbolic-link? truename)
-                                 (ref-variable backup-by-copying)
-                                 (os/backup-by-copying? truename))
-                             (begin
-                               (copy-file truename backup-pathname)
-                               false)
-                             (begin
+(define (backup-buffer! buffer truename backup-mode)
+  (and (ref-variable make-backup-files buffer)
+       (or (memq backup-mode '(BACKUP-PREVIOUS BACKUP-BOTH))
+          (and (not (eq? backup-mode 'NO-BACKUP))
+               (not (buffer-backed-up? buffer))))
+       truename
+       (file-exists? truename)
+       (os/backup-buffer? truename)
+       (catch-file-errors
+       (lambda () false)
+       (lambda ()
+         (with-values (lambda () (os/buffer-backup-pathname truename))
+           (lambda (backup-pathname targets)
+             (let ((modes
+                    (catch-file-errors
+                     (lambda ()
+                       (let ((filename (os/default-backup-filename)))
+                         (temporary-message
+                          "Cannot write backup file; backing up in "
+                          filename)
+                         (copy-file truename (string->pathname filename))
+                         false))
+                     (lambda ()
+                       (if (or (file-symbolic-link? truename)
+                               (ref-variable backup-by-copying buffer)
+                               (os/backup-by-copying? truename))
+                           (begin
+                             (copy-file truename backup-pathname)
+                             false)
+                           (begin
+                             (catch-file-errors
+                              (lambda () unspecific)
+                              (lambda () (delete-file backup-pathname)))
+                             (rename-file truename backup-pathname)
+                             (file-modes backup-pathname)))))))
+               (set-buffer-backed-up?!
+                buffer
+                (not (memv backup-mode '(BACKUP-NEXT BACKUP-BOTH))))
+               (if (and (not (null? targets))
+                        (or (ref-variable trim-versions-without-asking buffer)
+                            (prompt-for-confirmation?
+                             (string-append
+                              "Delete excess backup versions of "
+                              (pathname->string (buffer-pathname buffer))))))
+                   (for-each (lambda (target)
                                (catch-file-errors
-                                (lambda () false)
-                                (lambda ()
-                                  (delete-file backup-pathname)))
-                               (rename-file truename backup-pathname)
-                               (file-modes backup-pathname)))))))
-                 (set-buffer-backed-up?! buffer true)
-                 (if (and (not (null? targets))
-                          (or (ref-variable trim-versions-without-asking)
-                              (prompt-for-confirmation?
-                               (string-append
-                                "Delete excess backup versions of "
-                                (pathname->string
-                                 (buffer-pathname buffer))))))
-                     (for-each (lambda (target)
-                                 (catch-file-errors continue-with-false
-                                                    (lambda ()
-                                                      (delete-file target))))
-                               targets))
-                 modes))))))))
\ No newline at end of file
+                                (lambda () unspecific)
+                                (lambda () (delete-file target))))
+                             targets))
+               modes)))))))
\ No newline at end of file
index 60e68e043fae5989b78378d9d06a55b756647094..46aa50f0aa8f4ced4fd2073999af5fe14f0b0d61 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/fill.scm,v 1.49 1991/04/24 00:40:22 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/fill.scm,v 1.50 1991/05/02 01:13:16 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -57,9 +57,11 @@ Automatically becomes local when set in any fashion."
 fill-column's value is separate for each buffer."
   "P"
   (lambda (argument)
-    (let ((column (or argument (current-column))))
+    (let ((column
+          (or (command-argument-value argument)
+              (current-column))))
       (set-variable! fill-column column)
-      (message "fill-column set to " (number->string column)))))
+      (message "fill-column set to " column))))
 
 (define-variable-per-buffer fill-prefix
   "String for filling to insert at front of new line, or #f for none.
@@ -336,7 +338,8 @@ Prefix arg means justify as well."
 With argument, turn auto-fill mode on iff argument is positive."
   "P"
   (lambda (argument)
-    (let ((mode (ref-mode-object auto-fill)))
+    (let ((argument (command-argument-value argument))
+         (mode (ref-mode-object auto-fill)))
       (cond ((and (or (not argument) (positive? argument))
                  (not (current-minor-mode? mode)))
             (enable-current-minor-mode! mode))
index eb9f40270fbfc6350fe6966bd51f9a6c45038a15..187e2f8915c221ed6f5c781dc8d590d2a2a403ca 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/kilcom.scm,v 1.61 1991/04/24 00:38:05 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/kilcom.scm,v 1.62 1991/05/02 01:13:23 cph Exp $
 ;;;
 ;;;    Copyright (c) 1985, 1989-91 Massachusetts Institute of Technology
 ;;;
 \f
 ;;;; Deletion
 
-(define-command backward-delete-char
+(define-command delete-backward-char
   "Delete character before point.
 With argument, kills several characters (saving them).
 Negative args kill characters forward."
@@ -114,7 +114,8 @@ Negative args kill characters forward."
   (lambda (argument)
     (if (not argument)
        (delete-region (mark-1+ (current-point)))
-       (kill-region (mark- (current-point) argument)))))
+       (kill-region
+        (mark- (current-point) (command-argument-value argument))))))
 
 (define-command delete-char
   "Delete character after point.
@@ -124,7 +125,8 @@ Negative args kill characters backward."
   (lambda (argument)
     (if (not argument)
        (delete-region (mark1+ (current-point)))
-       (kill-region (mark+ (current-point) argument)))))
+       (kill-region
+        (mark+ (current-point) (command-argument-value argument))))))
 
 (define-command kill-line
   "Kill to end of line, or kill an end of line.
@@ -135,7 +137,8 @@ An argument of zero means kill to beginning of line, nothing if at beginning.
 Killed text is pushed onto the kill ring for retrieval."
   "P"
   (lambda (argument)
-    (let ((point (current-point)))
+    (let ((argument (command-argument-value argument))
+         (point (current-point)))
       (kill-region
        (cond ((not argument)
              (let ((end (line-end point 0)))
@@ -180,15 +183,16 @@ appropriate number of spaces and then one space is deleted."
                (begin
                  (convert-tab-to-spaces! (mark-1+ tab))
                  (forth n)))))))
-    (cond ((not argument)
-          (let ((point (current-point)))
-            (if (char-match-backward #\Tab point)
-                (convert-tab-to-spaces! (mark-1+ point))))
-          (delete-region (mark-1+ (current-point))))
-         ((positive? argument)
-          (kill-region (back argument)))
-         ((negative? argument)
-          (kill-region (forth (- argument)))))))
+    (let ((argument (command-argument-value argument)))
+      (cond ((not argument)
+            (let ((point (current-point)))
+              (if (char-match-backward #\Tab point)
+                  (convert-tab-to-spaces! (mark-1+ point))))
+            (delete-region (mark-1+ (current-point))))
+           ((positive? argument)
+            (kill-region (back argument)))
+           ((negative? argument)
+            (kill-region (forth (- argument))))))))
 
 (define (convert-tab-to-spaces! m1)
   (let ((at-point? (mark= m1 (current-point)))
@@ -228,7 +232,7 @@ Puts point after it and the mark before it.
 A positive argument N says un-kill the N'th most recent
 string of killed stuff (1 = most recent).  A null
 argument (just C-U) means leave point before, mark after."
-  "p"
+  "P"
   (lambda (argument)
     (let ((ring (current-kill-ring)))
       (define (pop-loop n)
@@ -236,11 +240,13 @@ argument (just C-U) means leave point before, mark after."
            (begin (ring-pop! ring)
                   (pop-loop (-1+ n)))))
       (if (ring-empty? ring) (editor-error "Nothing to un-kill"))
-      (cond ((command-argument-multiplier-only?)
-            (unkill (ring-ref ring 0)))
-           ((positive? argument)
-            (pop-loop argument)
-            (unkill-reversed (ring-ref ring 0)))))
+      (if (command-argument-multiplier-only? argument)
+         (unkill (ring-ref ring 0))
+         (let ((argument (command-argument-numeric-value argument)))
+           (if (positive? argument)
+               (begin
+                 (pop-loop argument)
+                 (unkill-reversed (ring-ref ring 0)))))))
     (set-command-message! un-kill-tag)))
 
 (define-command yank-pop
@@ -287,13 +293,13 @@ it later will not affect existing buffers."
 With no \\[universal-argument]'s, pushes point as the mark.
 With one \\[universal-argument], pops the mark into point.
 With two \\[universal-argument]'s, pops the mark and throws it away."
-  ()
-  (lambda ()
-    (let ((n (command-argument-multiplier-exponent)))
-      (cond ((zero? n) (push-current-mark! (current-point)))
-           ((= n 1) (set-current-point! (pop-current-mark!)))
-           ((= n 2) (pop-current-mark!))
-           (else (editor-error))))))
+  "P"
+  (lambda (argument)
+    (case (and (command-argument-multiplier-only? argument)
+              (command-argument-value argument))
+      ((4) (set-current-point! (pop-current-mark!)))
+      ((16) (pop-current-mark!))
+      (else (push-current-mark! (current-point))))))
 
 (define-command mark-beginning-of-buffer
   "Set mark at beginning of buffer."
index 5ea81357f8f80a623180c6091e4784b05969becd..c3696d53f2eff29ade0909e6bfd7d1420a616212 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/lincom.scm,v 1.109 1991/04/23 06:41:30 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/lincom.scm,v 1.110 1991/05/02 01:13:31 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -102,7 +102,10 @@ A page boundary is any string in Page Delimiters, at a line's beginning."
   "Put mark at end of page, point at beginning."
   "P"
   (lambda (argument)
-    (let ((end (forward-page (current-point) (1+ (or argument 0)) 'LIMIT)))
+    (let ((end
+          (forward-page (current-point)
+                        (1+ (or (command-argument-value argument) 0))
+                        'LIMIT)))
       (set-current-region! (make-region (backward-page end 1 'LIMIT) end)))))
 
 (define-command narrow-to-page
@@ -239,7 +242,7 @@ With no argument, the mode is toggled."
   (lambda (argument)
     (set-variable! indent-tabs-mode
                   (if argument
-                      (positive? argument)
+                      (positive? (command-argument-value argument))
                       (not (ref-variable indent-tabs-mode))))))
 
 (define-command insert-tab
@@ -349,21 +352,21 @@ A blank line is one containing only spaces and tabs
 An argument inhibits this."
   "P"
   (lambda (argument)
-    (cond ((not argument)
-          (if (line-end? (current-point))
-              (let ((m1 (line-start (current-point) 1)))
-                (if (and m1
-                         (line-blank? m1)
-                         (let ((m2 (line-start m1 1)))
-                           (and m2
-                                (line-blank? m2))))
-                    (begin
-                      (set-current-point! m1)
-                      (delete-horizontal-space))
-                    (insert-newlines 1)))
-              (insert-newlines 1)))
+    (cond (argument
+          (insert-newlines (command-argument-value argument)))
+         ((not (line-end? (current-point)))
+          (insert-newline))
          (else
-          (insert-newlines argument)))))
+          (let ((m1 (line-start (current-point) 1)))
+            (if (and m1
+                     (line-blank? m1)
+                     (let ((m2 (line-start m1 1)))
+                       (and m2
+                            (line-blank? m2))))
+                (begin
+                  (set-current-point! m1)
+                  (delete-horizontal-space))
+                (insert-newlines 1)))))))
 
 (define-command split-line
   "Move rest of this line vertically down.
index f23a3742f73ab25fb5c6eb6ced972539f739438f..c66494fef59e8581fae8c548a09f64d6098ff9e5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/macros.scm,v 1.51 1991/04/21 00:51:18 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/macros.scm,v 1.52 1991/05/02 01:13:38 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
     (variable-name->scheme-name (canonicalize-name name))))
 
 (syntax-table-define edwin-syntax-table 'REF-VARIABLE
-  (lambda (name)
-    `(VARIABLE-VALUE
-      ,(variable-name->scheme-name (canonicalize-name name)))))
+  (lambda (name #!optional buffer)
+    (let ((name (variable-name->scheme-name (canonicalize-name name))))
+      (if (default-object? buffer)
+         `(VARIABLE-VALUE ,name)
+         `(VARIABLE-LOCAL-VALUE ,buffer ,name)))))
 
 (syntax-table-define edwin-syntax-table 'SET-VARIABLE!
   (lambda (name #!optional value)
index 1d85a65c2369247768cded35646166cd24660a10..d2f5a0f7be0e7873078cebfad40a0d37a0b89796 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/make.scm,v 3.40 1991/04/29 10:43:18 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/make.scm,v 3.41 1991/05/02 01:13:45 cph Exp $
 
 Copyright (c) 1989-91 Massachusetts Institute of Technology
 
@@ -37,4 +37,4 @@ MIT in each case. |#
 (declare (usual-integrations))
 
 (package/system-loader "edwin" '() 'QUERY)
-(add-system! (make-system "Edwin" 3 40 '()))
\ No newline at end of file
+(add-system! (make-system "Edwin" 3 41 '()))
\ No newline at end of file
index 35420db439bfb9ba7a6f3ec9e24683faa857831b..2fce9290dd296fd9768c39e47767804c2cb5203c 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/modefs.scm,v 1.124 1991/04/21 00:51:28 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/modefs.scm,v 1.125 1991/05/02 01:13:52 cph Exp $
 ;;;
 ;;;    Copyright (c) 1985, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -84,7 +84,7 @@ and the cdrs of which are major modes."
 (define-key 'fundamental char-set:numeric 'auto-digit-argument)
 (define-key 'fundamental #\- 'auto-negative-argument)
 
-(define-key 'fundamental #\rubout 'backward-delete-char)
+(define-key 'fundamental #\rubout 'delete-backward-char)
 \f
 (define-key 'fundamental #\c-% 'replace-string)
 (define-key 'fundamental #\c-- 'negative-argument)
index 8255219bcc5d7e7d7a502478c34a92887f5ef1be..7a42a85dbe6d1919bcf49193c90870668116c669 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/motcom.scm,v 1.39 1989/04/28 22:51:42 cph Rel $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/motcom.scm,v 1.40 1991/05/02 01:13:59 cph Exp $
 ;;;
-;;;    Copyright (c) 1985, 1989 Massachusetts Institute of Technology
+;;;    Copyright (c) 1985, 1989-91 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -83,11 +83,11 @@ down from the beginning.  Just \\[universal-argument] as arg means go to end."
     (push-current-mark! (current-point))
     (cond ((not argument)
           (set-current-point! (buffer-start (current-buffer))))
-         ((command-argument-multiplier-only?)
+         ((command-argument-multiplier-only? argument)
           (set-current-point! (buffer-end (current-buffer))))
-         ((<= 0 argument 10)
-          (set-current-point! (region-10ths (buffer-region (current-buffer))
-                                            argument))))))
+         ((and (number? argument) (<= 0 argument 10))
+          (set-current-point!
+           (region-10ths (buffer-region (current-buffer)) argument))))))
 
 (define-command end-of-buffer
   "Go to end of buffer (leaving mark behind).
@@ -97,9 +97,10 @@ With arg from 0 to 10, goes up that many tenths of the file from the end."
     (push-current-mark! (current-point))
     (cond ((not argument)
           (set-current-point! (buffer-end (current-buffer))))
-         ((<= 0 argument 10)
-          (set-current-point! (region-10ths (buffer-region (current-buffer))
-                                            (- 10 argument)))))))
+         ((and (number? argument) (<= 0 argument 10))
+          (set-current-point!
+           (region-10ths (buffer-region (current-buffer))
+                         (- 10 argument)))))))
 
 (define (region-10ths region n)
   (mark+ (region-start region)
@@ -162,13 +163,15 @@ Continuation lines are skipped.  If given after the
 last newline in the buffer, makes a new one at the end."
   "P"
   (lambda (argument)
-    (let ((column (current-goal-column)))
+    (let ((argument (command-argument-value argument))
+         (column (current-goal-column)))
       (cond ((not argument)
             (let ((mark (line-start (current-point) 1 false)))
               (if mark
                   (set-current-point! (move-to-column mark column))
-                  (begin (set-current-point! (group-end (current-point)))
-                         (insert-newlines 1)))))
+                  (begin
+                    (set-current-point! (group-end (current-point)))
+                    (insert-newlines 1)))))
            ((not (zero? argument))
             (set-current-point!
              (move-to-column (line-start (current-point) argument 'FAILURE)
index bc004b1e988d3d96aa07890bb9a4ef3da6dc8b99..74f024865c1d51b55b8e64a3881cac2eb53632d2 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/prompt.scm,v 1.139 1990/10/06 00:16:12 cph Rel $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/prompt.scm,v 1.140 1991/05/02 01:14:05 cph Exp $
 ;;;
-;;;    Copyright (c) 1986, 1989, 1990 Massachusetts Institute of Technology
+;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
 (define-variable enable-recursive-minibuffers
   "If true, allow minibuffers to invoke commands which use
 recursive minibuffers."
-  false)
+  false
+  boolean?)
 
 (define-variable completion-auto-help
-  "*True means automatically provide help for invalid completion input."
-  true)
+  "True means automatically provide help for invalid completion input."
+  true
+  boolean?)
 
 (define (prompt-for-typein prompt-string check-recursion? thunk)
   (if (and check-recursion?
@@ -135,19 +137,19 @@ recursive minibuffers."
   (within-typein-edit
    (lambda ()
      (insert-string prompt-string)
-     (with-narrowed-region! (let ((mark (current-point)))
-                             (make-region (mark-right-inserting mark)
-                                          (mark-left-inserting mark)))
-       (lambda ()
-        (intercept-^G-interrupts
-         (lambda ()
-           (cond ((not (eq? (current-window) (typein-window)))
-                  (abort-current-command))
-                 (typein-edit-continuation
-                  (typein-edit-continuation typein-edit-abort-flag))
-                 (else
-                  (error "illegal ^G signaled in typein window"))))
-         thunk))))))
+     (let ((mark (current-point)))
+       (with-text-clipped (mark-right-inserting mark)
+                         (mark-left-inserting mark)
+        (lambda ()
+          (intercept-^G-interrupts
+           (lambda ()
+             (cond ((not (eq? (current-window) (typein-window)))
+                    (abort-current-command))
+                   (typein-edit-continuation
+                    (typein-edit-continuation typein-edit-abort-flag))
+                   (else
+                    (error "illegal ^G signaled in typein window"))))
+           thunk)))))))
 
 (define ((typein-editor-thunk mode))
   (let ((buffer (current-buffer)))
index 765b7a73b6ed0b41cabc267c6d8b7df1c6d525f0..a097cf556f168cd437af88a51a6cf14f71b634cd 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/replaz.scm,v 1.68 1991/04/29 11:23:46 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/replaz.scm,v 1.69 1991/05/02 01:14:17 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -55,7 +55,7 @@
   (let ((source (prompt-for-string name false)))
     (list source
          (prompt-for-string (string-append name " " source " with") false)
-         (command-argument-standard-value))))
+         (command-argument))))
 
  (define-command replace-string
   "Replace occurrences of FROM-STRING with TO-STRING.
index c56313ea5d37bfd46a99acb15bef1b1e12431e8c..d91c5312835881dc458f216f72b24b36b18bf824 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/sendmail.scm,v 1.5 1991/04/24 07:26:09 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/sendmail.scm,v 1.6 1991/05/02 01:14:23 cph Exp $
 ;;;
 ;;;    Copyright (c) 1991 Massachusetts Institute of Technology
 ;;;
@@ -371,10 +371,12 @@ and don't delete any header fields."
                               start)
                (if (not (line-end? end))
                    (insert-newline end))
-               (if (not (command-argument-multiplier-only?))
+               (if (not (command-argument-multiplier-only? argument))
                    (begin
                      (mail-yank-clear-headers start end)
-                     (indent-rigidly start end (or argument 3))))
+                     (indent-rigidly start end
+                                     (or (command-argument-value argument)
+                                         3))))
                (mark-temporary! start)
                (mark-temporary! end)
                (push-current-mark! start)
index 1647f84e8a43c40347e79bbbcc8817b8c38ba7e0..c80ea5c7c98da363a587e389277926d555e14277 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/shell.scm,v 1.2 1991/04/21 00:52:05 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/shell.scm,v 1.3 1991/05/02 01:14:28 cph Exp $
 
 Copyright (c) 1991 Massachusetts Institute of Technology
 
@@ -224,11 +224,13 @@ Otherwise, one argument `-i' is passed to the shell."
   "Turn directory tracking on and off in a shell buffer."
   "P"
   (lambda (argument)
-    (set-variable! shell-dirtrack?
-                  (cond ((not argument) (not (ref-variable shell-dirtrack?)))
-                        ((positive? argument) true)
-                        ((negative? argument) false)
-                        (else (ref-variable shell-dirtrack?))))
+    (set-variable!
+     shell-dirtrack?
+     (let ((argument (command-argument-value argument)))
+       (cond ((not argument) (not (ref-variable shell-dirtrack?)))
+            ((positive? argument) true)
+            ((negative? argument) false)
+            (else (ref-variable shell-dirtrack?)))))
     (message "Directory tracking "
             (if (ref-variable shell-dirtrack?) "on" "off")
             ".")))
\ No newline at end of file
index e41565d95f9e8cc7f2e7ff6ae61a22958823dd35..89661c72ee7de9629702b90da9379d8ec37e706a 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/struct.scm,v 1.77 1991/04/21 00:52:14 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/struct.scm,v 1.78 1991/05/02 01:14:34 cph Exp $
 ;;;
 ;;;    Copyright (c) 1985, 1989-91 Massachusetts Institute of Technology
 ;;;
 (define-integrable (set-group-point! group point)
   (vector-set! group group-index:point (mark-left-inserting-copy point)))
 
-(define (with-narrowed-region! region thunk)
-  (with-group-text-clipped! (region-group region)
-                           (region-start-index region)
-                           (region-end-index region)
+(define (group-absolute-start group)
+  (make-temporary-mark group 0 false))
+
+(define (group-absolute-end group)
+  (make-temporary-mark group (group-length group) true))
+\f
+;;;; Text Clipping
+
+;;; Changes the group's start and end points, but doesn't affect the
+;;; display.
+
+(define (with-text-clipped start end thunk)
+  (if (not (mark<= start end))
+      (error "Marks incorrectly related:" start end))
+  (with-group-text-clipped! (mark-group start)
+                           (mark-index start)
+                           (mark-index end)
                            thunk))
 
+(define (text-clip start end)
+  (if (not (mark<= start end))
+      (error "Marks incorrectly related:" start end))
+  (group-text-clip (mark-group start) (mark-index start) (mark-index end)))
+
 (define (with-group-text-clipped! group start end thunk)
   (let ((old-text-start)
        (old-text-end)
                    (set! new-text-end (group-end-mark group))
                    (vector-set! group group-index:start-mark old-text-start)
                    (vector-set! group group-index:end-mark old-text-end)))))
+
+(define (group-text-clip group start end)
+  (let ((start (make-permanent-mark group start false))
+       (end (make-permanent-mark group end true)))
+    (vector-set! group group-index:start-mark start)
+    (vector-set! group group-index:end-mark end)))
 \f
 (define (invoke-group-daemons! daemons group start end)
   (let loop ((daemons daemons))
 
 (define (group-display-end? mark)
   (group-display-end-index? (mark-group mark) (mark-index mark)))
+
+(define-integrable (mark-absolute-start mark)
+  (group-absolute-start (mark-group mark)))
+
+(define-integrable (mark-absolute-end mark)
+  (group-absolute-end (mark-group mark)))
 \f
 ;;; The next few procedures are simple algorithms that are haired up
 ;;; the wazoo for maximum speed.
index 8be483a312d1c62e78d1eab5f49c3c3c77fc8b87..a1afa88cb1a3a4200264a8f8e6c79e0b29df8365 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/tagutl.scm,v 1.38 1991/04/26 03:14:31 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/tagutl.scm,v 1.39 1991/05/02 01:14:40 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -99,7 +99,7 @@ See documentation of variable tags-file-name."
   false)
 
 (define (find-tag-arguments prompt)
-  (let ((previous-tag? (command-argument-standard-value)))
+  (let ((previous-tag? (command-argument)))
     (if previous-tag?
        (list false true)
        (let ((string (prompt-for-string prompt (find-tag-default))))
@@ -166,8 +166,7 @@ See documentation of variable tags-file-name."
            (set-buffer-point! buffer (line-end tag 0))
            (find-file pathname)
            (let* ((buffer (current-buffer))
-                  (group (buffer-group buffer))
-                  (end (group-end-index group)))
+                  (group (buffer-group buffer)))
              (buffer-widen! buffer)
              (push-current-mark! (current-point))
              (let ((mark
@@ -177,11 +176,13 @@ See documentation of variable tags-file-name."
                             (or (re-search-forward
                                  regexp
                                  (make-mark group index)
-                                 (make-mark group (min (+ start offset) end)))
+                                 (make-mark group
+                                            (min (+ start offset)
+                                                 (group-end-index group))))
                                 (loop (* 3 offset)))
                             (re-search-forward regexp
                                                (make-mark group 0)
-                                               end))))))
+                                               (group-end-mark group)))))))
                (if (not mark)
                    (editor-failure regexp
                                    " not found in "
@@ -227,7 +228,7 @@ See documentation of variable tags-file-name."
            (prompt-for-string
             (string-append "Tags query replace " source " with")
             false)
-           (command-argument-standard-value))))
+           (command-argument))))
   (lambda (source target delimited)
     (set! tags-loop-continuation
          (lambda ()
index 6d89ff01cc3a9d6b3e11b2762a58e9ccba3e1dc1..67a78caa27b0cf9a150fe42f6ae901786b422a90 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/undo.scm,v 1.47 1991/04/21 00:52:26 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/undo.scm,v 1.48 1991/05/02 01:14:45 cph Exp $
 ;;;
 ;;;    Copyright (c) 1985, 1989-91 Massachusetts Institute of Technology
 ;;;
 
 (define (disable-group-undo! group)
   (set-group-undo-data! group false))
+
+(define (with-group-undo-disabled group thunk)
+  (dynamic-wind (lambda () (disable-group-undo! group))
+               thunk
+               (if (group-undo-data group)
+                   (lambda () (enable-group-undo! group))
+                   (lambda () unspecific))))
 \f
 (define (new-undo! undo-data type group start length)
   (let ((records (undo-data-records undo-data))
index 256246c55a77f2a7adb0e70cccd49f0b3796665d..80e9f0a1e243856a0b2f64da37fba63c9a31704f 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/wincom.scm,v 1.99 1990/11/02 03:24:57 cph Rel $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/wincom.scm,v 1.100 1991/05/02 01:14:50 cph Exp $
 ;;;
-;;;    Copyright (c) 1987, 1989, 1990 Massachusetts Institute of Technology
+;;;    Copyright (c) 1987, 1989-91 Massachusetts Institute of Technology
 ;;;
 ;;;    This material was developed by the Scheme project at the
 ;;;    Massachusetts Institute of Technology, Department of
@@ -101,7 +101,8 @@ negative args count from the bottom."
            (update-selected-screen! true))
          (window-scroll-y-absolute!
           window
-          (modulo argument (window-y-size window)))))))
+          (modulo (command-argument-value argument)
+                  (window-y-size window)))))))
 
 (define-command move-to-window-line
   "Position point relative to window.
@@ -116,7 +117,8 @@ negative means relative to bottom of window."
                  window 0
                  (if (not argument)
                      (window-y-center window)
-                     (modulo argument (window-y-size window))))
+                     (modulo (command-argument-value argument)
+                             (window-y-size window))))
                 (window-coordinates->mark
                  window 0
                  (window-mark->y window
@@ -197,8 +199,8 @@ means scroll one screenful down."
            (- (window-y-size window)
               (ref-variable next-screen-context-lines))))
        (cond ((not argument) quantum)
-            ((command-argument-negative-only?) (- quantum))
-            (else argument)))))
+            ((command-argument-negative-only? argument) (- quantum))
+            (else (command-argument-value argument))))))
 
 (define (multi-scroll-window-argument window argument factor)
   (* factor
@@ -206,8 +208,8 @@ means scroll one screenful down."
            (- (window-y-size window)
               (ref-variable next-screen-context-lines))))
        (cond ((not argument) quantum)
-            ((command-argument-negative-only?) (- quantum))
-            (else (* argument quantum))))))
+            ((command-argument-negative-only? argument) (- quantum))
+            (else (* (command-argument-value argument) quantum))))))
 
 (define-command what-cursor-position
   "Print info on cursor position (on screen and within buffer)."
@@ -252,7 +254,8 @@ ARG lines.  No arg means split equally."
   "P"
   (lambda (argument)
     (disallow-typein)
-    (window-split-vertically! (current-window) argument)))
+    (window-split-vertically! (current-window)
+                             (command-argument-value argument))))
 
 (define-command split-window-horizontally
   "Split current window into two windows side by side.
@@ -261,7 +264,8 @@ ARG lines.  No arg means split equally."
   "P"
   (lambda (argument)
     (disallow-typein)
-    (window-split-horizontally! (current-window) argument)))
+    (window-split-horizontally! (current-window)
+                               (command-argument-value argument))))
 
 (define-command enlarge-window
   "Makes current window ARG lines bigger."
@@ -310,7 +314,7 @@ ARG lines.  No arg means split equally."
 
 (define-command other-window
   "Select the ARG'th different window."
-  "P"
+  "p"
   (lambda (argument)
     (select-window (other-window-interactive argument))))
 \f
@@ -543,7 +547,7 @@ Otherwise, the argument is the number of columns desired."
       (let ((window (screen-root-window screen)))
        (send window ':set-size!
              (let ((x-size (screen-x-size screen)))
-               (cond ((command-argument-multiplier-only?)
+               (cond ((command-argument-multiplier-only? argument)
                       x-size)
                      ((not argument)
                       (let ((x-size* (window-x-size window)))
@@ -551,8 +555,9 @@ Otherwise, the argument is the number of columns desired."
                             x-size
                             (min 80 x-size))))
                      (else
-                      (if (< argument 10)
-                          (editor-error "restriction too small: " argument))
-                      (min x-size argument))))
+                      (let ((argument (command-argument-value argument)))
+                        (if (< argument 10)
+                            (editor-error "restriction too small: " argument))
+                        (min x-size argument)))))
              (screen-y-size screen)))
       (update-screen! screen true))))
\ No newline at end of file