From aef10675bee5bdef01e2389ea2960eb4db146b25 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 2 May 1991 01:14:50 +0000 Subject: [PATCH] * Complete redesign of command argument code. New code more closely 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. --- v7/src/edwin/argred.scm | 298 ++++++++++++-------------------------- v7/src/edwin/autold.scm | 15 +- v7/src/edwin/autosv.scm | 5 +- v7/src/edwin/basic.scm | 53 +++---- v7/src/edwin/bufcom.scm | 6 +- v7/src/edwin/buffer.scm | 14 +- v7/src/edwin/bufmnu.scm | 6 +- v7/src/edwin/comred.scm | 70 +++++---- v7/src/edwin/edwin.pkg | 22 +-- v7/src/edwin/filcom.scm | 94 ++++++------ v7/src/edwin/fileio.scm | 152 +++++++++---------- v7/src/edwin/fill.scm | 11 +- v7/src/edwin/kilcom.scm | 60 ++++---- v7/src/edwin/lincom.scm | 37 ++--- v7/src/edwin/macros.scm | 10 +- v7/src/edwin/make.scm | 4 +- v7/src/edwin/modefs.scm | 4 +- v7/src/edwin/motcom.scm | 27 ++-- v7/src/edwin/prompt.scm | 38 ++--- v7/src/edwin/replaz.scm | 4 +- v7/src/edwin/sendmail.scm | 8 +- v7/src/edwin/shell.scm | 14 +- v7/src/edwin/struct.scm | 40 ++++- v7/src/edwin/tagutl.scm | 15 +- v7/src/edwin/undo.scm | 9 +- v7/src/edwin/wincom.scm | 35 +++-- 26 files changed, 512 insertions(+), 539 deletions(-) diff --git a/v7/src/edwin/argred.scm b/v7/src/edwin/argred.scm index 33bb40bb2..92530db76 100644 --- a/v7/src/edwin/argred.scm +++ b/v7/src/edwin/argred.scm @@ -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 @@ -45,223 +45,113 @@ ;;;; 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. -;;;; 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)))) -;;;; 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?*) - -;;;; 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 diff --git a/v7/src/edwin/autold.scm b/v7/src/edwin/autold.scm index d2e21c68b..574351885 100644 --- a/v7/src/edwin/autold.scm +++ b/v7/src/edwin/autold.scm @@ -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 diff --git a/v7/src/edwin/autosv.scm b/v7/src/edwin/autosv.scm index d627aef4c..0ab336f3f 100644 --- a/v7/src/edwin/autosv.scm +++ b/v7/src/edwin/autosv.scm @@ -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))) diff --git a/v7/src/edwin/basic.scm b/v7/src/edwin/basic.scm index 4231466e4..4138523e6 100644 --- a/v7/src/edwin/basic.scm +++ b/v7/src/edwin/basic.scm @@ -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 ;;; @@ -51,11 +51,12 @@ 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))))) (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 diff --git a/v7/src/edwin/bufcom.scm b/v7/src/edwin/bufcom.scm index 4cd7934de..d98764f4f 100644 --- a/v7/src/edwin/bufcom.scm +++ b/v7/src/edwin/bufcom.scm @@ -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 diff --git a/v7/src/edwin/buffer.scm b/v7/src/edwin/buffer.scm index b2396607e..1d8f0cc2a 100644 --- a/v7/src/edwin/buffer.scm +++ b/v7/src/edwin/buffer.scm @@ -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)) - + (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)) - + (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)) - + (define-integrable (buffer-visible? buffer) (not (null? (buffer-windows buffer)))) diff --git a/v7/src/edwin/bufmnu.scm b/v7/src/edwin/bufmnu.scm index 5b700a4f5..e719548c2 100644 --- a/v7/src/edwin/bufmnu.scm +++ b/v7/src/edwin/bufmnu.scm @@ -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) diff --git a/v7/src/edwin/comred.scm b/v7/src/edwin/comred.scm index 53965b3d5..219f5bd28 100644 --- a/v7/src/edwin/comred.scm +++ b/v7/src/edwin/comred.scm @@ -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 @@ -100,8 +102,9 @@ (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 @@ -112,7 +115,11 @@ (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 @@ -121,22 +128,24 @@ 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))) ;;; The procedures for executing commands come in two flavors. The @@ -175,9 +184,21 @@ (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) @@ -211,29 +232,28 @@ (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) @@ -366,13 +386,11 @@ ((#\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) diff --git a/v7/src/edwin/edwin.pkg b/v7/src/edwin/edwin.pkg index b33cb57ed..4b70d7d84 100644 --- a/v7/src/edwin/edwin.pkg +++ b/v7/src/edwin/edwin.pkg @@ -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") diff --git a/v7/src/edwin/filcom.scm b/v7/src/edwin/filcom.scm index 27ee14830..f2f480afe 100644 --- a/v7/src/edwin/filcom.scm +++ b/v7/src/edwin/filcom.scm @@ -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))))))) -(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)))) (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." diff --git a/v7/src/edwin/fileio.scm b/v7/src/edwin/fileio.scm index 39cbf2cf8..085808768 100644 --- a/v7/src/edwin/fileio.scm +++ b/v7/src/edwin/fileio.scm @@ -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 ;;; @@ -163,24 +163,21 @@ (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))))))))))) ) @@ -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) -(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)))))) (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 diff --git a/v7/src/edwin/fill.scm b/v7/src/edwin/fill.scm index 60e68e043..46aa50f0a 100644 --- a/v7/src/edwin/fill.scm +++ b/v7/src/edwin/fill.scm @@ -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)) diff --git a/v7/src/edwin/kilcom.scm b/v7/src/edwin/kilcom.scm index eb9f40270..187e2f891 100644 --- a/v7/src/edwin/kilcom.scm +++ b/v7/src/edwin/kilcom.scm @@ -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 ;;; @@ -106,7 +106,7 @@ ;;;; 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." diff --git a/v7/src/edwin/lincom.scm b/v7/src/edwin/lincom.scm index 5ea81357f..c3696d53f 100644 --- a/v7/src/edwin/lincom.scm +++ b/v7/src/edwin/lincom.scm @@ -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. diff --git a/v7/src/edwin/macros.scm b/v7/src/edwin/macros.scm index f23a3742f..c66494fef 100644 --- a/v7/src/edwin/macros.scm +++ b/v7/src/edwin/macros.scm @@ -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 ;;; @@ -160,9 +160,11 @@ (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) diff --git a/v7/src/edwin/make.scm b/v7/src/edwin/make.scm index 1d85a65c2..d2f5a0f7b 100644 --- a/v7/src/edwin/make.scm +++ b/v7/src/edwin/make.scm @@ -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 diff --git a/v7/src/edwin/modefs.scm b/v7/src/edwin/modefs.scm index 35420db43..2fce9290d 100644 --- a/v7/src/edwin/modefs.scm +++ b/v7/src/edwin/modefs.scm @@ -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) (define-key 'fundamental #\c-% 'replace-string) (define-key 'fundamental #\c-- 'negative-argument) diff --git a/v7/src/edwin/motcom.scm b/v7/src/edwin/motcom.scm index 8255219bc..7a42a85db 100644 --- a/v7/src/edwin/motcom.scm +++ b/v7/src/edwin/motcom.scm @@ -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) diff --git a/v7/src/edwin/prompt.scm b/v7/src/edwin/prompt.scm index bc004b1e9..74f024865 100644 --- a/v7/src/edwin/prompt.scm +++ b/v7/src/edwin/prompt.scm @@ -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 @@ -121,11 +121,13 @@ (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))) diff --git a/v7/src/edwin/replaz.scm b/v7/src/edwin/replaz.scm index 765b7a73b..a097cf556 100644 --- a/v7/src/edwin/replaz.scm +++ b/v7/src/edwin/replaz.scm @@ -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. diff --git a/v7/src/edwin/sendmail.scm b/v7/src/edwin/sendmail.scm index c56313ea5..d91c53128 100644 --- a/v7/src/edwin/sendmail.scm +++ b/v7/src/edwin/sendmail.scm @@ -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) diff --git a/v7/src/edwin/shell.scm b/v7/src/edwin/shell.scm index 1647f84e8..c80ea5c7c 100644 --- a/v7/src/edwin/shell.scm +++ b/v7/src/edwin/shell.scm @@ -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 diff --git a/v7/src/edwin/struct.scm b/v7/src/edwin/struct.scm index e41565d95..89661c72e 100644 --- a/v7/src/edwin/struct.scm +++ b/v7/src/edwin/struct.scm @@ -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 ;;; @@ -205,12 +205,30 @@ (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)) + +;;;; 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) @@ -227,6 +245,12 @@ (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))) (define (invoke-group-daemons! daemons group start end) (let loop ((daemons daemons)) @@ -425,6 +449,12 @@ (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))) ;;; The next few procedures are simple algorithms that are haired up ;;; the wazoo for maximum speed. diff --git a/v7/src/edwin/tagutl.scm b/v7/src/edwin/tagutl.scm index 8be483a31..a1afa88cb 100644 --- a/v7/src/edwin/tagutl.scm +++ b/v7/src/edwin/tagutl.scm @@ -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 () diff --git a/v7/src/edwin/undo.scm b/v7/src/edwin/undo.scm index 6d89ff01c..67a78caa2 100644 --- a/v7/src/edwin/undo.scm +++ b/v7/src/edwin/undo.scm @@ -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 ;;; @@ -91,6 +91,13 @@ (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)))) (define (new-undo! undo-data type group start length) (let ((records (undo-data-records undo-data)) diff --git a/v7/src/edwin/wincom.scm b/v7/src/edwin/wincom.scm index 256246c55..80e9f0a1e 100644 --- a/v7/src/edwin/wincom.scm +++ b/v7/src/edwin/wincom.scm @@ -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)))) @@ -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 -- 2.25.1