(defgroup fortran nil
"Fortran mode for Emacs"
+ :link '(custom-manual "(emacs)Fortran")
:group 'languages)
(defgroup fortran-indent nil
message)
(if (save-excursion (beginning-of-line)
(skip-chars-forward " \t0-9")
- (looking-at "end[ \t]*if\\b"))
+ (looking-at "e\\(nd[ \t]*if\\|lse\\([ \t]*if\\)?\\)\\b"))
(progn
(if (not (setq matching-if (fortran-beginning-if)))
(setq message "No matching if.")
(defun fortran-fill ()
(interactive)
- (let* ((opoint (point))
+ (let* ((auto-fill-function #'fortran-do-auto-fill)
+ (opoint (point))
(bol (save-excursion (beginning-of-line) (point)))
(eol (save-excursion (end-of-line) (point)))
(bos (min eol (+ bol (fortran-current-line-indentation))))
(defun fortran-fill-statement ()
"Fill a fortran statement up to `fill-column'."
(interactive)
- (if (not (save-excursion
- (beginning-of-line)
- (or (looking-at "[ \t]*$")
- (looking-at comment-line-start-skip)
- (and comment-start-skip
- (looking-at (concat "[ \t]*" comment-start-skip))))))
- (save-excursion
- ;; Find beginning of statement.
- (fortran-next-statement)
- (fortran-previous-statement)
- ;; Re-indent initially.
- (fortran-indent-line)
- ;; Replace newline plus continuation field plus indentation with
- ;; single space.
- (while (progn
- (forward-line)
- (fortran-remove-continuation)))
- (fortran-previous-statement)))
- (fortran-indent-line))
+ (let ((auto-fill-function #'fortran-do-auto-fill))
+ (if (not (save-excursion
+ (beginning-of-line)
+ (or (looking-at "[ \t]*$")
+ (looking-at comment-line-start-skip)
+ (and comment-start-skip
+ (looking-at (concat "[ \t]*" comment-start-skip))))))
+ (save-excursion
+ ;; Find beginning of statement.
+ (fortran-next-statement)
+ (fortran-previous-statement)
+ ;; Re-indent initially.
+ (fortran-indent-line)
+ ;; Replace newline plus continuation field plus indentation with
+ ;; single space.
+ (while (progn
+ (forward-line)
+ (fortran-remove-continuation)))
+ (fortran-previous-statement)))
+ (fortran-indent-line)))
(provide 'fortran)