summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-02-21 21:26:11 +0000
committerKarl Heuer <kwzh@gnu.org>1996-02-21 21:26:11 +0000
commit4c06fbeee7679e38fdeb89978749b794703daa35 (patch)
tree6a9e56f1855eefaaf4ae75c79913cba95b72be30 /lisp/emacs-lisp
parentc7edd03cbb0d99521bed05d6029998c7e0251124 (diff)
downloademacs-4c06fbeee7679e38fdeb89978749b794703daa35.tar.gz
emacs-4c06fbeee7679e38fdeb89978749b794703daa35.tar.bz2
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.
Diffstat (limited to 'lisp/emacs-lisp')
-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."
(fill-paragraph justify)
;; Narrow to include only the comment, and then fill the region.
- (save-restriction
- (beginning-of-line)
- (narrow-to-region
- ;; Find the first line we should include in the region to fill.
- (save-excursion
- (while (and (zerop (forward-line -1))
- (looking-at "^[ \t]*;")))
- ;; We may have gone too far. Go forward again.
- (or (looking-at ".*;")
- (forward-line 1))
- (point))
- ;; Find the beginning of the first line past the region to fill.
- (save-excursion
- (while (progn (forward-line 1)
+ (save-excursion
+ (save-restriction
+ (beginning-of-line)
+ (narrow-to-region
+ ;; Find the first line we should include in the region to fill.
+ (save-excursion
+ (while (and (zerop (forward-line -1))
(looking-at "^[ \t]*;")))
- (point)))
-
- ;; Lines with only semicolons on them can be paragraph boundaries.
- (let ((paragraph-start (concat paragraph-start "\\|[ \t;]*$"))
- (paragraph-separate (concat paragraph-start "\\|[ \t;]*$"))
- (fill-prefix comment-fill-prefix))
- (fill-paragraph justify))))
+ ;; We may have gone too far. Go forward again.
+ (or (looking-at ".*;")
+ (forward-line 1))
+ (point))
+ ;; Find the beginning of the first line past the region to fill.
+ (save-excursion
+ (while (progn (forward-line 1)
+ (looking-at "^[ \t]*;")))
+ (point)))
+
+ ;; Lines with only semicolons on them can be paragraph boundaries.
+ (let* ((paragraph-start (concat paragraph-start "\\|[ \t;]*$"))
+ (paragraph-separate (concat paragraph-start "\\|[ \t;]*$"))
+ (paragraph-ignore-fill-prefix nil)
+ (fill-prefix comment-fill-prefix)
+ (end (progn
+ (forward-paragraph)
+ (or (bolp) (newline 1))
+ (point)))
+ (beg (progn (backward-paragraph) (point))))
+ (fill-region-as-paragraph beg end
+ justify nil
+ (save-excursion
+ (goto-char beg)
+ (if (looking-at fill-prefix)
+ nil
+ (re-search-forward comment-start-skip)
+ (point))))))))
t))