summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/fortran.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 4b54bb16ed7..dc622e675a1 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -904,10 +904,14 @@ Auto-indent does not happen if a numeric ARG is used."
"Moves point to the end of the current Fortran subprogram."
(interactive)
(let ((case-fold-search t))
- (beginning-of-line 2)
- (re-search-forward fortran-end-prog-re nil 'move)
- (goto-char (match-beginning 0))
- (forward-line)))
+ (if (save-excursion ; on END
+ (beginning-of-line)
+ (looking-at fortran-end-prog-re))
+ (forward-line)
+ (beginning-of-line 2)
+ (re-search-forward fortran-end-prog-re nil 'move)
+ (goto-char (match-beginning 0))
+ (forward-line))))
(defun mark-fortran-subprogram ()
"Put mark at end of Fortran subprogram, point at beginning.