comparison lisp/textmodes/fill.el @ 41849:82810216f9a4

(set-justification): Rename arg VALUE to STYLE. (set-justification-left, set-justification-right): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Fri, 07 Dec 2001 03:34:59 +0000
parents 2d1098174c8a
children 2539a7fea37f
comparison
equal deleted inserted replaced
41848:a20c1a3fca7f 41849:82810216f9a4
839 default-justification))) 839 default-justification)))
840 (if (eq 'none j) 840 (if (eq 'none j)
841 nil 841 nil
842 j))) 842 j)))
843 843
844 (defun set-justification (begin end value &optional whole-par) 844 (defun set-justification (begin end style &optional whole-par)
845 "Set the region's justification style. 845 "Set the region's justification style to STYLE.
846 The kind of justification to use is prompted for. 846 This commands prompts for the kind of justification to use.
847 If the mark is not active, this command operates on the current paragraph. 847 If the mark is not active, this command operates on the current paragraph.
848 If the mark is active, the region is used. However, if the beginning and end 848 If the mark is active, it operates on the region. However, if the
849 of the region are not at paragraph breaks, they are moved to the beginning and 849 beginning and end of the region are not at paragraph breaks, they are
850 end of the paragraphs they are in. 850 moved to the beginning and end \(respectively) of the paragraphs they
851 are in.
852
851 If `use-hard-newlines' is true, all hard newlines are taken to be paragraph 853 If `use-hard-newlines' is true, all hard newlines are taken to be paragraph
852 breaks. 854 breaks.
853 855
854 When calling from a program, operates just on region between BEGIN and END, 856 When calling from a program, operates just on region between BEGIN and END,
855 unless optional fourth arg WHOLE-PAR is non-nil. In that case bounds are 857 unless optional fourth arg WHOLE-PAR is non-nil. In that case bounds are
879 (forward-paragraph) 881 (forward-paragraph)
880 (setq end (point)))) 882 (setq end (point))))
881 883
882 (narrow-to-region (point-min) end) 884 (narrow-to-region (point-min) end)
883 (unjustify-region begin (point-max)) 885 (unjustify-region begin (point-max))
884 (put-text-property begin (point-max) 'justification value) 886 (put-text-property begin (point-max) 'justification style)
885 (fill-region begin (point-max) nil t)))) 887 (fill-region begin (point-max) nil t))))
886 888
887 (defun set-justification-none (b e) 889 (defun set-justification-none (b e)
888 "Disable automatic filling for paragraphs in the region. 890 "Disable automatic filling for paragraphs in the region.
889 If the mark is not active, this applies to the current paragraph." 891 If the mark is not active, this applies to the current paragraph."
891 (if mark-active (region-end) (point)))) 893 (if mark-active (region-end) (point))))
892 (set-justification b e 'none t)) 894 (set-justification b e 'none t))
893 895
894 (defun set-justification-left (b e) 896 (defun set-justification-left (b e)
895 "Make paragraphs in the region left-justified. 897 "Make paragraphs in the region left-justified.
898 This means they are flush at the left margin and ragged on the right.
896 This is usually the default, but see the variable `default-justification'. 899 This is usually the default, but see the variable `default-justification'.
897 If the mark is not active, this applies to the current paragraph." 900 If the mark is not active, this applies to the current paragraph."
898 (interactive (list (if mark-active (region-beginning) (point)) 901 (interactive (list (if mark-active (region-beginning) (point))
899 (if mark-active (region-end) (point)))) 902 (if mark-active (region-end) (point))))
900 (set-justification b e 'left t)) 903 (set-justification b e 'left t))
901 904
902 (defun set-justification-right (b e) 905 (defun set-justification-right (b e)
903 "Make paragraphs in the region right-justified. 906 "Make paragraphs in the region right-justified.
904 Flush at the right margin and ragged on the left. 907 This means they are flush at the right margin and ragged on the left.
905 If the mark is not active, this applies to the current paragraph." 908 If the mark is not active, this applies to the current paragraph."
906 (interactive (list (if mark-active (region-beginning) (point)) 909 (interactive (list (if mark-active (region-beginning) (point))
907 (if mark-active (region-end) (point)))) 910 (if mark-active (region-end) (point))))
908 (set-justification b e 'right t)) 911 (set-justification b e 'right t))
909 912