aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2003-02-12 15:23:21 +0000
committerStefan Monnier2003-02-12 15:23:21 +0000
commit2bcfe15e42085505e0b953098dba7a0970c1ed19 (patch)
tree3a3183d445a101b8468bd9f5955c0add03d021b3
parent5b373bd3f77e143c895bae5ee6d0e227cce269df (diff)
downloademacs-2bcfe15e42085505e0b953098dba7a0970c1ed19.tar.gz
emacs-2bcfe15e42085505e0b953098dba7a0970c1ed19.zip
(fortran-mode): Set comment-use-syntax.
(fortran-fill-paragraph): Use fill-comment-paragraph.
-rw-r--r--lisp/progmodes/fortran.el45
1 files changed, 6 insertions, 39 deletions
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 93a25636657..4552f4a50a0 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -664,8 +664,9 @@ with no args, if that value is non-nil."
664 ;; (concat "\\(\\)\\(![ \t]*\\|" fortran-comment-line-start-skip "\\)") 664 ;; (concat "\\(\\)\\(![ \t]*\\|" fortran-comment-line-start-skip "\\)")
665 "\\(\\)\\(?:^[CcDd*]\\|!\\)\\(?:\\([^ \t\n]\\)\\2+\\)?[ \t]*") 665 "\\(\\)\\(?:^[CcDd*]\\|!\\)\\(?:\\([^ \t\n]\\)\\2+\\)?[ \t]*")
666 (set (make-local-variable 'comment-padding) "$$$") 666 (set (make-local-variable 'comment-padding) "$$$")
667 (make-local-variable 'comment-start) 667 (set (make-local-variable 'comment-start) fortran-comment-line-start)
668 (setq comment-start fortran-comment-line-start) 668 ;; The syntax tables don't understand the column-0 comment-markers.
669 (set (make-local-variable 'comment-use-syntax) nil)
669 (make-local-variable 'require-final-newline) 670 (make-local-variable 'require-final-newline)
670 (setq require-final-newline t) 671 (setq require-final-newline t)
671 (make-local-variable 'abbrev-all-caps) 672 (make-local-variable 'abbrev-all-caps)
@@ -1753,43 +1754,9 @@ file before the end or the first `fortran-analyze-depth' lines."
1753 "Fill surrounding comment block as paragraphs, else fill statement. 1754 "Fill surrounding comment block as paragraphs, else fill statement.
1754Intended as the value of `fill-paragraph-function'." 1755Intended as the value of `fill-paragraph-function'."
1755 (interactive "P") 1756 (interactive "P")
1756 (save-excursion 1757 (or (fill-comment-paragraph justify)
1757 (beginning-of-line) 1758 (fortran-fill-statement)
1758 (if (not (looking-at fortran-comment-line-start-skip)) 1759 t))
1759 (fortran-fill-statement)
1760 ;; We're in a comment block. Find the start and end of a
1761 ;; paragraph, delimited either by non-comment lines or empty
1762 ;; comments. (Get positions as markers, since the
1763 ;; `indent-region' below can shift the block's end).
1764 (let* ((non-empty-comment
1765 (concat fortran-comment-line-start-skip "[^ \t\n]"))
1766 (start (save-excursion
1767 ;; Find (start of) first line.
1768 (while (and (zerop (forward-line -1))
1769 (looking-at non-empty-comment)))
1770 (or (looking-at non-empty-comment)
1771 (forward-line)) ; overshot
1772 (point-marker)))
1773 (end (save-excursion
1774 ;; Find start of first line past region to fill.
1775 (while (progn
1776 (forward-line)
1777 (looking-at non-empty-comment)))
1778 (point-marker))))
1779 ;; Indent the block, find the string comprising the effective
1780 ;; comment start skip and use that as a fill-prefix for
1781 ;; filling the region.
1782 (indent-region start end nil)
1783 (let ((paragraph-ignore-fill-prefix nil)
1784 (fill-prefix (progn
1785 (beginning-of-line)
1786 (looking-at fortran-comment-line-start-skip)
1787 (match-string 0))))
1788 (let (fill-paragraph-function)
1789 (fill-region start end justify))) ; with normal `fill-paragraph'
1790 (set-marker start nil)
1791 (set-marker end nil))))
1792 t)
1793 1760
1794(defun fortran-fill-statement () 1761(defun fortran-fill-statement ()
1795 "Fill a fortran statement up to `fill-column'." 1762 "Fill a fortran statement up to `fill-column'."