GNU bug report logs - #19809
24.4; f90-beginning-of-subprogram wrong behavior with string continuation

Previous Next

Package: emacs;

Reported by: Raul Laasner <raullaasner <at> gmail.com>

Date: Sat, 7 Feb 2015 21:01:02 UTC

Severity: minor

Found in version 24.4

Fixed in version 25.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Raul Laasner <raullaasner <at> gmail.com>
Subject: bug#19809: closed (Re: bug#19809: 24.4; f90-beginning-of-subprogram
 wrong behavior with string continuation)
Date: Tue, 24 Feb 2015 07:19:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#19809: 24.4; f90-beginning-of-subprogram wrong behavior with string continuation

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 19809 <at> debbugs.gnu.org.

-- 
19809: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19809
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Glenn Morris <rgm <at> gnu.org>
To: 19809-done <at> debbugs.gnu.org
Subject: Re: bug#19809: 24.4;
 f90-beginning-of-subprogram wrong behavior with string continuation
Date: Tue, 24 Feb 2015 02:18:08 -0500
Version: 25.1

I added some support for this in e8a11db, but I suspect there are more
places where f90.el assumes strings are not continued in that way. It
doesn't seem especially important to me to track them all down.

[Message part 3 (message/rfc822, inline)]
From: Raul Laasner <raullaasner <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.4;
 f90-beginning-of-subprogram wrong behavior with string continuation
Date: Sat, 7 Feb 2015 22:25:10 +0200
[Message part 4 (text/plain, inline)]
The functions f90-beginning-of-subprogram and f90-end-of-subprogram do not
work correctly if the source file contains lines which begin with the
correct keywords but in fact belong to a continued string. For instance, in
the following,

subroutine foo()
  print*, '&
       end subroutine foo'
  ! The cursor is here
end subroutine foo

f90-beginning-of-subprogram jumps past the line containing 'subroutine
foo()'. A similar example could be written for f90-end-of-subprogram. I
propose to put a small check of whether the previous line ended with an
ampersand into the F90 major mode source file:

--- f90.el    2015-02-07 16:50:56.210519581 +0200
+++ f90_new.el    2015-02-07 16:56:44.997174743 +0200
@@ -1619,6 +1619,14 @@
                 (looking-at "[ \t0-9]*\\(!\\|$\\|#\\)")))
     not-last-statement))

+(defsubst f90-test-string-continuation ()
+  "Return true if the the current is a string continuation."
+  (save-excursion
+    (beginning-of-line)
+    (backward-char)
+    (skip-chars-backward " ")
+    (string= (string (char-before)) "&")))
+
 (defun f90-beginning-of-subprogram ()
   "Move point to the beginning of the current subprogram.
 Return (TYPE NAME), or nil if not found."
@@ -1629,9 +1637,13 @@
                 (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))
+      (cond ((and
+          (setq matching-beg (f90-looking-at-program-block-start))
+          (not (f90-test-string-continuation)))
              (setq count (1- count)))
-            ((f90-looking-at-program-block-end)
+            ((and
+          (f90-looking-at-program-block-end)
+          (not (f90-test-string-continuation)))
              (setq count (1+ count)))))
     (beginning-of-line)
     (if (zerop count)
@@ -1654,9 +1666,13 @@
                 (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 ((and
+          (f90-looking-at-program-block-start)
+          (not (f90-test-string-continuation)))
              (setq count (1+ count)))
-            ((setq matching-end (f90-looking-at-program-block-end))
+            ((and
+          (setq matching-end (f90-looking-at-program-block-end))
+          (not (f90-test-string-continuation)))
              (setq count (1- count))))
       (end-of-line))
     ;; This means f90-end-of-subprogram followed by f90-start-of-subprogram


Best wishes,
Raul Laasner

-- 
Raul Laasner
Institute of Physics
University of Tartu
Ravila 14c, 50411, Estonia
e-mail: raullaasner <at> gmail.com
cell: (+372)5182268
[Message part 5 (text/html, inline)]

This bug report was last modified 10 years and 94 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.