diff options
author | Richard M. Stallman <rms@gnu.org> | 2002-09-18 16:00:29 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2002-09-18 16:00:29 +0000 |
commit | bb5b7758d4a17a17099fc09ff52f5f8e6a8f61a6 (patch) | |
tree | 1676dd6d390d5811ed375fb1ebb27eb7cb6fba4a /lisp/progmodes/make-mode.el | |
parent | e6d4cddda286906a13a7c1c195780d79d785c76c (diff) | |
download | emacs-bb5b7758d4a17a17099fc09ff52f5f8e6a8f61a6.tar.gz |
(makefile-fill-paragraph): Find comment boundaries before filling.
Diffstat (limited to 'lisp/progmodes/make-mode.el')
-rw-r--r-- | lisp/progmodes/make-mode.el | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index 1b2b8e1df72..b2b8b5194e1 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -1,6 +1,6 @@ ;;; make-mode.el --- makefile editing commands for Emacs -;; Copyright (C) 1992,94,99,2000,2001 Free Software Foundation, Inc. +;; Copyright (C) 1992,94,99,2000,2001, 2002 Free Software Foundation, Inc. ;; Author: Thomas Neumann <tom@smart.bo.open.de> ;; Eric S. Raymond <esr@snark.thyrsus.com> @@ -1011,12 +1011,30 @@ definition and conveniently use this command." (beginning-of-line) (cond ((looking-at "^#+ ") - ;; Found a comment. Set the fill prefix and then fill. + ;; Found a comment. Set the fill prefix, and find the paragraph + ;; boundaries by searching for lines that look like comment-only + ;; lines. (let ((fill-prefix (buffer-substring-no-properties (match-beginning 0) (match-end 0))) (fill-paragraph-function nil)) - (fill-paragraph nil) - t)) + (save-excursion + (save-restriction + (narrow-to-region + ;; Search backwards. + (save-excursion + (while (and (zerop (forward-line -1)) + (looking-at "^#"))) + ;; We may have gone too far. Go forward again. + (or (looking-at "^#") + (forward-line 1)) + (point)) + ;; Search forwards. + (save-excursion + (while (looking-at "^#") + (forward-line)) + (point))) + (fill-paragraph nil) + t)))) ;; Must look for backslashed-region before looking for variable ;; assignment. |