Define a standard alternative paragraph style in which paragraphs are
authorChris Hanson <org/chris-hanson/cph>
Thu, 2 Mar 2000 05:32:01 +0000 (05:32 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 2 Mar 2000 05:32:01 +0000 (05:32 +0000)
broken by blank lines.  Change all modes that want this style to call
the standard procedure to define it.

v7/src/edwin/c-mode.scm
v7/src/edwin/midas.scm
v7/src/edwin/pasmod.scm
v7/src/edwin/schmod.scm
v7/src/edwin/texcom.scm
v7/src/edwin/tparse.scm
v7/src/edwin/verilog.scm
v7/src/edwin/vhdl.scm

index c1dce0ce667141af8e1c919cfd07804696e8084d..3b3d97059abe2cbc31544113ac879919acfbbd39 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: c-mode.scm,v 1.58 2000/02/29 03:59:38 cph Exp $
+;;; $Id: c-mode.scm,v 1.59 2000/03/02 05:31:58 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
@@ -68,10 +68,7 @@ Settings for K&R and BSD indentation styles are
   (lambda (buffer)
     (local-set-variable! syntax-table c-syntax-table buffer)
     (local-set-variable! syntax-ignore-comments-backwards #t buffer)
-    (let ((paragraph-start
-          (string-append "^$\\|" (ref-variable page-delimiter buffer))))
-      (local-set-variable! paragraph-start paragraph-start buffer)
-      (local-set-variable! paragraph-separate paragraph-start buffer))
+    (standard-alternate-paragraph-style! buffer)
     (local-set-variable! paragraph-ignore-fill-prefix #t buffer)
     (local-set-variable! indent-line-procedure (ref-command c-indent-command)
                         buffer)
index 8da2fde09eebe18041b05ca77630941eb533fc09..c0096c6c478f6f6e2b5bda24ff5ba0a058e6908b 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: midas.scm,v 1.20 2000/02/29 02:47:44 cph Exp $
+;;; $Id: midas.scm,v 1.21 2000/03/02 05:31:48 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
@@ -21,7 +21,7 @@
 ;;;; Midas Mode
 
 (declare (usual-integrations))
-\f
+
 (define-command midas-mode
   "Enter Midas mode."
   ()
@@ -36,9 +36,7 @@
     (local-set-variable! comment-indent-hook midas-comment-indentation buffer)
     (local-set-variable! comment-start ";" buffer)
     (local-set-variable! comment-end "" buffer)
-    (let ((paragraph-start "^$"))
-      (local-set-variable! paragraph-start paragraph-start buffer)
-      (local-set-variable! paragraph-separate paragraph-start buffer))
+    (standard-alternate-paragraph-style! buffer)
     (local-set-variable! indent-line-procedure (ref-command insert-tab) buffer)
     (local-set-variable! local-abbrev-table
                         (ref-variable midas-mode-abbrev-table buffer)
index 2625ee152fc77550f94b576464b3c569a36720b3..e1676b281fcb998a966dd04539c88cc79d9f9a91 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: pasmod.scm,v 1.49 2000/02/29 02:47:51 cph Exp $
+;;; $Id: pasmod.scm,v 1.50 2000/03/02 05:31:51 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
@@ -43,9 +43,7 @@
     (local-set-variable! comment-indent-hook pascal-comment-indentation buffer)
     (local-set-variable! comment-start "(* " buffer)
     (local-set-variable! comment-end " *)" buffer)
-    (let ((paragraph-start "^$"))
-      (local-set-variable! paragraph-start paragraph-start buffer)
-      (local-set-variable! paragraph-separate paragraph-start buffer))
+    (standard-alternate-paragraph-style! buffer)
     (local-set-variable! local-abbrev-table
                         (ref-variable pascal-mode-abbrev-table buffer)
                         buffer)
index d4e0013d994f330a8405cf034b5b2c4b83d8819c..deb580a228d88dcbde2bce91bbf70f50f9a5c1c1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: schmod.scm,v 1.46 2000/02/29 03:59:20 cph Exp $
+;;; $Id: schmod.scm,v 1.47 2000/03/02 05:31:55 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
@@ -54,10 +54,7 @@ The following commands evaluate Scheme expressions:
     (local-set-variable! comment-indent-hook lisp-comment-indentation buffer)
     (local-set-variable! comment-start ";" buffer)
     (local-set-variable! comment-end "" buffer)
-    (let ((separate
-          (string-append "^$\\|" (ref-variable page-delimiter buffer))))
-      (local-set-variable! paragraph-start separate buffer)
-      (local-set-variable! paragraph-separate separate buffer))
+    (standard-alternate-paragraph-style! buffer)
     (local-set-variable! paragraph-ignore-fill-prefix #t buffer)
     (local-set-variable! indent-line-procedure
                         (ref-command lisp-indent-line)
index 58c869f6c5e03f2b888d0251888ddaf28e8b6459..fcd645e07bc526b06fb63f40df5409a322e80a25 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: texcom.scm,v 1.44 2000/02/29 03:59:11 cph Exp $
+;;; $Id: texcom.scm,v 1.45 2000/03/02 05:31:10 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
@@ -26,6 +26,7 @@
   "Major mode for editing english text."
   (lambda (buffer)
     (local-set-variable! syntax-table text-mode:syntax-table buffer)
+    (standard-alternate-paragraph-style! buffer)
     (local-set-variable! local-abbrev-table
                         (ref-variable text-mode-abbrev-table buffer)
                         buffer)
index 0db208c76de21416eb315ad30cf95a7845fe216e..abe5e04dde950314cc4cbfb851e5dcd78d680faf 100644 (file)
@@ -1,8 +1,8 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: tparse.scm,v 1.71 1999/01/02 06:11:34 cph Exp $
+;;; $Id: tparse.scm,v 1.72 2000/03/02 05:32:01 cph Exp $
 ;;;
-;;; Copyright (c) 1986, 1989-1999 Massachusetts Institute of Technology
+;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
 ;;; This program is free software; you can redistribute it and/or
 ;;; modify it under the terms of the GNU General Public License as
@@ -87,7 +87,7 @@ If you change this, you may have to change paragraph-start also."
 (define-variable paragraph-ignore-fill-prefix
   "True means the paragraph commands are not affected by fill-prefix.
 This is desirable in modes where blank lines are the paragraph delimiters."
-  false
+  #f
   boolean?)
 
 (define-integrable (mark/paragraph-start mark)
@@ -98,8 +98,14 @@ This is desirable in modes where blank lines are the paragraph delimiters."
 
 (define (mark/paragraph-fill-prefix mark)
   (if (mark-local-ref mark (ref-variable-object paragraph-ignore-fill-prefix))
-      false
+      #f
       (mark-local-ref mark (ref-variable-object fill-prefix))))
+
+(define (standard-alternate-paragraph-style! buffer)
+  (let ((regexp
+        (string-append "^[ \t]*$\\|" (ref-variable page-delimiter buffer))))
+    (local-set-variable! paragraph-start regexp buffer)
+    (local-set-variable! paragraph-separate regexp buffer)))
 \f
 (define (forward-one-paragraph mark #!optional limit fill-prefix)
   (let ((limit
@@ -126,16 +132,16 @@ This is desirable in modes where blank lines are the paragraph delimiters."
           (let ((separator?
                  (if fill-prefix
                      (lambda (ls)
-                       (let ((fp (match-forward fill-prefix ls end false)))
+                       (let ((fp (match-forward fill-prefix ls end #f)))
                          (if fp
-                             (re-match-forward "[ \t]*$" fp end false)
-                             true)))
+                             (re-match-forward "[ \t]*$" fp end #f)
+                             #t)))
                      (lambda (ls)
-                       (re-match-forward para-separate ls end false)))))
+                       (re-match-forward para-separate ls end #f)))))
             (letrec
                 ((skip-separators
                   (lambda (ls)
-                    (cond ((mark= ls limit) false)
+                    (cond ((mark= ls limit) #f)
                           ((separator? ls) (skip-separators (next-ls ls)))
                           (else (skip-body ls)))))
                  (skip-body
@@ -149,8 +155,7 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                       (lambda (ls)
                         (let ((le (line-end ls 0)))
                           (if (and (mark< le limit)
-                                   (re-search-forward para-start le limit
-                                                      false))
+                                   (re-search-forward para-start le limit #f))
                               (re-match-start 0)
                               limit))))))
               (if (separator? (line-start mark 0))
@@ -181,12 +186,12 @@ This is desirable in modes where blank lines are the paragraph delimiters."
       (let ((separator?
             (if fill-prefix
                 (lambda (ls)
-                  (let ((fp (match-forward fill-prefix ls end false)))
+                  (let ((fp (match-forward fill-prefix ls end #f)))
                     (if fp
-                        (re-match-forward "[ \t]*$" fp end false)
-                        true)))
+                        (re-match-forward "[ \t]*$" fp end #f)
+                        #t)))
                 (lambda (ls)
-                  (re-match-forward para-separate ls end false)))))
+                  (re-match-forward para-separate ls end #f)))))
        (letrec ((skip-separators
                  (lambda (ls)
                    (and (mark< limit ls)
@@ -206,7 +211,7 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                               (re-search-backward para-start
                                                   (line-end ls 0)
                                                   limit
-                                                  false)))
+                                                  #f)))
                          (cond ((not ps)
                                 limit)
                                ((separator? ps)
@@ -253,12 +258,12 @@ This is desirable in modes where blank lines are the paragraph delimiters."
       (let ((separator?
             (if fill-prefix
                 (lambda (ls)
-                  (let ((fp (match-forward fill-prefix ls end false)))
+                  (let ((fp (match-forward fill-prefix ls end #f)))
                     (if fp
-                        (re-match-forward "[ \t]*$" fp end false)
-                        true)))
+                        (re-match-forward "[ \t]*$" fp end #f)
+                        #t)))
                 (lambda (ls)
-                  (re-match-forward para-separate ls end false)))))
+                  (re-match-forward para-separate ls end #f)))))
        (letrec ((skip-separators
                  (lambda (ls)
                    (cond ((not (separator? ls)) (skip-body ls))
@@ -278,7 +283,7 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                               (re-search-backward para-start
                                                   (line-end ls 0)
                                                   start
-                                                  false)))
+                                                  #f)))
                          (cond ((not ps) start)
                                ((separator? ps) (line-start ps 1))
                                (else ps)))))))
@@ -298,21 +303,18 @@ This is desirable in modes where blank lines are the paragraph delimiters."
       (let ((separator?
             (if fill-prefix
                 (lambda (ls)
-                  (let ((fp (match-forward fill-prefix ls end false)))
+                  (let ((fp (match-forward fill-prefix ls end #f)))
                     (if fp
-                        (re-match-forward "[ \t]*$" fp end false)
-                        true)))
+                        (re-match-forward "[ \t]*$" fp end #f)
+                        #t)))
                 (lambda (ls)
-                  (re-match-forward para-separate ls end false)))))
+                  (re-match-forward para-separate ls end #f)))))
        (letrec
            ((skip-separators
              (lambda (ls)
-               (cond ((mark= ls end)
-                      false)
-                     ((separator? ls)
-                      (skip-separators (next-ls ls)))
-                     (else
-                      (skip-body ls)))))
+               (cond ((mark= ls end) #f)
+                     ((separator? ls) (skip-separators (next-ls ls)))
+                     (else (skip-body ls)))))
             (skip-body
              (if fill-prefix
                  (lambda (ls)
@@ -326,8 +328,7 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                    (finish
                     (let ((le (line-end ls 0)))
                       (if (and (mark< le end)
-                               (re-search-forward para-start le end
-                                                  false))
+                               (re-search-forward para-start le end #f))
                           (re-match-start 0)
                           end))))))
             (finish
@@ -363,7 +364,7 @@ All paragraph boundaries also end sentences, regardless."
                              mark
                              (or para-end (group-end mark)))))
       (if mark
-         (skip-chars-backward " \t\n" mark (re-match-start 0) false)
+         (skip-chars-backward " \t\n" mark (re-match-start 0) #f)
          para-end))))
 
 (define (backward-one-sentence mark)
index b53a814ff76df7fcc06681b7bc9e6f3080c7d6e1..57c9f032b2ec794650cfe0ad311a239c1af1f161 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: verilog.scm,v 1.7 2000/02/29 02:47:56 cph Exp $
+;;; $Id: verilog.scm,v 1.8 2000/03/02 05:31:39 cph Exp $
 ;;;
 ;;; Copyright (c) 1996-2000 Massachusetts Institute of Technology
 ;;;
                         buffer)
     (local-set-variable! comment-start "// " buffer)
     (local-set-variable! comment-end "" buffer)
-    (let ((paragraph-start
-          (string-append "^$\\|" (ref-variable page-delimiter buffer))))
-      (local-set-variable! paragraph-start paragraph-start buffer)
-      (local-set-variable! paragraph-separate paragraph-start buffer))
+    (standard-alternate-paragraph-style! buffer)
     (local-set-variable! indent-line-procedure
                         (ref-command keyparser-indent-line)
                         buffer)
index c1d9da0ce8da371ab6a90ace356c3d58ef6f6ed9..d5d7f96c4633ba475ce374ea53ab7311ad63bc39 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: vhdl.scm,v 1.7 2000/02/29 02:47:01 cph Exp $
+;;; $Id: vhdl.scm,v 1.8 2000/03/02 05:31:35 cph Exp $
 ;;;
 ;;; Copyright (c) 1997-2000 Massachusetts Institute of Technology
 ;;;
     (local-set-variable! comment-indent-hook vhdl-comment-indentation buffer)
     (local-set-variable! comment-start "-- " buffer)
     (local-set-variable! comment-end "" buffer)
-    (let ((paragraph-start
-          (string-append "^$\\|" (ref-variable page-delimiter buffer))))
-      (local-set-variable! paragraph-start paragraph-start buffer)
-      (local-set-variable! paragraph-separate paragraph-start buffer))
+    (standard-alternate-paragraph-style! buffer)
     (local-set-variable! indent-line-procedure
                         (ref-command keyparser-indent-line)
                         buffer)