aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1996-02-21 21:26:11 +0000
committerKarl Heuer1996-02-21 21:26:11 +0000
commit4c06fbeee7679e38fdeb89978749b794703daa35 (patch)
tree6a9e56f1855eefaaf4ae75c79913cba95b72be30
parentc7edd03cbb0d99521bed05d6029998c7e0251124 (diff)
downloademacs-4c06fbeee7679e38fdeb89978749b794703daa35.tar.gz
emacs-4c06fbeee7679e38fdeb89978749b794703daa35.zip
(lisp-fill-paragraph): When filling a comment,
find paragraph bounds by hand, and pass the SQUEEZE-AFTER arg to fill-region-as-paragraph.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el56
1 files changed, 35 insertions, 21 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index ceed10f5af6..df288f9339f 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -740,28 +740,42 @@ and initial semicolons."
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