1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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
This commit is contained in:
Glenn Morris 2015-02-23 23:13:49 -08:00
parent eaf9499a7f
commit e8a11db943
4 changed files with 38 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2015-02-24 Glenn Morris <rgm@gnu.org>
* 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 <bozhidar@batsov.com>
* comint.el (comint-clear-buffer): New command.

View file

@ -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

View file

@ -1,3 +1,7 @@
2015-02-24 Glenn Morris <rgm@gnu.org>
* automated/f90.el (f90-test-bug-19809): New test.
2015-02-22 Michael Albinus <michael.albinus@gmx.de>
* automated/tramp-tests.el (tramp-test17-insert-directory):

View file

@ -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