From: Chris Hanson Date: Thu, 2 Mar 2000 05:32:01 +0000 (+0000) Subject: Define a standard alternative paragraph style in which paragraphs are X-Git-Tag: 20090517-FFI~4211 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=af8719be4723217a3decf717c4ed1f9f731a6398;p=mit-scheme.git Define a standard alternative paragraph style in which paragraphs are broken by blank lines. Change all modes that want this style to call the standard procedure to define it. --- diff --git a/v7/src/edwin/c-mode.scm b/v7/src/edwin/c-mode.scm index c1dce0ce6..3b3d97059 100644 --- a/v7/src/edwin/c-mode.scm +++ b/v7/src/edwin/c-mode.scm @@ -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) diff --git a/v7/src/edwin/midas.scm b/v7/src/edwin/midas.scm index 8da2fde09..c0096c6c4 100644 --- a/v7/src/edwin/midas.scm +++ b/v7/src/edwin/midas.scm @@ -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)) - + (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) diff --git a/v7/src/edwin/pasmod.scm b/v7/src/edwin/pasmod.scm index 2625ee152..e1676b281 100644 --- a/v7/src/edwin/pasmod.scm +++ b/v7/src/edwin/pasmod.scm @@ -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) diff --git a/v7/src/edwin/schmod.scm b/v7/src/edwin/schmod.scm index d4e0013d9..deb580a22 100644 --- a/v7/src/edwin/schmod.scm +++ b/v7/src/edwin/schmod.scm @@ -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) diff --git a/v7/src/edwin/texcom.scm b/v7/src/edwin/texcom.scm index 58c869f6c..fcd645e07 100644 --- a/v7/src/edwin/texcom.scm +++ b/v7/src/edwin/texcom.scm @@ -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) diff --git a/v7/src/edwin/tparse.scm b/v7/src/edwin/tparse.scm index 0db208c76..abe5e04dd 100644 --- a/v7/src/edwin/tparse.scm +++ b/v7/src/edwin/tparse.scm @@ -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))) (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) diff --git a/v7/src/edwin/verilog.scm b/v7/src/edwin/verilog.scm index b53a814ff..57c9f032b 100644 --- a/v7/src/edwin/verilog.scm +++ b/v7/src/edwin/verilog.scm @@ -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 ;;; @@ -40,10 +40,7 @@ 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) diff --git a/v7/src/edwin/vhdl.scm b/v7/src/edwin/vhdl.scm index c1d9da0ce..d5d7f96c4 100644 --- a/v7/src/edwin/vhdl.scm +++ b/v7/src/edwin/vhdl.scm @@ -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 ;;; @@ -39,10 +39,7 @@ (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)