diff options
| author | Glenn Morris | 2015-02-23 23:13:49 -0800 |
|---|---|---|
| committer | Glenn Morris | 2015-02-23 23:13:49 -0800 |
| commit | e8a11db943dfc7a469a761f98d606a4072a6ca43 (patch) | |
| tree | df3dbf44246f94e78b0a204c44a4a13d1d75cecf | |
| parent | eaf9499a7fe485a57ab54c665f0548d4eb1a2e88 (diff) | |
| download | emacs-e8a11db943dfc7a469a761f98d606a4072a6ca43.tar.gz emacs-e8a11db943dfc7a469a761f98d606a4072a6ca43.zip | |
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
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/progmodes/f90.el | 14 | ||||
| -rw-r--r-- | test/ChangeLog | 4 | ||||
| -rw-r--r-- | test/automated/f90.el | 16 |
4 files changed, 38 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7e7bbb7486a..165c1ce96de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2015-02-24 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/f90.el (f90-beginning-of-subprogram) | ||
| 4 | (f90-end-of-subprogram, f90-match-end): | ||
| 5 | Handle continued strings where the continuation does not start | ||
| 6 | with "&" and happens to match our regexp. (Bug#19809) | ||
| 7 | |||
| 1 | 2015-02-24 Bozhidar Batsov <bozhidar@batsov.com> | 8 | 2015-02-24 Bozhidar Batsov <bozhidar@batsov.com> |
| 2 | 9 | ||
| 3 | * comint.el (comint-clear-buffer): New command. | 10 | * comint.el (comint-clear-buffer): New command. |
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index b923819ebb3..6264d3b7b82 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el | |||
| @@ -1634,7 +1634,10 @@ Return (TYPE NAME), or nil if not found." | |||
| 1634 | (re-search-backward f90-program-block-re nil 'move)) | 1634 | (re-search-backward f90-program-block-re nil 'move)) |
| 1635 | (beginning-of-line) | 1635 | (beginning-of-line) |
| 1636 | (skip-chars-forward " \t0-9") | 1636 | (skip-chars-forward " \t0-9") |
| 1637 | (cond ((setq matching-beg (f90-looking-at-program-block-start)) | 1637 | ;; Check if in string in case using non-standard feature where |
| 1638 | ;; continued strings do not need "&" at start of continuations. | ||
| 1639 | (cond ((f90-in-string)) | ||
| 1640 | ((setq matching-beg (f90-looking-at-program-block-start)) | ||
| 1638 | (setq count (1- count))) | 1641 | (setq count (1- count))) |
| 1639 | ((f90-looking-at-program-block-end) | 1642 | ((f90-looking-at-program-block-end) |
| 1640 | (setq count (1+ count))))) | 1643 | (setq count (1+ count))))) |
| @@ -1659,7 +1662,8 @@ Return (TYPE NAME), or nil if not found." | |||
| 1659 | (re-search-forward f90-program-block-re nil 'move)) | 1662 | (re-search-forward f90-program-block-re nil 'move)) |
| 1660 | (beginning-of-line) | 1663 | (beginning-of-line) |
| 1661 | (skip-chars-forward " \t0-9") | 1664 | (skip-chars-forward " \t0-9") |
| 1662 | (cond ((f90-looking-at-program-block-start) | 1665 | (cond ((f90-in-string)) |
| 1666 | ((f90-looking-at-program-block-start) | ||
| 1663 | (setq count (1+ count))) | 1667 | (setq count (1+ count))) |
| 1664 | ((setq matching-end (f90-looking-at-program-block-end)) | 1668 | ((setq matching-end (f90-looking-at-program-block-end)) |
| 1665 | (setq count (1- count)))) | 1669 | (setq count (1- count)))) |
| @@ -2199,8 +2203,12 @@ Leave point at the end of line." | |||
| 2199 | (end-point (point)) | 2203 | (end-point (point)) |
| 2200 | (case-fold-search t) | 2204 | (case-fold-search t) |
| 2201 | matching-beg beg-name end-name beg-block end-block end-struct) | 2205 | matching-beg beg-name end-name beg-block end-block end-struct) |
| 2206 | ;; Check if in string in case using non-standard feature where | ||
| 2207 | ;; continued strings do not need "&" at start of continuations. | ||
| 2202 | (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9") | 2208 | (when (save-excursion (beginning-of-line) (skip-chars-forward " \t0-9") |
| 2203 | (setq end-struct (f90-looking-at-program-block-end))) | 2209 | (unless (f90-in-string) |
| 2210 | (setq end-struct | ||
| 2211 | (f90-looking-at-program-block-end)))) | ||
| 2204 | (setq end-block (car end-struct) | 2212 | (setq end-block (car end-struct) |
| 2205 | end-name (cadr end-struct)) | 2213 | end-name (cadr end-struct)) |
| 2206 | (save-excursion | 2214 | (save-excursion |
diff --git a/test/ChangeLog b/test/ChangeLog index abc582c20fa..7ba14964c0a 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2015-02-24 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * automated/f90.el (f90-test-bug-19809): New test. | ||
| 4 | |||
| 1 | 2015-02-22 Michael Albinus <michael.albinus@gmx.de> | 5 | 2015-02-22 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | * automated/tramp-tests.el (tramp-test17-insert-directory): | 7 | * automated/tramp-tests.el (tramp-test17-insert-directory): |
diff --git a/test/automated/f90.el b/test/automated/f90.el index c6bc41f799a..1cb2f035a6b 100644 --- a/test/automated/f90.el +++ b/test/automated/f90.el | |||
| @@ -173,4 +173,20 @@ end program prog") | |||
| 173 | (f90-indent-subprogram) | 173 | (f90-indent-subprogram) |
| 174 | (should (= 0 (current-indentation))))) | 174 | (should (= 0 (current-indentation))))) |
| 175 | 175 | ||
| 176 | (ert-deftest f90-test-bug-19809 () | ||
| 177 | "Test for http://debbugs.gnu.org/19809 ." | ||
| 178 | (with-temp-buffer | ||
| 179 | (f90-mode) | ||
| 180 | ;; The Fortran standard says that continued strings should have | ||
| 181 | ;; '&' at the start of continuation lines, but it seems gfortran | ||
| 182 | ;; allows them to be absent (albeit with a warning). | ||
| 183 | (insert "program prog | ||
| 184 | write (*,*), '& | ||
| 185 | end program prog' | ||
| 186 | end program prog") | ||
| 187 | (goto-char (point-min)) | ||
| 188 | (f90-end-of-subprogram) | ||
| 189 | (should (= (point) (point-max))))) | ||
| 190 | |||
| 191 | |||
| 176 | ;;; f90.el ends here | 192 | ;;; f90.el ends here |