summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r--lisp/textmodes/fill.el44
1 files changed, 24 insertions, 20 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 4113a884c4c..c684a1e2e8f 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -1,7 +1,7 @@
;;; fill.el --- fill commands for Emacs -*- coding: iso-2022-7bit -*-
;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1999, 2001, 2002,
-;; 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;; 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: wp
@@ -748,7 +748,7 @@ space does not end a sentence, so don't break a line there."
(defun fill-minibuffer-function (arg)
"Fill a paragraph in the minibuffer, ignoring the prompt."
- (save-restriction
+ (save-restriction
(narrow-to-region (minibuffer-prompt-end) (point-max))
(fill-paragraph arg)))
@@ -843,18 +843,22 @@ can take care of filling. JUSTIFY is used as in `fill-paragraph'."
(commark
(comment-string-strip (buffer-substring comstart comin) nil t))
(comment-re
- ;; `commark' is surrounded with arbitrary text (`\0' and `a')
- ;; to make sure it can be used as an optimization of
- ;; `comment-start-skip' in the middle of a line. For example,
- ;; `commark' can't be used with the "@c" in TeXinfo (hence
- ;; the `a') or with the "C" at BOL in Fortran (hence the `\0').
- (if (string-match comment-start-skip (concat "\0" commark "a"))
- (concat "[ \t]*" (regexp-quote commark)
- ;; Make sure we only match comments that use
- ;; the exact same comment marker.
- "[^" (substring commark -1) "]")
- (concat "[ \t]*\\(?:" comment-start-skip "\\)")))
- (comment-fill-prefix ; Compute a fill prefix.
+ ;; A regexp more specialized than comment-start-skip, that only
+ ;; matches the current commark rather than any valid commark.
+ ;;
+ ;; The specialized regexp only works for "normal" comment
+ ;; syntax, not for Texinfo's "@c" (which can't be immediately
+ ;; followed by word-chars) or Fortran's "C" (which needs to be
+ ;; at bol), so check that comment-start-skip indeed allows the
+ ;; commark to appear in the middle of the line and followed by
+ ;; word chars. The choice of "\0" and "a" is mostly arbitrary.
+ (if (string-match comment-start-skip (concat "\0" commark "a"))
+ (concat "[ \t]*" (regexp-quote commark)
+ ;; Make sure we only match comments that
+ ;; use the exact same comment marker.
+ "[^" (substring commark -1) "]")
+ (concat "[ \t]*\\(?:" comment-start-skip "\\)")))
+ (comment-fill-prefix ; Compute a fill prefix.
(save-excursion
(goto-char comstart)
(if has-code-and-comment
@@ -949,13 +953,13 @@ Ordinarily the variable `fill-column' controls the width.
Noninteractively, the third argument JUSTIFY specifies which
kind of justification to do: `full', `left', `right', `center',
-or `none' (equivalent to nil). t means handle each paragraph
-as specified by its text properties.
+or `none' (equivalent to nil). A value of t means handle each
+paragraph as specified by its text properties.
-The fourth arg NOSQUEEZE non-nil means to leave
-whitespace other than line breaks untouched, and fifth arg TO-EOP
-non-nil means to keep filling to the end of the paragraph (or next
-hard newline, if variable `use-hard-newlines' is on).
+The fourth arg NOSQUEEZE non-nil means to leave whitespace other
+than line breaks untouched, and fifth arg TO-EOP non-nil means
+to keep filling to the end of the paragraph (or next hard newline,
+if variable `use-hard-newlines' is on).
Return the fill-prefix used for filling the last paragraph.