changeset 47767:1ad06cb931a9

(fortran-beginning-do): Ignore labelled DO loops altogether.
author Glenn Morris <rgm@gnu.org>
date Sun, 06 Oct 2002 14:56:29 +0000
parents 76b2ec66665d
children 9def08bde21a
files lisp/progmodes/fortran.el
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/fortran.el	Sat Oct 05 23:36:29 2002 +0000
+++ b/lisp/progmodes/fortran.el	Sun Oct 06 14:56:29 2002 +0000
@@ -1104,12 +1104,13 @@
 
 (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.
@@ -1121,9 +1122,9 @@
 		      (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)