emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master e8a11db: f90.el: add some support for continued str


From: Glenn Morris
Subject: [Emacs-diffs] master e8a11db: f90.el: add some support for continued strings without leading '&'
Date: Tue, 24 Feb 2015 07:14:05 +0000

branch: master
commit e8a11db943dfc7a469a761f98d606a4072a6ca43
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    f90.el: add some support for continued strings without leading '&'
    
    * lisp/progmodes/f90.el (f90-beginning-of-subprogram)
    (f90-end-of-subprogram, f90-match-end):
    Handle continued strings where the continuation does not start
    with "&" and happens to match our regexp.
    
    * test/automated/f90.el (f90-test-bug-19809): New test.
    
    Fixes: debbugs:19809
---
 lisp/ChangeLog        |    7 +++++++
 lisp/progmodes/f90.el |   14 +++++++++++---
 test/ChangeLog        |    4 ++++
 test/automated/f90.el |   16 ++++++++++++++++
 4 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7e7bbb7..165c1ce 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-24  Glenn Morris  <address@hidden>
+
+       * progmodes/f90.el (f90-beginning-of-subprogram)
+       (f90-end-of-subprogram, f90-match-end):
+       Handle continued strings where the continuation does not start
+       with "&" and happens to match our regexp.  (Bug#19809)
+
 2015-02-24  Bozhidar Batsov  <address@hidden>
 
        * comint.el (comint-clear-buffer): New command.
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index b923819e..6264d3b 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1634,7 +1634,10 @@ Return (TYPE NAME), or nil if not found."
                 (re-search-backward f90-program-block-re nil 'move))
       (beginning-of-line)
       (skip-chars-forward " \t0-9")
-      (cond ((setq matching-beg (f90-looking-at-program-block-start))
+      ;; Check if in string in case using non-standard feature where
+      ;; continued strings do not need "&" at start of continuations.
+      (cond ((f90-in-string))
+            ((setq matching-beg (f90-looking-at-program-block-start))
              (setq count (1- count)))
             ((f90-looking-at-program-block-end)
              (setq count (1+ count)))))
@@ -1659,7 +1662,8 @@ Return (TYPE NAME), or nil if not found."
                 (re-search-forward f90-program-block-re nil 'move))
       (beginning-of-line)
       (skip-chars-forward " \t0-9")
-      (cond ((f90-looking-at-program-block-start)
+      (cond ((f90-in-string))
+            ((f90-looking-at-program-block-start)
              (setq count (1+ count)))
             ((setq matching-end (f90-looking-at-program-block-end))
              (setq count (1- count))))
@@ -2199,8 +2203,12 @@ Leave point at the end of line."
         (end-point (point))
         (case-fold-search t)
         matching-beg beg-name end-name beg-block end-block end-struct)
+    ;; Check if in string in case using non-standard feature where
+    ;; continued strings do not need "&" at start of continuations.
     (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9")
-                          (setq end-struct (f90-looking-at-program-block-end)))
+                          (unless (f90-in-string)
+                            (setq end-struct
+                                  (f90-looking-at-program-block-end))))
       (setq end-block (car end-struct)
             end-name  (cadr end-struct))
       (save-excursion
diff --git a/test/ChangeLog b/test/ChangeLog
index abc582c..7ba1496 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2015-02-24  Glenn Morris  <address@hidden>
+
+       * automated/f90.el (f90-test-bug-19809): New test.
+
 2015-02-22  Michael Albinus  <address@hidden>
 
        * automated/tramp-tests.el (tramp-test17-insert-directory):
diff --git a/test/automated/f90.el b/test/automated/f90.el
index c6bc41f..1cb2f03 100644
--- a/test/automated/f90.el
+++ b/test/automated/f90.el
@@ -173,4 +173,20 @@ end program prog")
     (f90-indent-subprogram)
     (should (= 0 (current-indentation)))))
 
+(ert-deftest f90-test-bug-19809 ()
+  "Test for http://debbugs.gnu.org/19809 ."
+  (with-temp-buffer
+    (f90-mode)
+    ;; The Fortran standard says that continued strings should have
+    ;; '&' at the start of continuation lines, but it seems gfortran
+    ;; allows them to be absent (albeit with a warning).
+    (insert "program prog
+  write (*,*), '&
+end program prog'
+end program prog")
+    (goto-char (point-min))
+    (f90-end-of-subprogram)
+    (should (= (point) (point-max)))))
+
+
 ;;; f90.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]