summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-10-11 16:14:00 +0000
committerMiles Bader <miles@gnu.org>2007-10-11 16:14:00 +0000
commitecb21060d5c1752d41d7a742be565c59b5fcb855 (patch)
treefadebcd18a69457a1d564f738c3f9bdcf512ab4b /lisp/textmodes/fill.el
parent42af7493ae7e7a14ee508800c7fa75b65a94c143 (diff)
parent58ade22bf16a9ec2ff0aee6c59d8db4d1703e94f (diff)
downloademacs-ecb21060d5c1752d41d7a742be565c59b5fcb855.tar.gz
emacs-ecb21060d5c1752d41d7a742be565c59b5fcb855.tar.bz2
emacs-ecb21060d5c1752d41d7a742be565c59b5fcb855.zip
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
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r--lisp/textmodes/fill.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 48bb176e44c..e0f80b1b118 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -1012,6 +1012,18 @@ space does not end a sentence, so don't break a line there."
(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.