comparison lisp/textmodes/fill.el @ 85069:8058943a15e4

(fill-paragraph-or-region): New function.
author Juri Linkov <juri@jurta.org>
date Sat, 06 Oct 2007 22:15:10 +0000
parents b6d25790aab2
children 8f6c4eb58cdb 14c4a6aac623
comparison
equal deleted inserted replaced
85068:6d4dbcc19e80 85069:8058943a15e4
1004 (if (>= (point) initial) 1004 (if (>= (point) initial)
1005 (setq fill-pfx 1005 (setq fill-pfx
1006 (fill-region-as-paragraph (point) end justify nosqueeze)) 1006 (fill-region-as-paragraph (point) end justify nosqueeze))
1007 (goto-char end)))) 1007 (goto-char end))))
1008 fill-pfx)) 1008 fill-pfx))
1009
1010 (defun fill-paragraph-or-region (arg)
1011 "Fill the active region or current paragraph.
1012 In Transient Mark mode, when the mark is active, it calls `fill-region'
1013 on the active region. Otherwise, it calls `fill-paragraph'."
1014 (interactive (progn
1015 (barf-if-buffer-read-only)
1016 (list (if current-prefix-arg 'full))))
1017 (if (and transient-mark-mode mark-active
1018 (not (eq (region-beginning) (region-end))))
1019 (fill-region (region-beginning) (region-end) arg)
1020 (fill-paragraph arg)))
1009 1021
1010 1022
1011 (defcustom default-justification 'left 1023 (defcustom default-justification 'left
1012 "*Method of justifying text not otherwise specified. 1024 "*Method of justifying text not otherwise specified.
1013 Possible values are `left', `right', `full', `center', or `none'. 1025 Possible values are `left', `right', `full', `center', or `none'.