Change paragraph-separate and paragraph-start so that they will work
authorChris Hanson <org/chris-hanson/cph>
Wed, 6 Sep 2000 15:15:46 +0000 (15:15 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 6 Sep 2000 15:15:46 +0000 (15:15 +0000)
when not at a line start.  This is necessary so that they interact
properly with fill prefixes.

v7/src/edwin/htmlmode.scm
v7/src/edwin/tparse.scm
v7/src/edwin/tximod.scm

index f9a4f27721431e7a9def28b1e6556b23f84b70e1..1db2af6d3ffcfe5130810effddafebfa8b716c76 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: htmlmode.scm,v 1.3 2000/02/29 03:59:35 cph Exp $
+;;; $Id: htmlmode.scm,v 1.4 2000/09/06 15:15:40 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
 ;;;
@@ -48,7 +48,7 @@
     (event-distributor/invoke! (ref-variable html-mode-hook buffer) buffer)))
 
 (define html-paragraph-separator
-  "^[ \t]*$\\|^[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$")
+  "[ \t]*$\\|[ \t]*</?\\([A-Za-z]\\([-.A-Za-z0-9= \t\n]\\|\"[^\"]*\"\\|'[^']*'\\)*\\)?>$")
 
 (define-command html-mode
   "Enter HTML mode."
index abe5e04dde950314cc4cbfb851e5dcd78d680faf..710a82c87ed8fcfc0d9c684c91932c997f73b0ac 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: tparse.scm,v 1.72 2000/03/02 05:32:01 cph Exp $
+;;; $Id: tparse.scm,v 1.73 2000/09/06 15:15:42 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology
 ;;;
 
 (define-variable paragraph-start
   "Regexp for beginning of a line that starts OR separates paragraphs."
-  "^[ \t\n\f]"
+  "[ \t\n\f]"
   string?)
 
 (define-variable paragraph-separate
   "Regexp for beginning of a line that separates paragraphs.
 If you change this, you may have to change paragraph-start also."
-  "^[ \t\f]*$"
+  "[ \t\f]*$"
   string?)
 
 (define-variable paragraph-ignore-fill-prefix
@@ -102,8 +102,7 @@ This is desirable in modes where blank lines are the paragraph delimiters."
       (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))))
+  (let ((regexp "[ \t\f]*$"))
     (local-set-variable! paragraph-start regexp buffer)
     (local-set-variable! paragraph-separate regexp buffer)))
 \f
@@ -133,9 +132,8 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                  (if fill-prefix
                      (lambda (ls)
                        (let ((fp (match-forward fill-prefix ls end #f)))
-                         (if fp
-                             (re-match-forward "[ \t]*$" fp end #f)
-                             #t)))
+                         (or (not fp)
+                             (re-match-forward para-separate fp end #f))))
                      (lambda (ls)
                        (re-match-forward para-separate ls end #f)))))
             (letrec
@@ -145,19 +143,12 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                           ((separator? ls) (skip-separators (next-ls ls)))
                           (else (skip-body ls)))))
                  (skip-body
-                  (if fill-prefix
-                      (lambda (ls)
-                        (let ((ls (next-ls ls)))
-                          (if (or (mark= ls limit)
-                                  (separator? ls))
-                              ls
-                              (skip-body ls))))
-                      (lambda (ls)
-                        (let ((le (line-end ls 0)))
-                          (if (and (mark< le limit)
-                                   (re-search-forward para-start le limit #f))
-                              (re-match-start 0)
-                              limit))))))
+                  (lambda (ls)
+                    (let ((ls (next-ls ls)))
+                      (if (or (mark= ls limit)
+                              (separator? ls))
+                          ls
+                          (skip-body ls))))))
               (if (separator? (line-start mark 0))
                   (skip-separators (next-ls mark))
                   (skip-body mark))))))))
@@ -187,9 +178,8 @@ This is desirable in modes where blank lines are the paragraph delimiters."
             (if fill-prefix
                 (lambda (ls)
                   (let ((fp (match-forward fill-prefix ls end #f)))
-                    (if fp
-                        (re-match-forward "[ \t]*$" fp end #f)
-                        #t)))
+                    (or (not fp)
+                        (re-match-forward para-separate fp end #f))))
                 (lambda (ls)
                   (re-match-forward para-separate ls end #f)))))
        (letrec ((skip-separators
@@ -200,27 +190,11 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                                 ((mark= ls limit) ls)
                                 (else (skip-body ls)))))))
                 (skip-body
-                 (if fill-prefix
-                     (lambda (ls)
-                       (let ((ls* (prev-ls ls)))
-                         (if (separator? ls*)
-                             ls*
-                             (skip-body ls*))))
-                     (lambda (ls)
-                       (let ((ps
-                              (re-search-backward para-start
-                                                  (line-end ls 0)
-                                                  limit
-                                                  #f)))
-                         (cond ((not ps)
-                                limit)
-                               ((separator? ps)
-                                ps)
-                               (else
-                                (let ((ls (prev-ls ps)))
-                                  (if (separator? ls)
-                                      ls
-                                      ps)))))))))
+                 (lambda (ls)
+                   (let ((ls* (prev-ls ls)))
+                     (if (separator? ls*)
+                         ls*
+                         (skip-body ls*))))))
          (and (mark< limit mark)
               (let ((ls (line-start mark (if (line-start? mark) -1 0))))
                 (and (mark<= limit ls)
@@ -259,9 +233,8 @@ This is desirable in modes where blank lines are the paragraph delimiters."
             (if fill-prefix
                 (lambda (ls)
                   (let ((fp (match-forward fill-prefix ls end #f)))
-                    (if fp
-                        (re-match-forward "[ \t]*$" fp end #f)
-                        #t)))
+                    (or (not fp)
+                        (re-match-forward para-separate fp end #f))))
                 (lambda (ls)
                   (re-match-forward para-separate ls end #f)))))
        (letrec ((skip-separators
@@ -270,23 +243,13 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                          ((mark<= ls start) #f)
                          (else (skip-separators (prev-ls ls))))))
                 (skip-body
-                 (if fill-prefix
-                     (lambda (ls)
-                       (if (mark<= ls start)
-                           start
-                           (let ((ls* (prev-ls ls)))
-                             (if (separator? ls*)
-                                 ls
-                                 (skip-body ls*)))))
-                     (lambda (ls)
-                       (let ((ps
-                              (re-search-backward para-start
-                                                  (line-end ls 0)
-                                                  start
-                                                  #f)))
-                         (cond ((not ps) start)
-                               ((separator? ps) (line-start ps 1))
-                               (else ps)))))))
+                 (lambda (ls)
+                   (if (mark<= ls start)
+                       start
+                       (let ((ls* (prev-ls ls)))
+                         (if (separator? ls*)
+                             ls
+                             (skip-body ls*)))))))
          (skip-separators (line-start mark 0)))))))
 \f
 (define (paragraph-text-end mark)
@@ -304,9 +267,8 @@ This is desirable in modes where blank lines are the paragraph delimiters."
             (if fill-prefix
                 (lambda (ls)
                   (let ((fp (match-forward fill-prefix ls end #f)))
-                    (if fp
-                        (re-match-forward "[ \t]*$" fp end #f)
-                        #t)))
+                    (or (not fp)
+                        (re-match-forward para-separate fp end #f))))
                 (lambda (ls)
                   (re-match-forward para-separate ls end #f)))))
        (letrec
@@ -316,21 +278,13 @@ This is desirable in modes where blank lines are the paragraph delimiters."
                      ((separator? ls) (skip-separators (next-ls ls)))
                      (else (skip-body ls)))))
             (skip-body
-             (if fill-prefix
-                 (lambda (ls)
-                   (finish
-                    (let loop ((ls ls))
-                      (let ((ls (next-ls ls)))
-                        (if (or (mark= ls end) (separator? ls))
-                            ls
-                            (loop ls))))))
-                 (lambda (ls)
-                   (finish
-                    (let ((le (line-end ls 0)))
-                      (if (and (mark< le end)
-                               (re-search-forward para-start le end #f))
-                          (re-match-start 0)
-                          end))))))
+             (lambda (ls)
+               (finish
+                (let loop ((ls ls))
+                  (let ((ls (next-ls ls)))
+                    (if (or (mark= ls end) (separator? ls))
+                        ls
+                        (loop ls)))))))
             (finish
              (lambda (ls)
                (if (and (mark< mark ls) (line-start? ls))
index c3672257c9c903a864e3c5e01e7d39f99c960468..4a6df554961be83fc59188a8f42dfabd81ed8225 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: tximod.scm,v 1.23 2000/02/29 02:47:53 cph Exp $
+;;; $Id: tximod.scm,v 1.24 2000/09/06 15:15:46 cph Exp $
 ;;;
 ;;; Copyright (c) 1987-2000 Massachusetts Institute of Technology
 ;;;
@@ -54,11 +54,11 @@ commands to save keystrokes.
      "^@\\(chapter\\|unnumbered \\|appendix \\|majorheading\\|chapheading\\)"
      buffer)
     (local-set-variable! paragraph-start
-                        (string-append "^\010\\|^@[a-zA-Z]*[ \n]\\|"
+                        (string-append "\010\\|@[a-zA-Z]*[ \n]\\|"
                                        (ref-variable paragraph-start buffer))
                         buffer)
     (local-set-variable! paragraph-separate
-                        (string-append "^\010\\|^@[a-zA-Z]*[ \n]\\|"
+                        (string-append "\010\\|@[a-zA-Z]*[ \n]\\|"
                                        (ref-variable paragraph-separate
                                                      buffer))
                         buffer)