diff lisp/textmodes/fill.el @ 91040:14c4a6aac623

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 866-879) - Merge multi-tty branch - Update from CVS - Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
author Miles Bader <miles@gnu.org>
date Thu, 11 Oct 2007 16:14:00 +0000
parents f55f9811f5d7 8058943a15e4
children 1251cabc40b7
line wrap: on
line diff
--- a/lisp/textmodes/fill.el	Thu Oct 11 01:51:15 2007 +0000
+++ b/lisp/textmodes/fill.el	Thu Oct 11 16:14:00 2007 +0000
@@ -1012,6 +1012,18 @@
 	  (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.