]> 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:52:47 +0000 (14:52 +0000)
committerGlenn Morris <rgm@gnu.org>
Sun, 6 Oct 2002 14:52:47 +0000 (14:52 +0000)
lisp/ChangeLog
lisp/progmodes/fortran.el

index d183ea2ef89f5704e873dc5dbe9347cb9794d82d..bc8a784c7726f3e34b2fd3255616aac54a7142ca 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-01  Kenichi Handa  <handa@m17n.org>
 
        * international/mule-diag.el (describe-coding-system): Describe
index 863b71b11fd308bfd4c80f33915316e695c7d392..8ca65169d557c917bf6afa0bdf172a13fdaf9643 100644 (file)
@@ -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)