From f2dd9f8beb258d9b547270d766e94e3f030b379f Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 6 Oct 2002 14:52:47 +0000 Subject: [PATCH] (fortran-beginning-do): Ignore labelled DO loops altogether. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/fortran.el | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d183ea2ef89..bc8a784c772 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2002-10-06 Glenn Morris + + * progmodes/fortran.el (fortran-beginning-do): Ignore labelled DO + loops. + 2002-10-01 Kenichi Handa * international/mule-diag.el (describe-coding-system): Describe diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el index 863b71b11fd..8ca65169d55 100644 --- a/lisp/progmodes/fortran.el +++ b/lisp/progmodes/fortran.el @@ -1086,12 +1086,13 @@ Return point or nil." (defun fortran-beginning-do () "Search backwards for first unmatched DO [WHILE]. -Return point or nil." - (let ((case-fold-search t)) +Return point or nil. Ignores labelled DO loops (ie DO 10 ... 10 CONTINUE)." + (let ((case-fold-search t) + (dostart-re "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]")) (if (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9") - (looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+")) + (looking-at dostart-re)) ;; Sitting on one. (match-beginning 0) ;; Search for one. @@ -1103,9 +1104,9 @@ Return point or nil." (not (and (looking-at fortran-end-prog-re) (fortran-check-end-prog-re)))) (skip-chars-forward " \t0-9") - (cond ((looking-at - "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+") + (cond ((looking-at dostart-re) (setq count (1- count))) + ;; Note labelled loop ends not considered. ((looking-at "end[ \t]*do\\b") (setq count (1+ count))))) (and (= count 0) -- 2.39.2