emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/fill.el,v


From: Juri Linkov
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/fill.el,v
Date: Thu, 18 Oct 2007 00:06:33 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     07/10/18 00:06:33

Index: fill.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/fill.el,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -b -r1.206 -r1.207
--- fill.el     6 Oct 2007 22:15:10 -0000       1.206
+++ fill.el     18 Oct 2007 00:06:33 -0000      1.207
@@ -752,10 +752,10 @@
     (narrow-to-region (minibuffer-prompt-end) (point-max))
     (fill-paragraph arg)))
 
-(defun fill-paragraph (arg)
+(defun fill-paragraph (&optional justify region)
   "Fill paragraph at or after point.
 
-If ARG is non-nil (interactively, with prefix argument), justify as well.
+If JUSTIFY is non-nil (interactively, with prefix argument), justify as well.
 If `sentence-end-double-space' is non-nil, then period followed by one
 space does not end a sentence, so don't break a line there.
 the variable `fill-column' controls the width for filling.
@@ -763,12 +763,21 @@
 If `fill-paragraph-function' is non-nil, we call it (passing our
 argument to it), and if it returns non-nil, we simply return its value.
 
-If `fill-paragraph-function' is nil, return the `fill-prefix' used for 
filling."
+If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling.
+
+Interactively (when `region' is non-nil) in Transient Mark mode when
+the mark is active, call `fill-region' to fill each of the paragraphs
+in the active region."
   (interactive (progn
                 (barf-if-buffer-read-only)
-                (list (if current-prefix-arg 'full))))
-  ;; First try fill-paragraph-function.
-  (or (and (not (eq fill-paragraph-function t))
+                (list (if current-prefix-arg 'full) t)))
+  (or
+   ;; 1. Fill the region if it is active when called interactively.
+   (and region transient-mark-mode mark-active
+       (not (eq (region-beginning) (region-end)))
+       (fill-region (region-beginning) (region-end) justify))
+   ;; 2. Try fill-paragraph-function.
+   (and (not (eq fill-paragraph-function t))
           (or fill-paragraph-function
               (and (minibufferp (current-buffer))
                    (= 1 (point-min))))
@@ -782,14 +791,14 @@
                 ;; return nil.
                 (fill-paragraph-handle-comment nil)
                 (fill-paragraph-function t))
-            (funcall function arg)))
-      ;; Then try our syntax-aware filling code.
+         (funcall function justify)))
+   ;; 3. Try our syntax-aware filling code.
       (and fill-paragraph-handle-comment
           ;; Our code only handles \n-terminated comments right now.
           comment-start (equal comment-end "")
           (let ((fill-paragraph-handle-comment nil))
-            (fill-comment-paragraph arg)))
-      ;; If it all fails, default to the good ol' text paragraph filling.
+         (fill-comment-paragraph justify)))
+   ;; 4. If it all fails, default to the good ol' text paragraph filling.
       (let ((before (point))
            (paragraph-start paragraph-start)
            ;; Fill prefix used for filling the paragraph.
@@ -818,8 +827,8 @@
                        ;; Can't use fill-region-as-paragraph, since this
                        ;; paragraph may still contain hard newlines.  See
                        ;; fill-region.
-                       (fill-region beg end arg)
-                     (fill-region-as-paragraph beg end arg))))))
+                    (fill-region beg end justify)
+                  (fill-region-as-paragraph beg end justify))))))
        fill-pfx)))
 
 (defun fill-comment-paragraph (&optional justify)
@@ -1007,18 +1016,6 @@
          (goto-char end))))
     fill-pfx))
 
-(defun fill-paragraph-or-region (arg)
-  "Fill the active region or current paragraph.
-In Transient Mark mode, when the mark is active, it calls `fill-region'
-on the active region.  Otherwise, it calls `fill-paragraph'."
-  (interactive (progn
-                (barf-if-buffer-read-only)
-                (list (if current-prefix-arg 'full))))
-  (if (and transient-mark-mode mark-active
-          (not (eq (region-beginning) (region-end))))
-      (fill-region (region-beginning) (region-end) arg)
-    (fill-paragraph arg)))
-
 
 (defcustom default-justification 'left
   "*Method of justifying text not otherwise specified.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]