]> git.eshelyaron.com Git - emacs.git/commitdiff
(fortran-beginning-do): Ignore labelled DO loops altogether.
authorGlenn Morris <rgm@gnu.org>
Sun, 6 Oct 2002 14:57:38 +0000 (14:57 +0000)
committerGlenn Morris <rgm@gnu.org>
Sun, 6 Oct 2002 14:57:38 +0000 (14:57 +0000)
lisp/ChangeLog
lisp/progmodes/fortran.el

index f95feb07b5584dd7ff01471a8931e117ef93175d..2d5865c7c3fa58bf0bf228daf9e0c0fcd7be7aeb 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-06  Glenn Morris  <gmorris@ast.cam.ac.uk>
+
+       * progmodes/fortran.el (fortran-beginning-do): Ignore labelled DO
+       loops.
+
 2002-10-04  Markus Rost  <rost@math.ohio-state.edu>
 
        * vc.el (vc-default-show-log-entry): Fix typo.
index 6d40fe154d22a5b9e21d0f33773cee4f64f77b79..af9f9d1fb1838a84ee025cf6ae8938da55f348d7 100644 (file)
@@ -1104,12 +1104,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.
@@ -1121,9 +1122,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)