aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1995-07-17 22:50:30 +0000
committerKarl Heuer1995-07-17 22:50:30 +0000
commit34a5f45f7ee50c2b4ff85baf873946744c9f9af2 (patch)
treef625b7c2e866b5112d9a5715506ee7d43614c212
parent51a8e1cc2cce612f45c78f08f477a438781ccbf9 (diff)
downloademacs-34a5f45f7ee50c2b4ff85baf873946744c9f9af2.tar.gz
emacs-34a5f45f7ee50c2b4ff85baf873946744c9f9af2.zip
(canonically-space-region): Doc fix.
(fill-region-as-paragraph): In adaptive-fill-mode, if paragraph has one line, take the fill prefix from it. (adaptive-fill-regexp): Doc fix. (fill-individual-paragraphs): Use `adaptive-fill-regexp' to determine `fill-prefix' if `adaptive-fill-mode' is non-nil.
-rw-r--r--lisp/textmodes/fill.el32
1 files changed, 18 insertions, 14 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 81791f0c506..a384125db90 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -61,7 +61,8 @@ reinserts the fill prefix in each resulting line."
61 "*Regexp to match text at start of line that constitutes indentation. 61 "*Regexp to match text at start of line that constitutes indentation.
62If Adaptive Fill mode is enabled, whatever text matches this pattern 62If Adaptive Fill mode is enabled, whatever text matches this pattern
63on the second line of a paragraph is used as the standard indentation 63on the second line of a paragraph is used as the standard indentation
64for the paragraph.") 64for the paragraph. If the paragraph has just one line, the indentation
65is taken from that line.")
65 66
66(defun current-fill-column () 67(defun current-fill-column ()
67 "Return the fill-column to use for this line. 68 "Return the fill-column to use for this line.
@@ -92,7 +93,7 @@ number equals or exceeds the local fill-column - right-margin difference."
92(defun canonically-space-region (beg end) 93(defun canonically-space-region (beg end)
93 "Remove extra spaces between words in region. 94 "Remove extra spaces between words in region.
94Puts one space between words in region; two between sentences. 95Puts one space between words in region; two between sentences.
95Remove indenation from each line." 96Remove indentation from each line."
96 (interactive "r") 97 (interactive "r")
97 (save-excursion 98 (save-excursion
98 (goto-char beg) 99 (goto-char beg)
@@ -180,17 +181,17 @@ space does not end a sentence, so don't break a line there."
180 (save-excursion 181 (save-excursion
181 (goto-char from) 182 (goto-char from)
182 (if (eolp) (forward-line 1)) 183 (if (eolp) (forward-line 1))
183 (forward-line 1) 184 ;; Move to the second line unless there is just one.
185 (let ((firstline (point)))
186 (forward-line 1)
187 (if (>= (point) to)
188 (goto-char firstline)))
184 (move-to-left-margin) 189 (move-to-left-margin)
185 (if (< (point) to) 190 (let ((start (point)))
186 (let ((start (point))) 191 (re-search-forward adaptive-fill-regexp)
187 (re-search-forward adaptive-fill-regexp) 192 (setq fill-prefix (buffer-substring start (point)))
188 (setq fill-prefix (buffer-substring start (point))) 193 (set-text-properties 0 (length fill-prefix) nil
189 (set-text-properties 0 (length fill-prefix) nil 194 fill-prefix))
190 fill-prefix)))
191 ;; If paragraph has only one line, don't assume in general
192 ;; that additional lines would have the same starting
193 ;; decoration. Assume no indentation.
194 )) 195 ))
195 196
196 (save-restriction 197 (save-restriction
@@ -762,8 +763,11 @@ MAIL-FLAG for a mail message, i. e. don't fill header lines."
762 (if (not (and fill-prefix 763 (if (not (and fill-prefix
763 (looking-at fill-prefix-regexp))) 764 (looking-at fill-prefix-regexp)))
764 (setq fill-prefix 765 (setq fill-prefix
765 (buffer-substring (point) 766 (if (and adaptive-fill-mode adaptive-fill-regexp
766 (save-excursion (skip-chars-forward " \t") (point))) 767 (looking-at (concat "\\(" adaptive-fill-regexp "\\)")))
768 (match-string 1)
769 (buffer-substring (point)
770 (save-excursion (skip-chars-forward " \t") (point))))
767 fill-prefix-regexp 771 fill-prefix-regexp
768 (regexp-quote fill-prefix))) 772 (regexp-quote fill-prefix)))
769 (forward-line 1) 773 (forward-line 1)