Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 14628:c932ad13ccd9
(lisp-fill-paragraph): When filling a comment,
find paragraph bounds by hand, and pass the SQUEEZE-AFTER arg
to fill-region-as-paragraph.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 21 Feb 1996 21:26:11 +0000 (1996-02-21) |
parents | fc4be3d538e0 |
children | d477c6f756df |
comparison
equal
deleted
inserted
replaced
14627:670173a3653b | 14628:c932ad13ccd9 |
---|---|
738 | 738 |
739 (if (not has-comment) | 739 (if (not has-comment) |
740 (fill-paragraph justify) | 740 (fill-paragraph justify) |
741 | 741 |
742 ;; Narrow to include only the comment, and then fill the region. | 742 ;; Narrow to include only the comment, and then fill the region. |
743 (save-restriction | 743 (save-excursion |
744 (beginning-of-line) | 744 (save-restriction |
745 (narrow-to-region | 745 (beginning-of-line) |
746 ;; Find the first line we should include in the region to fill. | 746 (narrow-to-region |
747 (save-excursion | 747 ;; Find the first line we should include in the region to fill. |
748 (while (and (zerop (forward-line -1)) | 748 (save-excursion |
749 (looking-at "^[ \t]*;"))) | 749 (while (and (zerop (forward-line -1)) |
750 ;; We may have gone too far. Go forward again. | |
751 (or (looking-at ".*;") | |
752 (forward-line 1)) | |
753 (point)) | |
754 ;; Find the beginning of the first line past the region to fill. | |
755 (save-excursion | |
756 (while (progn (forward-line 1) | |
757 (looking-at "^[ \t]*;"))) | 750 (looking-at "^[ \t]*;"))) |
758 (point))) | 751 ;; We may have gone too far. Go forward again. |
759 | 752 (or (looking-at ".*;") |
760 ;; Lines with only semicolons on them can be paragraph boundaries. | 753 (forward-line 1)) |
761 (let ((paragraph-start (concat paragraph-start "\\|[ \t;]*$")) | 754 (point)) |
762 (paragraph-separate (concat paragraph-start "\\|[ \t;]*$")) | 755 ;; Find the beginning of the first line past the region to fill. |
763 (fill-prefix comment-fill-prefix)) | 756 (save-excursion |
764 (fill-paragraph justify)))) | 757 (while (progn (forward-line 1) |
758 (looking-at "^[ \t]*;"))) | |
759 (point))) | |
760 | |
761 ;; Lines with only semicolons on them can be paragraph boundaries. | |
762 (let* ((paragraph-start (concat paragraph-start "\\|[ \t;]*$")) | |
763 (paragraph-separate (concat paragraph-start "\\|[ \t;]*$")) | |
764 (paragraph-ignore-fill-prefix nil) | |
765 (fill-prefix comment-fill-prefix) | |
766 (end (progn | |
767 (forward-paragraph) | |
768 (or (bolp) (newline 1)) | |
769 (point))) | |
770 (beg (progn (backward-paragraph) (point)))) | |
771 (fill-region-as-paragraph beg end | |
772 justify nil | |
773 (save-excursion | |
774 (goto-char beg) | |
775 (if (looking-at fill-prefix) | |
776 nil | |
777 (re-search-forward comment-start-skip) | |
778 (point)))))))) | |
765 t)) | 779 t)) |
766 | 780 |
767 | 781 |
768 (defun indent-code-rigidly (start end arg &optional nochange-regexp) | 782 (defun indent-code-rigidly (start end arg &optional nochange-regexp) |
769 "Indent all lines of code, starting in the region, sideways by ARG columns. | 783 "Indent all lines of code, starting in the region, sideways by ARG columns. |