]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/fill.el
Merge from pending; try to fix-up suboptimal ses ChangeLog.
[gnu-emacs] / lisp / textmodes / fill.el
index 2dd7b1e2c956e14c4448ceba58667f1e8b7f9921..d0e90c99516806bcccc7accc88151471b668f17d 100644 (file)
@@ -1,7 +1,6 @@
 ;;; fill.el --- fill commands for Emacs                -*- coding: utf-8 -*-
 
-;; Copyright (C) 1985, 1986, 1992, 1994, 1995, 1996, 1997, 1999, 2001,
-;;   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Copyright (C) 1985-1986, 1992, 1994-1997, 1999, 2001-2012
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -83,7 +82,7 @@ reinserts the fill prefix in each resulting line."
       (setq fill-prefix nil)))
   (if fill-prefix
       (message "fill-prefix: \"%s\"" fill-prefix)
-    (message "fill-prefix cancelled")))
+    (message "fill-prefix canceled")))
 
 (defcustom adaptive-fill-mode t
   "Non-nil means determine a paragraph's fill prefix from its text."
@@ -94,7 +93,8 @@ reinserts the fill prefix in each resulting line."
   ;; Added `!' for doxygen comments starting with `//!' or `/*!'.
   ;; Added `%' for TeX comments.
   ;; RMS: deleted the code to match `1.' and `(1)'.
-  (purecopy "[ \t]*\\([-!|#%;>*·•‣⁃◦]+[ \t]*\\)*")
+  ;; Update mail-mode's paragraph-separate if you change this.
+  (purecopy "[ \t]*\\([-–!|#%;>*·•‣⁃◦]+[ \t]*\\)*")
   "Regexp to match text at start of line that constitutes indentation.
 If Adaptive Fill mode is enabled, a prefix matching this pattern
 on the first and second lines of a paragraph is used as the
@@ -384,7 +384,7 @@ and `fill-nobreak-invisible'."
   "Char-table of characters that don't use space between words.")
 
 (progn
-  ;; Register `kinsoku' for scripts HAN, KANA, BOPOMPFO, and CJK-MISS.
+  ;; Register `kinsoku' for scripts HAN, KANA, BOPOMOFO, and CJK-MISC.
   ;; Also tell that they don't use space between words.
   (map-char-table
    #'(lambda (key val)
@@ -470,7 +470,7 @@ Point is moved to just past the fill prefix on the first line."
 
   (goto-char from)
   (if enable-multibyte-characters
-      ;; Delete unnecessay newlines surrounded by words.  The
+      ;; Delete unnecessary newlines surrounded by words.  The
       ;; character category `|' means that we can break a line at the
       ;; character.  And, char-table
       ;; `fill-nospace-between-words-table' tells how to concatenate
@@ -989,7 +989,7 @@ can take care of filling.  JUSTIFY is used as in `fill-paragraph'."
 (defun fill-region (from to &optional justify nosqueeze to-eop)
   "Fill each of the paragraphs in the region.
 A prefix arg means justify as well.
-Ordinarily the variable `fill-column' controls the width.
+The `fill-column' variable controls the width.
 
 Noninteractively, the third argument JUSTIFY specifies which
 kind of justification to do: `full', `left', `right', `center',
@@ -1011,7 +1011,8 @@ space does not end a sentence, so don't break a line there."
                       (if current-prefix-arg 'full))))
   (unless (memq justify '(t nil none full center left right))
     (setq justify 'full))
-  (let (max beg fill-pfx)
+  (let ((start-point (point-marker))
+       max beg fill-pfx)
     (goto-char (max from to))
     (when to-eop
       (skip-chars-backward "\n")
@@ -1042,6 +1043,8 @@ space does not end a sentence, so don't break a line there."
            (setq fill-pfx
                  (fill-region-as-paragraph (point) end justify nosqueeze))
          (goto-char end))))
+    (goto-char start-point)
+    (set-marker start-point nil)
     fill-pfx))
 
 \f
@@ -1055,6 +1058,7 @@ The `justification' text-property can locally override this variable."
                 (const full)
                 (const center)
                 (const none))
+  :safe 'symbolp
   :group 'fill)
 (make-variable-buffer-local 'default-justification)