Mercurial > emacs
comparison lisp/progmodes/make-mode.el @ 47527:7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 18 Sep 2002 16:00:29 +0000 |
parents | d00b43e2316c |
children | 2c7b4003c5ad |
comparison
equal
deleted
inserted
replaced
47526:0055228ad95f | 47527:7d7d818ed852 |
---|---|
1 ;;; make-mode.el --- makefile editing commands for Emacs | 1 ;;; make-mode.el --- makefile editing commands for Emacs |
2 | 2 |
3 ;; Copyright (C) 1992,94,99,2000,2001 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992,94,99,2000,2001, 2002 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Thomas Neumann <tom@smart.bo.open.de> | 5 ;; Author: Thomas Neumann <tom@smart.bo.open.de> |
6 ;; Eric S. Raymond <esr@snark.thyrsus.com> | 6 ;; Eric S. Raymond <esr@snark.thyrsus.com> |
7 ;; Maintainer: FSF | 7 ;; Maintainer: FSF |
8 ;; Adapted-By: ESR | 8 ;; Adapted-By: ESR |
1009 ;; specially. | 1009 ;; specially. |
1010 (save-excursion | 1010 (save-excursion |
1011 (beginning-of-line) | 1011 (beginning-of-line) |
1012 (cond | 1012 (cond |
1013 ((looking-at "^#+ ") | 1013 ((looking-at "^#+ ") |
1014 ;; Found a comment. Set the fill prefix and then fill. | 1014 ;; Found a comment. Set the fill prefix, and find the paragraph |
1015 ;; boundaries by searching for lines that look like comment-only | |
1016 ;; lines. | |
1015 (let ((fill-prefix (buffer-substring-no-properties (match-beginning 0) | 1017 (let ((fill-prefix (buffer-substring-no-properties (match-beginning 0) |
1016 (match-end 0))) | 1018 (match-end 0))) |
1017 (fill-paragraph-function nil)) | 1019 (fill-paragraph-function nil)) |
1018 (fill-paragraph nil) | 1020 (save-excursion |
1019 t)) | 1021 (save-restriction |
1022 (narrow-to-region | |
1023 ;; Search backwards. | |
1024 (save-excursion | |
1025 (while (and (zerop (forward-line -1)) | |
1026 (looking-at "^#"))) | |
1027 ;; We may have gone too far. Go forward again. | |
1028 (or (looking-at "^#") | |
1029 (forward-line 1)) | |
1030 (point)) | |
1031 ;; Search forwards. | |
1032 (save-excursion | |
1033 (while (looking-at "^#") | |
1034 (forward-line)) | |
1035 (point))) | |
1036 (fill-paragraph nil) | |
1037 t)))) | |
1020 | 1038 |
1021 ;; Must look for backslashed-region before looking for variable | 1039 ;; Must look for backslashed-region before looking for variable |
1022 ;; assignment. | 1040 ;; assignment. |
1023 ((save-excursion | 1041 ((save-excursion |
1024 (end-of-line) | 1042 (end-of-line) |