# HG changeset patch # User Richard M. Stallman # Date 807388580 0 # Node ID 86c8fb2284defd520ae2b72dd915ffad08f503b7 # Parent f442c14a79c4dd607277ffec9ba49bdb62741f26 (fill-region-as-paragraph): Don't find adaptive-fill-regexp on first line of paragraph if it's a paragraph-separate line. Don't look past the intended line. (adaptive-fill-function): New variable. (fill-region-as-paragraph): Use it. (colon-double-space): New variable. (canonically-space-region): Put two spaces after colon if necessary. diff -r f442c14a79c4 -r 86c8fb2284de lisp/textmodes/fill.el --- a/lisp/textmodes/fill.el Wed Aug 02 18:34:19 1995 +0000 +++ b/lisp/textmodes/fill.el Wed Aug 02 18:36:20 1995 +0000 @@ -37,6 +37,9 @@ (defconst sentence-end-double-space t "*Non-nil means a single space does not end a sentence.") +(defconst colon-double-space nil + "*Non-nil means put two spaces after a colon when filling.") + (defvar fill-paragraph-function nil "Mode-specific function to fill a paragraph.") @@ -64,6 +67,10 @@ for the paragraph. If the paragraph has just one line, the indentation is taken from that line.") +(defun adaptive-fill-function nil + "*Function to call to choose a fill prefix for a paragraph. +This function is used when `adaptive-fill-regexp' does not match.") + (defun current-fill-column () "Return the fill-column to use for this line. The fill-column to use for a buffer is stored in the variable `fill-column', @@ -111,6 +118,8 @@ (skip-chars-backward " ]})\"'") (cond ((and sentence-end-double-space (memq (preceding-char) '(?. ?? ?!))) 2) + ((and colon-double-space + (= (preceding-char) ?:)) 2) ((char-equal (preceding-char) ?\n) 0) (t 1)))) (match-end 0))) @@ -187,12 +196,15 @@ (if (>= (point) to) (goto-char firstline))) (move-to-left-margin) - (let ((start (point))) - (re-search-forward adaptive-fill-regexp) - (setq fill-prefix (buffer-substring start (point))) - (set-text-properties 0 (length fill-prefix) nil - fill-prefix)) - )) + (let ((start (point)) + (eol (save-excursion (end-of-line) (point))) + temp) + (if (not (looking-at paragraph-start)) + (cond ((re-search-forward adaptive-fill-regexp nil t) + (setq fill-prefix + (buffer-substring-no-properties start (point)))) + ((setq temp (funcall adaptive-fill-function)) + (setq fill-prefix temp))))))) (save-restriction (goto-char from)