Change algorithm used to fix up whitespace after M-^.
authorChris Hanson <org/chris-hanson/cph>
Mon, 4 Nov 1991 20:48:36 +0000 (20:48 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 4 Nov 1991 20:48:36 +0000 (20:48 +0000)
v7/src/edwin/lincom.scm
v7/src/edwin/pasmod.scm

index 0b93f7f50bde38143dc195b7b48897baa88d380d..f7e3eefe06cc5ec4ddfe154ec1a6572f68bf79c3 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/lincom.scm,v 1.115 1991/10/02 08:59:37 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/lincom.scm,v 1.116 1991/11/04 20:44:32 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-91 Massachusetts Institute of Technology
 ;;;
@@ -449,10 +449,9 @@ On nonblank line, delete all blank lines that follow it."
                                     (mark1+ end))))))))))
 
 (define-command delete-indentation
-  "Kill newline and indentation at front of line.
-Leaves one space in place of them.  With argument,
-moves down one line first (killing newline after current line)."
-  "P"
+  "Join this line to previous and fix up whitespace at join.
+With argument, join this line to following line."
+  "*P"
   (lambda (argument)
     (let ((point
           (mark-left-inserting-copy
@@ -465,26 +464,20 @@ moves down one line first (killing newline after current line)."
                 (match-forward fill-prefix point (line-end point 0) false)))
            (if m
                (delete-string point m))))
-      (delete-horizontal-space point)
-      (if (or (line-start? point)
-             (line-end? point)
-             (not (or (char-set-member?
-                       (ref-variable delete-indentation-right-protected)
-                       (mark-left-char point))
-                      (char-set-member?
-                       (ref-variable delete-indentation-left-protected)
-                       (mark-right-char point)))))
-         (insert-char #\space point))
       (mark-temporary! point)
-      (set-current-point! point))))
+      (set-current-point! point))
+    ((ref-command fixup-whitespace))))
 
-(define-variable delete-indentation-right-protected
-  "\\[delete-indentation] won't insert a space to the right of these."
-  (char-set #\( #\,))
-
-(define-variable delete-indentation-left-protected
-  "\\[delete-indentation] won't insert a space to the left of these."
-  (char-set #\)))
+(define-command fixup-whitespace
+  "Fix up white space between objects around point.
+Leave one space or none, according to the context."
+  "*"
+  (lambda ()
+    (delete-horizontal-space)
+    (let ((point (current-point)))
+      (if (not (or (re-match-forward "^\\|\\s)" point)
+                  (re-match-forward "$\\|\\s(\\|\\s'" (mark-1+ point))))
+         (insert-char #\space point)))))
 \f
 ;;;; Tabification
 
index 567548336b5fedf67cb14ba932a4123d9eea70f6..035b78852a4901fa948a59e8c0ee97641b84b6b9 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/pasmod.scm,v 1.43 1990/10/03 04:55:48 cph Rel $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/pasmod.scm,v 1.44 1991/11/04 20:48:36 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989, 1990 Massachusetts Institute of Technology
 ;;;
@@ -64,8 +64,6 @@
   (local-set-variable! comment-end " *)")
   (local-set-variable! paragraph-start "^$")
   (local-set-variable! paragraph-separate (ref-variable "Paragraph Start"))
-  (local-set-variable! delete-indentation-right-protected (char-set #\( #\[))
-  (local-set-variable! delete-indentation-left-protected (char-set #\) #\]))
   (event-distributor/invoke! (ref-variable pascal-mode-hook)))
 
 (define pascal-mode:syntax-table (make-syntax-table))