Mercurial > emacs
annotate lisp/progmodes/fortran.el @ 78207:7742aa399ad3
(Writing Calendar Files): cal-tex-diary etc only work
for some calendars.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 24 Jul 2007 02:43:53 +0000 |
parents | e3694f1cb928 |
children | c1ec1c8a8d2e 95d0cdf160ea |
rev | line source |
---|---|
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
1 ;;; fortran.el --- Fortran mode for GNU Emacs |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
2 |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
3 ;; Copyright (C) 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, |
75347 | 4 ;; 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
845 | 5 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
6 ;; Author: Michael D. Prange <prange@erl.mit.edu> |
65919
5c09efcfc1d9
Update maintainer email address.
Glenn Morris <rgm@gnu.org>
parents:
65230
diff
changeset
|
7 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
8 ;; Keywords: fortran, languages |
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
9 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
11 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
14 ;; the Free Software Foundation; either version 2, or (at your option) |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
15 ;; any later version. |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
16 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
20 ;; GNU General Public License for more details. |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
21 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
26 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
27 ;;; Commentary: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
778
diff
changeset
|
28 |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
29 ;; This mode is documented in the Emacs manual. |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
30 ;; |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
31 ;; Note that it is for editing Fortran77 or Fortran90 fixed source |
23754 | 32 ;; form. For editing Fortran 90 free format source, use `f90-mode' |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
33 ;; (f90.el). It is meant to support the GNU Fortran language |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
34 ;; implemented by g77 (its extensions to Fortran77 and |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
35 ;; interpretations, e.g. of blackslash in strings). |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
36 |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
37 ;;; History: |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
38 |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
39 ;; Fortran mode was upgraded by Stephen A. Wood (saw@cebaf.gov). |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
40 |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
41 ;; We acknowledge many contributions and valuable suggestions by |
1548 | 42 ;; Lawrence R. Dodd, Ralf Fassel, Ralph Finch, Stephen Gildea, |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
43 ;; Dr. Anil Gokhale, Ulrich Mueller, Mark Neale, Eric Prestemon, |
1548 | 44 ;; Gary Sabot and Richard Stallman. |
45 | |
14169 | 46 ;;; Code: |
332 | 47 |
23754 | 48 ;; Todo: |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
49 |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
50 ;; * Tidy it all up (more)! |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
51 ;; * Implement insertion and removal of statement continuations in |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
52 ;; mixed f77/f90 style, with the first `&' past column 72 and the |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
53 ;; second in column 6. |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
54 ;; * Support any other extensions to f77 grokked by GNU Fortran I've missed. |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
55 |
68244
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
56 ;; silence compiler |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
57 (defvar dabbrev-case-fold-search) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
58 (defvar font-lock-syntactic-keywords) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
59 (defvar gud-find-expr-function) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
60 (defvar imenu-case-fold-search) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
61 (defvar imenu-syntax-alist) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
62 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
63 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
64 (defgroup fortran nil |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
65 "Major mode for editing fixed format Fortran code." |
66963
a11fdee52c05
Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents:
66635
diff
changeset
|
66 :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) |
a11fdee52c05
Add :link (custom-group-link font-lock-faces) to defgroup.
Juri Linkov <juri@jurta.org>
parents:
66635
diff
changeset
|
67 :link '(custom-manual "(emacs)Fortran") |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
68 :group 'languages) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
69 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
70 (defgroup fortran-indent nil |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
71 "Indentation variables in Fortran mode." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
72 :prefix "fortran-" |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
73 :group 'fortran) |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
74 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
75 (defgroup fortran-comment nil |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
76 "Comment-handling variables in Fortran mode." |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
77 :prefix "fortran-" |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
78 :group 'fortran) |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
79 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
80 |
332 | 81 ;;;###autoload |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
82 (defcustom fortran-tab-mode-default nil |
1485
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
83 "*Default tabbing/carriage control style for empty files in Fortran mode. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
84 A non-nil value specifies tab-digit style of continuation control. |
1485
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
85 A value of nil specifies that continuation lines are marked |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
86 with a character in column 6." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
87 :type 'boolean |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
88 :group 'fortran-indent) |
1485
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
89 |
50600
418cea060d92
(fortran-tab-mode-minor-mode-string): Delete this variable,
Glenn Morris <rgm@gnu.org>
parents:
50598
diff
changeset
|
90 (defcustom fortran-tab-mode-string "/t" |
418cea060d92
(fortran-tab-mode-minor-mode-string): Delete this variable,
Glenn Morris <rgm@gnu.org>
parents:
50598
diff
changeset
|
91 "*String to appear in mode line in TAB format buffers." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
92 :type 'string |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
93 :group 'fortran-indent) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
94 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
95 (defcustom fortran-do-indent 3 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
96 "*Extra indentation applied to DO blocks." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
97 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
98 :group 'fortran-indent) |
332 | 99 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
100 (defcustom fortran-if-indent 3 |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
101 "*Extra indentation applied to IF, SELECT CASE and WHERE blocks." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
102 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
103 :group 'fortran-indent) |
1548 | 104 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
105 (defcustom fortran-structure-indent 3 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
106 "*Extra indentation applied to STRUCTURE, UNION, MAP and INTERFACE blocks." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
107 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
108 :group 'fortran-indent) |
332 | 109 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
110 (defcustom fortran-continuation-indent 5 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
111 "*Extra indentation applied to continuation lines." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
112 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
113 :group 'fortran-indent) |
332 | 114 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
115 (defcustom fortran-comment-indent-style 'fixed |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
116 "*How to indent comments. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
117 nil forces comment lines not to be touched; |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
118 `fixed' indents to `fortran-comment-line-extra-indent' columns beyond |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
119 `fortran-minimum-statement-indent-fixed' (if `indent-tabs-mode' nil), or |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
120 `fortran-minimum-statement-indent-tab' (if `indent-tabs-mode' non-nil); |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
121 `relative' indents to current Fortran indentation plus |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
122 `fortran-comment-line-extra-indent'." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
123 :type '(radio (const :tag "Untouched" nil) (const fixed) (const relative)) |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
124 :group 'fortran-indent) |
332 | 125 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
126 (defcustom fortran-comment-line-extra-indent 0 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
127 "*Amount of extra indentation for text within full-line comments." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
128 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
129 :group 'fortran-indent |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
130 :group 'fortran-comment) |
332 | 131 |
28079
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
132 (defcustom fortran-comment-line-start "C" |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
133 "*Delimiter inserted to start new full-line comment. |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
134 You might want to change this to \"*\", for instance." |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
135 :version "21.1" |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
136 :type 'string |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
137 :group 'fortran-comment) |
332 | 138 |
28079
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
139 ;; This used to match preprocessor lines too, but that messes up |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
140 ;; filling and doesn't seem to be necessary. |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
141 (defcustom fortran-comment-line-start-skip |
33947 | 142 "^[CcDd*!]\\(\\([^ \t\n]\\)\\2+\\)?[ \t]*" |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
143 "*Regexp to match the start of a full-line comment." |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
144 :version "21.1" |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
145 :type 'regexp |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
146 :group 'fortran-comment) |
332 | 147 |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
148 (defcustom fortran-directive-re |
45242
52d991be0698
(fortran-preprocessor-re): New variable. Use it for font-locking.
Glenn Morris <rgm@gnu.org>
parents:
45067
diff
changeset
|
149 "^[ \t]*#.*" |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
150 "*Regexp to match a directive line. |
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
151 The matching text will be fontified with `font-lock-keyword-face'. |
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
152 The matching line will be given zero indentation." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59244
diff
changeset
|
153 :version "22.1" |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
154 :type 'regexp |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
155 :group 'fortran-indent) |
45242
52d991be0698
(fortran-preprocessor-re): New variable. Use it for font-locking.
Glenn Morris <rgm@gnu.org>
parents:
45067
diff
changeset
|
156 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
157 (defcustom fortran-minimum-statement-indent-fixed 6 |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
158 "*Minimum statement indentation for fixed format continuation style." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
159 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
160 :group 'fortran-indent) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
161 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
162 (defcustom fortran-minimum-statement-indent-tab (max tab-width 6) |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
163 "*Minimum statement indentation for TAB format continuation style." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
164 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
165 :group 'fortran-indent) |
332 | 166 |
167 ;; Note that this is documented in the v18 manuals as being a string | |
168 ;; of length one rather than a single character. | |
169 ;; The code in this file accepts either format for compatibility. | |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
170 (defcustom fortran-comment-indent-char " " |
332 | 171 "*Single-character string inserted for Fortran comment indentation. |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
172 Normally a space." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
173 :type 'string |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
174 :group 'fortran-comment) |
332 | 175 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
176 (defcustom fortran-line-number-indent 1 |
332 | 177 "*Maximum indentation for Fortran line numbers. |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
178 5 means right-justify them within their five-column field." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
179 :type 'integer |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
180 :group 'fortran-indent) |
332 | 181 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
182 (defcustom fortran-check-all-num-for-matching-do nil |
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
183 "*Non-nil causes all numbered lines to be treated as possible DO loop ends." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
184 :type 'boolean |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
185 :group 'fortran) |
332 | 186 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
187 (defcustom fortran-blink-matching-if nil |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
188 "*Non-nil causes \\[fortran-indent-line] on ENDIF to blink on matching IF. |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
189 Also, from an ENDDO statement blink on matching DO [WHILE] statement." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
190 :type 'boolean |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
191 :group 'fortran) |
332 | 192 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
193 (defcustom fortran-continuation-string "$" |
1548 | 194 "*Single-character string used for Fortran continuation lines. |
332 | 195 In fixed format continuation style, this character is inserted in |
196 column 6 by \\[fortran-split-line] to begin a continuation line. | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
197 Also, if \\[fortran-indent-line] finds this at the beginning of a |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
198 line, it will convert the line into a continuation line of the |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
199 appropriate style. Normally $." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
200 :type 'string |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
201 :group 'fortran) |
332 | 202 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
203 (defcustom fortran-comment-region "c$$$" |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
204 "*String inserted by \\[fortran-comment-region] at start of each \ |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
205 line in region." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
206 :type 'string |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
207 :group 'fortran-comment) |
332 | 208 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
209 (defcustom fortran-electric-line-number t |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
210 "*Non-nil causes line numbers to be moved to the correct column as typed." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
211 :type 'boolean |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
212 :group 'fortran) |
332 | 213 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
214 (defcustom fortran-column-ruler-fixed |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
215 "0 4 6 10 20 30 40 5\ |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
216 0 60 70\n\ |
11516
e7c26522b881
Use new fortran-match-!-comment to do !-style fontification; do rest in regexps
Simon Marshall <simon@gnu.org>
parents:
10883
diff
changeset
|
217 \[ ]|{ | | | | | | | | \ |
e7c26522b881
Use new fortran-match-!-comment to do !-style fontification; do rest in regexps
Simon Marshall <simon@gnu.org>
parents:
10883
diff
changeset
|
218 \| | | | |}\n" |
21079 | 219 "String displayed above current line by \\[fortran-column-ruler]. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
220 This variable is used in fixed format mode. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
221 See the variable `fortran-column-ruler-tab' for TAB format mode." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
222 :type 'string |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
223 :group 'fortran) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
224 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
225 (defcustom fortran-column-ruler-tab |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
226 "0 810 20 30 40 5\ |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
227 0 60 70\n\ |
11516
e7c26522b881
Use new fortran-match-!-comment to do !-style fontification; do rest in regexps
Simon Marshall <simon@gnu.org>
parents:
10883
diff
changeset
|
228 \[ ]| { | | | | | | | | \ |
e7c26522b881
Use new fortran-match-!-comment to do !-style fontification; do rest in regexps
Simon Marshall <simon@gnu.org>
parents:
10883
diff
changeset
|
229 \| | | | |}\n" |
21079 | 230 "String displayed above current line by \\[fortran-column-ruler]. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
231 This variable is used in TAB format mode. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
232 See the variable `fortran-column-ruler-fixed' for fixed format mode." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
233 :type 'string |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
234 :group 'fortran) |
332 | 235 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
236 (defcustom fortran-analyze-depth 100 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
237 "Number of lines to scan to identify fixed or TAB format style." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
238 :type 'integer |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
239 :group 'fortran) |
332 | 240 |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
241 (defcustom fortran-break-before-delimiters t |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
242 "*Non-nil causes filling to break lines before delimiters. |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
243 Delimiters are characters matching the regexp `fortran-break-delimiters-re'." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
244 :type 'boolean |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
245 :group 'fortran) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
246 |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
247 (defconst fortran-break-delimiters-re "[-+*/><=, \t]" |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
248 "Regexp matching delimiter characters at which lines may be broken. |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
249 There are certain tokens comprised entirely of characters |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
250 matching this regexp that should not be split, and these are |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
251 specified by the constant `fortran-no-break-re'.") |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
252 |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
253 ;; The ">=", etc F77 extensions are supported by g77. |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
254 (defconst fortran-no-break-re |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
255 (regexp-opt '("**" "//" "=>" ">=" "<=" "==" "/=") 'paren) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
256 "Regexp specifying where not to break lines when filling. |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
257 This regexp matches certain tokens comprised entirely of |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
258 characters matching the regexp `fortran-break-delimiters-re' that should |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
259 not be split by filling. Each element is assumed to be two |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
260 characters long.") |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
261 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
262 (defcustom fortran-mode-hook nil |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
263 "Hook run when entering Fortran mode." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
264 :type 'hook |
17413
9fa0ed8da0b1
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
16581
diff
changeset
|
265 :group 'fortran) |
1548 | 266 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
267 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
268 (defvar fortran-if-start-re "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
269 "Regexp matching the start of an IF statement.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
270 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
271 (defvar fortran-end-prog-re1 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
272 "end\ |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
273 \\([ \t]*\\(program\\|subroutine\\|function\\|block[ \t]*data\\)\\>\ |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
274 \\([ \t]*\\(\\sw\\|\\s_\\)+\\)?\\)?" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
275 "Regexp possibly matching the end of a subprogram.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
276 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
277 (defvar fortran-end-prog-re |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
278 (concat "^[ \t0-9]*" fortran-end-prog-re1) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
279 "Regexp possibly matching the end of a subprogram, from the line start. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
280 See also `fortran-end-prog-re1'.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
281 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
282 (defconst fortran-type-types |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
283 (concat "\\<" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
284 (mapconcat 'identity ; " " -> "[ \t]*" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
285 (split-string |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
286 (regexp-opt |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
287 (let ((simple-types |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
288 '("character" "byte" "integer" "logical" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
289 "none" "real" "complex" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
290 "double precision" "double complex")) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
291 (structured-types '("structure" "union" "map")) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
292 (other-types '("record" "dimension" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
293 "parameter" "common" "save" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
294 "external" "intrinsic" "data" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
295 "equivalence"))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
296 (append |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
297 (mapcar (lambda (x) (concat "implicit " x)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
298 simple-types) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
299 simple-types |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
300 (mapcar (lambda (x) (concat "end " x)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
301 structured-types) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
302 structured-types |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
303 other-types)) 'paren)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
304 "[ \t]*") "\\>") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
305 "Regexp matching Fortran types.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
306 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
307 (defvar fortran-font-lock-keywords-1 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
308 ;; Program, subroutine and function declarations, plus calls. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
309 '(("\\<\\(block[ \t]*data\\|call\\|entry\\|function\\|\ |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
310 program\\|subroutine\\)\\>[ \t]*\\(\\sw+\\)?" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
311 (1 font-lock-keyword-face) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
312 (2 font-lock-function-name-face nil t))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
313 "Subdued level highlighting for Fortran mode.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
314 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
315 (defvar fortran-font-lock-keywords-2 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
316 (append fortran-font-lock-keywords-1 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
317 (list |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
318 ;; Fontify all type specifiers (must be first - see below). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
319 (cons fortran-type-types 'font-lock-type-face) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
320 ;; Builtin keywords (except logical, do and goto - see below). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
321 (concat "\\<" (regexp-opt |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
322 '("continue" "format" "end" "enddo" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
323 "if" "then" "else" "endif" "elseif" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
324 "while" "inquire" "stop" "return" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
325 "include" "open" "close" "read" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
326 "write" "format" "print" "select" "case" |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
327 "cycle" "exit" "rewind" "backspace" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
328 "where" "elsewhere") |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
329 'paren) "\\>") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
330 ;; Builtin operators. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
331 (concat "\\." (regexp-opt |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
332 '("and" "or" "not" "lt" "le" "eq" "ge" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
333 "gt" "ne" "true" "false") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
334 'paren) "\\.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
335 ;; do/goto keywords and targets, and goto tags. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
336 '("\\<\\(do\\|go *to\\)\\>[ \t]*\\([0-9]+\\)?" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
337 (1 font-lock-keyword-face) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
338 (2 font-lock-constant-face nil t)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
339 '("^ *\\([0-9]+\\)" . font-lock-constant-face))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
340 "Medium level highlighting for Fortran mode.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
341 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
342 (defvar fortran-font-lock-keywords-3 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
343 (append |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
344 fortran-font-lock-keywords-1 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
345 ;; All type specifiers plus their declared items. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
346 (list |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
347 (list (concat fortran-type-types "[ \t(/]*\\(*\\)?") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
348 ;; Type specifier. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
349 '(1 font-lock-type-face) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
350 ;; Declaration item (or just /.../ block name). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
351 `(font-lock-match-c-style-declaration-item-and-skip-to-next |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
352 ;; Start after any *(...) expression. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
353 (condition-case nil |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
354 (and (match-beginning ,(1+ (regexp-opt-depth |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
355 fortran-type-types))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
356 (forward-sexp) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
357 (forward-sexp)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
358 (error nil)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
359 ;; No need to clean up. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
360 nil |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
361 ;; Fontify as a variable name, functions fontified elsewhere. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
362 (1 font-lock-variable-name-face nil t)))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
363 ;; Things extra to `fortran-font-lock-keywords-3' (must be done first). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
364 (list |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
365 ;; Goto-like `err=label'/`end=label' in read/write statements. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
366 '(", *\\(e\\(nd\\|rr\\)\\)\\> *\\(= *\\([0-9]+\\)\\)?" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
367 (1 font-lock-keyword-face) (4 font-lock-constant-face nil t)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
368 ;; Standard continuation character and in a TAB-formatted line. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
369 '("^ \\{5\\}\\([^ 0\n]\\)" 1 font-lock-string-face) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
370 '("^\t\\([1-9]\\)" 1 font-lock-string-face)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
371 `((,fortran-directive-re (0 font-lock-keyword-face t))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
372 ;; `fortran-font-lock-keywords-2' without types (see above). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
373 (cdr (nthcdr (length fortran-font-lock-keywords-1) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
374 fortran-font-lock-keywords-2))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
375 "Gaudy level highlighting for Fortran mode.") |
332 | 376 |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
377 (defvar fortran-font-lock-keywords-4 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
378 (append fortran-font-lock-keywords-3 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
379 (list (list |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
380 (concat "\\<" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
381 (regexp-opt |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
382 '("int" "ifix" "idint" "real" "float" "sngl" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
383 "dble" "cmplx" "ichar" "char" "aint" "dint" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
384 "anint" "dnint" "nint" "idnint" "iabs" "abs" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
385 "dabs" "cabs" "mod" "amod" "dmod" "isign" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
386 "sign" "dsign" "idim" "dim" "ddim" "dprod" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
387 "max" "max0" "amax1" "dmax1" "amax0" "max1" |
74289
536e4b30fcab
(fortran-font-lock-keywords-4): Add `min'.
Glenn Morris <rgm@gnu.org>
parents:
68244
diff
changeset
|
388 "min" "min0" "amin1" "dmin1" "amin0" "min1" |
536e4b30fcab
(fortran-font-lock-keywords-4): Add `min'.
Glenn Morris <rgm@gnu.org>
parents:
68244
diff
changeset
|
389 "len" "index" "lge" "lgt" "lle" "llt" "aimag" |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
390 "conjg" "sqrt" "dsqrt" "csqrt" "exp" "dexp" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
391 "cexp" "log" "alog" "dlog" "clog" "log10" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
392 "alog10" "dlog10" "sin" "dsin" "csin" "cos" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
393 "dcos" "ccos" "tan" "dtan" "asin" "dasin" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
394 "acos" "dacos" "atan" "datan" "atan2" "datan2" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
395 "sinh" "dsinh" "cosh" "dcosh" "tanh" "dtanh") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
396 'paren) "[ \t]*(") '(1 font-lock-builtin-face)))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
397 "Maximum highlighting for Fortran mode. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
398 Consists of level 3 plus all other intrinsics not already highlighted.") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
399 |
25054
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
400 ;; Comments are real pain in Fortran because there is no way to |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
401 ;; represent the standard comment syntax in an Emacs syntax table. |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
402 ;; (We can do so for F90-style). Therefore an unmatched quote in a |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
403 ;; standard comment will throw fontification off on the wrong track. |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
404 ;; So we do syntactic fontification with regexps. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
405 (defvar fortran-font-lock-syntactic-keywords |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
406 '(("^[cd\\*]" 0 (11)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
407 ("^[^cd\\*\t\n].\\{71\\}\\([^\n]+\\)" 1 (11))) |
25054
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
408 "`font-lock-syntactic-keywords' for Fortran. |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
409 These get fixed-format comments fontified.") |
23616
17ebfb12712f
Fix for fontification of strings lost
Dave Love <fx@gnu.org>
parents:
23607
diff
changeset
|
410 |
12386
ceccff3df349
Specify all Font Lock keywords in font-lock-defaults.
Simon Marshall <simon@gnu.org>
parents:
11801
diff
changeset
|
411 (defvar fortran-font-lock-keywords fortran-font-lock-keywords-1 |
ceccff3df349
Specify all Font Lock keywords in font-lock-defaults.
Simon Marshall <simon@gnu.org>
parents:
11801
diff
changeset
|
412 "Default expressions to highlight in Fortran mode.") |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
413 |
20205
cdaddfc03fe8
(fortran-imenu-generic-expression): New variable.
Dave Love <fx@gnu.org>
parents:
17413
diff
changeset
|
414 (defvar fortran-imenu-generic-expression |
20277
b7f5af6127d5
(fortran-imenu-generic-expression): Match
Dave Love <fx@gnu.org>
parents:
20207
diff
changeset
|
415 ;; These patterns could be confused by sequence nos. in cols 72+ and |
b7f5af6127d5
(fortran-imenu-generic-expression): Match
Dave Love <fx@gnu.org>
parents:
20207
diff
changeset
|
416 ;; don't allow continuations everywhere. |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
417 (list |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
418 (list |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
419 nil |
30186
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
420 ;; [This will be fooled by `end function' allowed by G77. Also, |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
421 ;; it assumes sensible whitespace is employed.] |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
422 (concat |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
423 ;; leading whitespace: |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
424 "^\\s-+\\(" |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
425 ;; function declaration with optional type, e.g. `real', |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
426 ;; `real*4', character(*), `double precision': |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
427 "\\(\\sw\\|\\s-\\|[*()+]\\)*" |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
428 "\\<function\\|subroutine\\|entry\\|block\\s-*data\\|program\\)" |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
429 ;; Possible statement continuation: |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
430 "[ \t" fortran-continuation-string "]+" |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
431 ;; Variable to index: |
835820e0df08
(fortran-imenu-generic-expression): Change definition layout.
Dave Love <fx@gnu.org>
parents:
30149
diff
changeset
|
432 "\\(\\sw+\\)") |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
433 3) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
434 ;; Un-named block data. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
435 '(nil "^\\s-+\\(block\\s-*data\\)\\s-*$" 1)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
436 "Value for `imenu-generic-expression' in Fortran mode.") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
437 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
438 |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
439 ;; Hideshow support. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
440 (defconst fortran-blocks-re |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
441 (concat "block[ \t]*data\\|select[ \t]*case\\|" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
442 (regexp-opt '("do" "if" "interface" "function" "map" "program" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
443 "structure" "subroutine" "union" "where"))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
444 "Regexp potentially indicating the start or end of a Fortran \"block\". |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
445 Omits naked END statements, and DO-loops closed by anything other |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
446 than ENDDO.") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
447 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
448 (defconst fortran-end-block-re |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
449 ;; Do-loops terminated by things other than ENDDO cannot be handled |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
450 ;; with a regexp. This omission does not seem to matter to hideshow... |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
451 (concat "^[ \t0-9]*\\<end[ \t]*\\(" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
452 fortran-blocks-re |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
453 ;; Naked END statement. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
454 "\\|!\\|$\\)") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
455 "Regexp matching the end of a Fortran \"block\", from the line start. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
456 Note that only ENDDO is handled for the end of a DO-loop. Used |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
457 in the Fortran entry in `hs-special-modes-alist'.") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
458 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
459 (defconst fortran-start-block-re |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
460 (concat |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
461 "^[ \t0-9]*\\(" ; statement number |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
462 ;; Structure label for DO, IF, SELECT, WHERE. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
463 "\\(\\(\\sw+[ \t]*:[ \t]*\\)?" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
464 ;; IF blocks are a nuisance: |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
465 ;; IF ( ... ) foo is not a block, but a single statement. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
466 ;; IF ( ... ) THEN can be split over multiple lines. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
467 ;; [So can, eg, a DO WHILE (... ), but that is less common, I hope.] |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
468 ;; The regexp below allows for it to be split over at most 2 lines. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
469 ;; That leads to the problem of not matching two consecutive IF |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
470 ;; statements as one, eg: |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
471 ;; IF ( ... ) foo |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
472 ;; IF ( ... ) THEN |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
473 ;; It simply is not possible to do this in a 100% correct fashion |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
474 ;; using a regexp - see the functions fortran-end-if, |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
475 ;; fortran-beginning-if for the hoops we have to go through. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
476 ;; An alternative is to match on THEN at a line end, eg: |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
477 ;; ".*)[ \t]*then[ \t]*\\($\\|!\\)" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
478 ;; This would also match ELSE branches, though. This does not seem |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
479 ;; right to me, because then one has neighbouring blocks that are |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
480 ;; not nested in each other. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
481 "\\(if[ \t]*(\\(.*\\|" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
482 ".*\n\\([^if]*\\([^i].\\|.[^f]\\|.\\>\\)\\)\\)\\<then\\|" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
483 "do\\|select[ \t]*case\\|where\\)\\)\\|" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
484 (regexp-opt '("interface" "function" "map" "program" |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
485 "structure" "subroutine" "union")) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
486 "\\|block[ \t]*data\\)[ \t]*") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
487 "Regexp matching the start of a Fortran \"block\", from the line start. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
488 A simple regexp cannot do this in fully correct fashion, so this |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
489 tries to strike a compromise between complexity and flexibility. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
490 Used in the Fortran entry in `hs-special-modes-alist'.") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
491 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
492 (add-to-list 'hs-special-modes-alist |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
493 `(fortran-mode ,fortran-start-block-re ,fortran-end-block-re |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
494 "^[cC*!]" fortran-end-of-block nil)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
495 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
496 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
497 (defvar fortran-mode-syntax-table |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
498 (let ((table (make-syntax-table))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
499 ;; We might like `;' to be punctuation (g77 multi-statement |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
500 ;; lines), but that screws abbrevs. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
501 (modify-syntax-entry ?\; "w" table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
502 (modify-syntax-entry ?\r " " table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
503 (modify-syntax-entry ?+ "." table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
504 (modify-syntax-entry ?- "." table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
505 (modify-syntax-entry ?= "." table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
506 (modify-syntax-entry ?* "." table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
507 (modify-syntax-entry ?/ "." table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
508 (modify-syntax-entry ?\' "\"" table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
509 (modify-syntax-entry ?\" "\"" table) |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
510 ;; Consistent with GNU Fortran's default -- see the manual. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
511 ;; The F77 standard imposes no rule on this issue. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
512 (modify-syntax-entry ?\\ "\\" table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
513 ;; This might be better as punctuation, as for C, but this way you |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
514 ;; can treat floating-point numbers as symbols. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
515 (modify-syntax-entry ?. "_" table) ; e.g. `a.ne.b' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
516 (modify-syntax-entry ?_ "_" table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
517 (modify-syntax-entry ?$ "_" table) ; esp. VMSisms |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
518 (modify-syntax-entry ?\! "<" table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
519 (modify-syntax-entry ?\n ">" table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
520 table) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
521 "Syntax table used in Fortran mode.") |
13300
73b7a6396cbe
Fix to fortran-font-lock-keywords-* for new font-lock-keywords structure.
Simon Marshall <simon@gnu.org>
parents:
12814
diff
changeset
|
522 |
51615
64bebb34e646
(fortran-gud-syntax-table): Syntax table
Nick Roberts <nickrob@snap.net.nz>
parents:
50648
diff
changeset
|
523 (defvar fortran-gud-syntax-table |
64bebb34e646
(fortran-gud-syntax-table): Syntax table
Nick Roberts <nickrob@snap.net.nz>
parents:
50648
diff
changeset
|
524 (let ((st (make-syntax-table fortran-mode-syntax-table))) |
64bebb34e646
(fortran-gud-syntax-table): Syntax table
Nick Roberts <nickrob@snap.net.nz>
parents:
50648
diff
changeset
|
525 (modify-syntax-entry ?\n "." st) |
64bebb34e646
(fortran-gud-syntax-table): Syntax table
Nick Roberts <nickrob@snap.net.nz>
parents:
50648
diff
changeset
|
526 st) |
64bebb34e646
(fortran-gud-syntax-table): Syntax table
Nick Roberts <nickrob@snap.net.nz>
parents:
50648
diff
changeset
|
527 "Syntax table used to parse Fortran expressions for printing in GUD.") |
64bebb34e646
(fortran-gud-syntax-table): Syntax table
Nick Roberts <nickrob@snap.net.nz>
parents:
50648
diff
changeset
|
528 |
27199
4a15e79c5fb0
(fortran-mode-map): Don't bind M-C-a,
Dave Love <fx@gnu.org>
parents:
26665
diff
changeset
|
529 (defvar fortran-mode-map |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
530 (let ((map (make-sparse-keymap))) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
531 (define-key map ";" 'fortran-abbrev-start) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
532 (define-key map "\C-c;" 'fortran-comment-region) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
533 (define-key map "\M-;" 'fortran-indent-comment) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
534 (define-key map "\M-\n" 'fortran-split-line) |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
535 (define-key map "\M-\C-n" 'fortran-end-of-block) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
536 (define-key map "\M-\C-p" 'fortran-beginning-of-block) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
537 (define-key map "\M-\C-q" 'fortran-indent-subprogram) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
538 (define-key map "\C-c\C-w" 'fortran-window-create-momentarily) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
539 (define-key map "\C-c\C-r" 'fortran-column-ruler) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
540 (define-key map "\C-c\C-p" 'fortran-previous-statement) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
541 (define-key map "\C-c\C-n" 'fortran-next-statement) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
542 (define-key map "\C-c\C-d" 'fortran-join-line) ; like f90 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
543 (define-key map "\M-^" 'fortran-join-line) ; subvert delete-indentation |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
544 (define-key map "0" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
545 (define-key map "1" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
546 (define-key map "2" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
547 (define-key map "3" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
548 (define-key map "4" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
549 (define-key map "5" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
550 (define-key map "6" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
551 (define-key map "7" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
552 (define-key map "8" 'fortran-electric-line-number) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
553 (define-key map "9" 'fortran-electric-line-number) |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
554 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
555 (easy-menu-define fortran-menu map "Menu for Fortran mode." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
556 `("Fortran" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
557 ["Manual" (info "(emacs)Fortran")] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
558 ("Customization" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
559 ,(custom-menu-create 'fortran) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
560 ["Set" Custom-set t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
561 ["Save" Custom-save t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
562 ["Reset to Current" Custom-reset-current t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
563 ["Reset to Saved" Custom-reset-saved t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
564 ["Reset to Standard Settings" Custom-reset-standard t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
565 ) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
566 "--" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
567 ["Comment Region" fortran-comment-region mark-active] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
568 ["Uncomment Region" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
569 (fortran-comment-region (region-beginning) (region-end) 1) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
570 mark-active] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
571 ["Indent Region" indent-region mark-active] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
572 ["Indent Subprogram" fortran-indent-subprogram t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
573 "--" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
574 ["Beginning of Subprogram" fortran-beginning-of-subprogram t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
575 ["End of Subprogram" fortran-end-of-subprogram t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
576 ("Mark" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
577 ["Subprogram" mark-defun t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
578 ["IF Block" fortran-mark-if t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
579 ["DO Block" fortran-mark-do t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
580 ) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
581 ["Narrow to Subprogram" narrow-to-defun t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
582 ["Widen" widen t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
583 "--" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
584 ["Temporary column ruler" fortran-column-ruler t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
585 ["72-column window" fortran-window-create t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
586 ["Full Width Window" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
587 (enlarge-window-horizontally (- (frame-width) (window-width))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
588 (< (window-width) (frame-width))] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
589 ["Momentary 72-column window" fortran-window-create-momentarily t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
590 "--" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
591 ["Break Line at Point" fortran-split-line t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
592 ["Join Line" fortran-join-line t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
593 ["Fill Statement/Comment" fill-paragraph t] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
594 "--" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
595 ["Toggle auto-fill" auto-fill-mode :selected auto-fill-function |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
596 :style toggle] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
597 ["Toggle abbrev-mode" abbrev-mode :selected abbrev-mode |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
598 :style toggle] |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
599 ["Add imenu Menu" imenu-add-menubar-index |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
600 :active (not (lookup-key (current-local-map) [menu-bar index])) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
601 :included (fboundp 'imenu-add-to-menubar)])) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
602 map) |
27199
4a15e79c5fb0
(fortran-mode-map): Don't bind M-C-a,
Dave Love <fx@gnu.org>
parents:
26665
diff
changeset
|
603 "Keymap used in Fortran mode.") |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
604 |
332 | 605 |
27199
4a15e79c5fb0
(fortran-mode-map): Don't bind M-C-a,
Dave Love <fx@gnu.org>
parents:
26665
diff
changeset
|
606 (defvar fortran-mode-abbrev-table |
74431
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
607 (progn |
48815
4d051ad4475f
(fortran-mode-abbrev-table): Handle `define-abbrev' with either 5
Glenn Morris <rgm@gnu.org>
parents:
47767
diff
changeset
|
608 (define-abbrev-table 'fortran-mode-abbrev-table nil) |
74431
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
609 fortran-mode-abbrev-table) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
610 "Abbrev table for Fortran mode.") |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
611 |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
612 (let (abbrevs-changed) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
613 ;; Use the 6th arg (SYSTEM-FLAG) of define-abbrev if possible. |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
614 ;; Only use `apply' to quieten the byte-compiler. |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
615 (mapcar |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
616 (function (lambda (element) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
617 (condition-case nil |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
618 (apply 'define-abbrev fortran-mode-abbrev-table |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
619 (append element '(nil 0 t))) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
620 (wrong-number-of-arguments |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
621 (apply 'define-abbrev fortran-mode-abbrev-table |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
622 (append element '(nil 0))))))) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
623 '((";au" "automatic" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
624 (";b" "byte" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
625 (";bd" "block data" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
626 (";ch" "character" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
627 (";cl" "close" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
628 (";c" "continue" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
629 (";cm" "common" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
630 (";cx" "complex" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
631 (";df" "define" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
632 (";di" "dimension" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
633 (";do" "double" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
634 (";dc" "double complex" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
635 (";dp" "double precision" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
636 (";dw" "do while" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
637 (";e" "else" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
638 (";ed" "enddo" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
639 (";el" "elseif" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
640 (";en" "endif" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
641 (";eq" "equivalence" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
642 (";ew" "endwhere" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
643 (";ex" "external" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
644 (";ey" "entry" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
645 (";f" "format" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
646 (";fa" ".false." ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
647 (";fu" "function" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
648 (";g" "goto" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
649 (";im" "implicit" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
650 (";ib" "implicit byte" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
651 (";ic" "implicit complex" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
652 (";ich" "implicit character") |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
653 (";ii" "implicit integer" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
654 (";il" "implicit logical" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
655 (";ir" "implicit real" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
656 (";inc" "include" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
657 (";in" "integer" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
658 (";intr" "intrinsic" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
659 (";l" "logical" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
660 (";n" "namelist" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
661 (";o" "open" ) ; was ;op |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
662 (";pa" "parameter" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
663 (";pr" "program" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
664 (";ps" "pause" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
665 (";p" "print" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
666 (";rc" "record" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
667 (";re" "real" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
668 (";r" "read" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
669 (";rt" "return" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
670 (";rw" "rewind" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
671 (";s" "stop" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
672 (";sa" "save" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
673 (";st" "structure" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
674 (";sc" "static" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
675 (";su" "subroutine" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
676 (";tr" ".true." ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
677 (";ty" "type" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
678 (";vo" "volatile" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
679 (";w" "write" ) |
ab6be62cb44d
(fortran-mode-abbrev-table): Define abbrevs even if abbrev-table is
Glenn Morris <rgm@gnu.org>
parents:
74289
diff
changeset
|
680 (";wh" "where" )))) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
681 |
332 | 682 |
683 ;;;###autoload | |
684 (defun fortran-mode () | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
685 "Major mode for editing Fortran code in fixed format. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
686 For free format code, use `f90-mode'. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
687 |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
688 \\[fortran-indent-line] indents the current Fortran line correctly. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
689 Note that DO statements must not share a common CONTINUE. |
332 | 690 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
691 Type ;? or ;\\[help-command] to display a list of built-in abbrevs for\ |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
692 Fortran keywords. |
332 | 693 |
694 Key definitions: | |
695 \\{fortran-mode-map} | |
696 | |
697 Variables controlling indentation style and extra features: | |
698 | |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
699 `fortran-comment-line-start' |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
700 To use comments starting with `!', set this to the string \"!\". |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
701 `fortran-do-indent' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
702 Extra indentation within DO blocks (default 3). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
703 `fortran-if-indent' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
704 Extra indentation within IF blocks (default 3). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
705 `fortran-structure-indent' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
706 Extra indentation within STRUCTURE, UNION, MAP and INTERFACE blocks. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
707 (default 3) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
708 `fortran-continuation-indent' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
709 Extra indentation applied to continuation statements (default 5). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
710 `fortran-comment-line-extra-indent' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
711 Amount of extra indentation for text in full-line comments (default 0). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
712 `fortran-comment-indent-style' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
713 How to indent the text in full-line comments. Allowed values are: |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
714 nil don't change the indentation |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
715 fixed indent to `fortran-comment-line-extra-indent' beyond the |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
716 value of either |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
717 `fortran-minimum-statement-indent-fixed' (fixed format) or |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
718 `fortran-minimum-statement-indent-tab' (TAB format), |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
719 depending on the continuation format in use. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
720 relative indent to `fortran-comment-line-extra-indent' beyond the |
332 | 721 indentation for a line of code. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
722 (default 'fixed) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
723 `fortran-comment-indent-char' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
724 Single-character string to be inserted instead of space for |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
725 full-line comment indentation (default \" \"). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
726 `fortran-minimum-statement-indent-fixed' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
727 Minimum indentation for statements in fixed format mode (default 6). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
728 `fortran-minimum-statement-indent-tab' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
729 Minimum indentation for statements in TAB format mode (default 9). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
730 `fortran-line-number-indent' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
731 Maximum indentation for line numbers (default 1). A line number will |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
732 get less than this much indentation if necessary to avoid reaching |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
733 column 5. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
734 `fortran-check-all-num-for-matching-do' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
735 Non-nil causes all numbered lines to be treated as possible \"continue\" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
736 statements (default nil). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
737 `fortran-blink-matching-if' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
738 Non-nil causes \\[fortran-indent-line] on an ENDIF (or ENDDO) statement |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
739 to blink on the matching IF (or DO [WHILE]). (default nil) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
740 `fortran-continuation-string' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
741 Single-character string to be inserted in column 5 of a continuation |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
742 line (default \"$\"). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
743 `fortran-comment-region' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
744 String inserted by \\[fortran-comment-region] at start of each line in |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
745 the region (default \"c$$$\"). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
746 `fortran-electric-line-number' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
747 Non-nil causes line number digits to be moved to the correct column |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
748 as typed (default t). |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
749 `fortran-break-before-delimiters' |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
750 Non-nil causes lines to be broken before delimiters (default t). |
332 | 751 |
1548 | 752 Turning on Fortran mode calls the value of the variable `fortran-mode-hook' |
332 | 753 with no args, if that value is non-nil." |
754 (interactive) | |
755 (kill-all-local-variables) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
756 (setq major-mode 'fortran-mode |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
757 mode-name "Fortran" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
758 local-abbrev-table fortran-mode-abbrev-table) |
332 | 759 (set-syntax-table fortran-mode-syntax-table) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
760 (use-local-map fortran-mode-map) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
761 (set (make-local-variable 'indent-line-function) 'fortran-indent-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
762 (set (make-local-variable 'indent-region-function) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
763 (lambda (start end) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
764 (let (fortran-blink-matching-if ; avoid blinking delay |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
765 indent-region-function) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
766 (indent-region start end nil)))) |
59244
9d627ac86f8b
(fortran-mode): Use mode-require-final-newline.
Richard M. Stallman <rms@gnu.org>
parents:
55251
diff
changeset
|
767 (set (make-local-variable 'require-final-newline) mode-require-final-newline) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
768 ;; The syntax tables don't understand the column-0 comment-markers. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
769 (set (make-local-variable 'comment-use-syntax) nil) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
770 (set (make-local-variable 'comment-padding) "$$$") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
771 (set (make-local-variable 'comment-start) fortran-comment-line-start) |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
772 (set (make-local-variable 'comment-start-skip) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
773 ;; We can't reuse `fortran-comment-line-start-skip' directly because |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
774 ;; it contains backrefs whereas we need submatch-1 to end at the |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
775 ;; beginning of the comment delimiter. |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
776 ;; (concat "\\(\\)\\(![ \t]*\\|" fortran-comment-line-start-skip "\\)") |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
777 "\\(\\)\\(?:^[CcDd*]\\|!\\)\\(?:\\([^ \t\n]\\)\\2+\\)?[ \t]*") |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
778 (set (make-local-variable 'comment-indent-function) 'fortran-comment-indent) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
779 (set (make-local-variable 'abbrev-all-caps) t) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
780 (set (make-local-variable 'normal-auto-fill-function) 'fortran-auto-fill) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
781 (set (make-local-variable 'indent-tabs-mode) (fortran-analyze-file-format)) |
50600
418cea060d92
(fortran-tab-mode-minor-mode-string): Delete this variable,
Glenn Morris <rgm@gnu.org>
parents:
50598
diff
changeset
|
782 (setq mode-line-process '(indent-tabs-mode fortran-tab-mode-string)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
783 (set (make-local-variable 'fill-column) 72) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
784 (set (make-local-variable 'fill-paragraph-function) 'fortran-fill-paragraph) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
785 (set (make-local-variable 'font-lock-defaults) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
786 '((fortran-font-lock-keywords |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
787 fortran-font-lock-keywords-1 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
788 fortran-font-lock-keywords-2 |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
789 fortran-font-lock-keywords-3 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
790 fortran-font-lock-keywords-4) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
791 nil t ((?/ . "$/") ("_$" . "w")) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
792 fortran-beginning-of-subprogram)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
793 (set (make-local-variable 'font-lock-syntactic-keywords) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
794 fortran-font-lock-syntactic-keywords) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
795 (set (make-local-variable 'imenu-case-fold-search) t) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
796 (set (make-local-variable 'imenu-generic-expression) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
797 fortran-imenu-generic-expression) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
798 (set (make-local-variable 'imenu-syntax-alist) '(("_$" . "w"))) |
27417
0d4776018e39
(fortran-mode): Use beginning-of-defun-function, end-of-defun-function.
Dave Love <fx@gnu.org>
parents:
27199
diff
changeset
|
799 (set (make-local-variable 'beginning-of-defun-function) |
0d4776018e39
(fortran-mode): Use beginning-of-defun-function, end-of-defun-function.
Dave Love <fx@gnu.org>
parents:
27199
diff
changeset
|
800 #'fortran-beginning-of-subprogram) |
0d4776018e39
(fortran-mode): Use beginning-of-defun-function, end-of-defun-function.
Dave Love <fx@gnu.org>
parents:
27199
diff
changeset
|
801 (set (make-local-variable 'end-of-defun-function) |
0d4776018e39
(fortran-mode): Use beginning-of-defun-function, end-of-defun-function.
Dave Love <fx@gnu.org>
parents:
27199
diff
changeset
|
802 #'fortran-end-of-subprogram) |
28079
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
803 (set (make-local-variable 'add-log-current-defun-function) |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
804 #'fortran-current-defun) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
805 (set (make-local-variable 'dabbrev-case-fold-search) 'case-fold-search) |
51618
6a5cb63d165c
(fortran-gud-find-expr): Move from gud.el (was gud-find-fortran-expr).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51615
diff
changeset
|
806 (set (make-local-variable 'gud-find-expr-function) 'fortran-gud-find-expr) |
62772
f2892faa87d4
* progmodes/ada-mode.el (ada-mode):
Lute Kamstra <lute@gnu.org>
parents:
61107
diff
changeset
|
807 (run-mode-hooks 'fortran-mode-hook)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
808 |
332 | 809 |
51618
6a5cb63d165c
(fortran-gud-find-expr): Move from gud.el (was gud-find-fortran-expr).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51615
diff
changeset
|
810 (defun fortran-gud-find-expr () |
6a5cb63d165c
(fortran-gud-find-expr): Move from gud.el (was gud-find-fortran-expr).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51615
diff
changeset
|
811 ;; Consider \n as punctuation (end of expression). |
6a5cb63d165c
(fortran-gud-find-expr): Move from gud.el (was gud-find-fortran-expr).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51615
diff
changeset
|
812 (with-syntax-table fortran-gud-syntax-table |
6a5cb63d165c
(fortran-gud-find-expr): Move from gud.el (was gud-find-fortran-expr).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51615
diff
changeset
|
813 (gud-find-c-expr))) |
6a5cb63d165c
(fortran-gud-find-expr): Move from gud.el (was gud-find-fortran-expr).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
51615
diff
changeset
|
814 |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
815 (defsubst fortran-comment-indent () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
816 "Return the indentation appropriate for the current comment line. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
817 This is 0 for a line matching `fortran-comment-line-start-skip', else |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
818 the value of `comment-column' (leaving at least one space after code)." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
819 (if (looking-at fortran-comment-line-start-skip) 0 |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
820 (save-excursion |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
821 (skip-chars-backward " \t") |
50611 | 822 (max (1+ (current-column)) comment-column)))) |
332 | 823 |
824 (defun fortran-indent-comment () | |
825 "Align or create comment on current line. | |
826 Existing comments of all types are recognized and aligned. | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
827 If the line has no comment, a side-by-side comment is inserted and aligned, |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
828 if the value of `comment-start' is not nil and allows such comments. |
332 | 829 Otherwise, a separate-line comment is inserted, on this line |
830 or on a new line inserted before this line if this line is not blank." | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
831 (interactive "*") |
332 | 832 (beginning-of-line) |
833 ;; Recognize existing comments of either kind. | |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
834 (cond ((fortran-find-comment-start-skip 'all) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
835 (goto-char (match-beginning 0)) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
836 (if (bolp) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
837 (fortran-indent-line) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
838 (unless (= (current-column) (fortran-comment-indent)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
839 (delete-horizontal-space) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
840 (indent-to (fortran-comment-indent))))) |
332 | 841 ;; No existing comment. |
842 ;; If side-by-side comments are defined, insert one, | |
843 ;; unless line is now blank. | |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
844 ((and comment-start (not (looking-at "[ \t]*$")) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
845 (string-match comment-start-skip (concat " " comment-start))) |
332 | 846 (end-of-line) |
847 (delete-horizontal-space) | |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
848 (indent-to (fortran-comment-indent)) |
332 | 849 (insert comment-start)) |
850 ;; Else insert separate-line comment, making a new line if nec. | |
851 (t | |
852 (if (looking-at "^[ \t]*$") | |
853 (delete-horizontal-space) | |
854 (beginning-of-line) | |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
855 (insert ?\n) |
332 | 856 (forward-char -1)) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
857 (insert fortran-comment-line-start) |
332 | 858 (insert-char (if (stringp fortran-comment-indent-char) |
859 (aref fortran-comment-indent-char 0) | |
1548 | 860 fortran-comment-indent-char) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
861 (- (fortran-calculate-indent) (current-column)))))) |
332 | 862 |
863 (defun fortran-comment-region (beg-region end-region arg) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
864 "Comment every line in the region. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
865 Inserts the string variable `fortran-comment-region' at the beginning of |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
866 every line in the region. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
867 BEG-REGION and END-REGION specify the region boundaries. |
332 | 868 With non-nil ARG, uncomments the region." |
869 (interactive "*r\nP") | |
37080
00fb79924260
(fortran-comment-region): Fix typo.
Dave Love <fx@gnu.org>
parents:
36171
diff
changeset
|
870 (let ((end-region-mark (copy-marker end-region)) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
871 (save-point (point-marker))) |
332 | 872 (goto-char beg-region) |
873 (beginning-of-line) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
874 (if arg |
50611 | 875 (let ((com (regexp-quote fortran-comment-region))) ; uncomment |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
876 (if (looking-at com) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
877 (delete-region (point) (match-end 0))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
878 (while (and (zerop (forward-line 1)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
879 (< (point) end-region-mark)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
880 (if (looking-at com) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
881 (delete-region (point) (match-end 0))))) |
50611 | 882 (insert fortran-comment-region) ; comment |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
883 (while (and (zerop (forward-line 1)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
884 (< (point) end-region-mark)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
885 (insert fortran-comment-region))) |
332 | 886 (goto-char save-point) |
887 (set-marker end-region-mark nil) | |
888 (set-marker save-point nil))) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
889 |
332 | 890 |
891 (defun fortran-abbrev-start () | |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
892 "Typing ;\\[help-command] or ;? lists all the Fortran abbrevs. |
332 | 893 Any other key combination is executed normally." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
894 (interactive "*") |
50648
5b37299dac0a
(dabbrev-case-fold-search): Add defvar for compiler.
Glenn Morris <rgm@gnu.org>
parents:
50611
diff
changeset
|
895 (insert last-command-char) |
68244
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
896 (let* ((event (if (fboundp 'next-command-event) ; XEmacs |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
897 (next-command-event) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
898 (read-event))) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
899 (char (if (fboundp 'event-to-character) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
900 (event-to-character event) event))) |
50648
5b37299dac0a
(dabbrev-case-fold-search): Add defvar for compiler.
Glenn Morris <rgm@gnu.org>
parents:
50611
diff
changeset
|
901 ;; Insert char if not equal to `?', or if abbrev-mode is off. |
68244
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
902 (if (and abbrev-mode (or (eq char ??) (eq char help-char) |
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
903 (memq event help-event-list))) |
332 | 904 (fortran-abbrev-help) |
68244
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
905 (push event unread-command-events)))) |
332 | 906 |
907 (defun fortran-abbrev-help () | |
908 "List the currently defined abbrevs in Fortran mode." | |
909 (interactive) | |
910 (message "Listing abbrev table...") | |
1485
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
911 (display-buffer (fortran-prepare-abbrev-list-buffer)) |
332 | 912 (message "Listing abbrev table...done")) |
913 | |
1485
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
914 (defun fortran-prepare-abbrev-list-buffer () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
915 "Create a buffer listing the Fortran mode abbreviations." |
68244
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
916 (with-current-buffer (get-buffer-create "*Abbrevs*") |
1485
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
917 (erase-buffer) |
1862
f6a38dd2250b
* fortran.el (fortran-prepare-abbrev-list-buffer): Put quote in
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
918 (insert-abbrev-table-description 'fortran-mode-abbrev-table t) |
1485
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
919 (goto-char (point-min)) |
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
920 (set-buffer-modified-p nil) |
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
921 (edit-abbrevs-mode)) |
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
922 (get-buffer-create "*Abbrevs*")) |
a6da00e1c5ad
(fortran-tab-mode): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
1475
diff
changeset
|
923 |
332 | 924 (defun fortran-column-ruler () |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
925 "Insert a column ruler momentarily above current line, till next keystroke. |
50611 | 926 The ruler is defined by the value of `fortran-column-ruler-fixed' in fixed |
927 format mode, and `fortran-column-ruler-tab' in TAB format mode. | |
928 The next key typed is executed unless it is SPC." | |
332 | 929 (interactive) |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
930 (momentary-string-display |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
931 (if indent-tabs-mode |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
932 fortran-column-ruler-tab |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
933 fortran-column-ruler-fixed) |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
934 (save-excursion |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
935 (beginning-of-line) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
936 (if (eq (window-start (selected-window)) |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
937 (window-point (selected-window))) |
27199
4a15e79c5fb0
(fortran-mode-map): Don't bind M-C-a,
Dave Love <fx@gnu.org>
parents:
26665
diff
changeset
|
938 (line-beginning-position 2) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
939 (point))) |
332 | 940 nil "Type SPC or any command to erase ruler.")) |
941 | |
942 (defun fortran-window-create () | |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
943 "Make the window 72 columns wide. |
1475 | 944 See also `fortran-window-create-momentarily'." |
332 | 945 (interactive) |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
946 (let ((window-min-width 2)) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
947 (if (< (window-width) (frame-width)) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
948 (enlarge-window-horizontally (- (frame-width) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
949 (window-width) 1))) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
950 (let* ((window-edges (window-edges)) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
951 (scroll-bar-width (- (nth 2 window-edges) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
952 (car window-edges) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
953 (window-width)))) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
954 (split-window-horizontally (+ 72 scroll-bar-width))) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
955 (other-window 1) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
956 (switch-to-buffer " fortran-window-extra" t) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
957 (select-window (previous-window)))) |
332 | 958 |
959 (defun fortran-window-create-momentarily (&optional arg) | |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
960 "Momentarily make the window 72 columns wide. |
332 | 961 Optional ARG non-nil and non-unity disables the momentary feature. |
1475 | 962 See also `fortran-window-create'." |
332 | 963 (interactive "p") |
964 (if (or (not arg) | |
965 (= arg 1)) | |
966 (save-window-excursion | |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
967 (progn |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
968 (condition-case nil |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
969 (fortran-window-create) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
970 (error (error "No room for Fortran window"))) |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
971 (message "Type SPC to continue editing.") |
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
972 (let ((char (read-event))) |
74289
536e4b30fcab
(fortran-font-lock-keywords-4): Add `min'.
Glenn Morris <rgm@gnu.org>
parents:
68244
diff
changeset
|
973 (or (equal char ?\s) |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
974 (setq unread-command-events (list char)))))) |
332 | 975 (fortran-window-create))) |
976 | |
977 (defun fortran-split-line () | |
978 "Break line at point and insert continuation marker and alignment." | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
979 (interactive "*") |
332 | 980 (delete-horizontal-space) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
981 (if (save-excursion |
43883
b13e662ea2b3
(fortran-split-line): Make it work with any `!' comment as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43882
diff
changeset
|
982 (let ((pos (point))) |
b13e662ea2b3
(fortran-split-line): Make it work with any `!' comment as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43882
diff
changeset
|
983 (beginning-of-line) |
b13e662ea2b3
(fortran-split-line): Make it work with any `!' comment as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43882
diff
changeset
|
984 (and (fortran-find-comment-start-skip 'all) |
b13e662ea2b3
(fortran-split-line): Make it work with any `!' comment as well.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
43882
diff
changeset
|
985 (< (match-beginning 0) pos)))) |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
986 (insert ?\n (match-string 0)) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
987 (if indent-tabs-mode |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
988 (insert ?\n ?\t (fortran-numerical-continuation-char)) |
50611 | 989 (insert "\n " fortran-continuation-string))) ; space after \n important |
990 (fortran-indent-line)) ; when cont string is C, c or * | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
991 |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
992 (defun fortran-remove-continuation () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
993 "Delete any Fortran continuation characters at point. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
994 Returns t if anything actually deleted." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
995 (when (looking-at "\\( \\{5\\}[^ 0\n]\\|\t[1-9]\\|&\\)") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
996 (replace-match "") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
997 (delete-indentation) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
998 t)) |
332 | 999 |
23463 | 1000 (defun fortran-join-line (arg) |
1001 "Join current line to the previous one and re-indent. | |
1002 With a prefix argument, repeat this operation that many times. | |
1003 If the prefix argument ARG is negative, join the next -ARG lines. | |
1004 Continuation lines are correctly handled." | |
1005 (interactive "*p") | |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1006 (save-excursion |
23463 | 1007 (when (> 0 arg) |
1008 (setq arg (- arg)) | |
1009 (forward-line arg)) | |
1010 (while (not (zerop arg)) | |
1011 (beginning-of-line) | |
1012 (or (fortran-remove-continuation) | |
1013 (delete-indentation)) | |
1014 (setq arg (1- arg))) | |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1015 (fortran-indent-line))) |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1016 |
332 | 1017 (defun fortran-numerical-continuation-char () |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1018 "Return a digit for tab-digit style of continuation lines. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1019 If previous line is a tab-digit continuation line, return that digit |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1020 plus one, otherwise return 1. Zero not allowed." |
332 | 1021 (save-excursion |
1022 (forward-line -1) | |
1023 (if (looking-at "\t[1-9]") | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1024 (+ ?1 (% (- (char-after (1+ (point))) ?0) 9)) |
332 | 1025 ?1))) |
1026 | |
22377
24999a02843d
(fortran-electric-line-number): Add delete-selection property.
Richard M. Stallman <rms@gnu.org>
parents:
21804
diff
changeset
|
1027 (put 'fortran-electric-line-number 'delete-selection t) |
332 | 1028 (defun fortran-electric-line-number (arg) |
1029 "Self insert, but if part of a Fortran line number indent it automatically. | |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1030 Auto-indent does not happen if a numeric ARG is used." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1031 (interactive "*P") |
332 | 1032 (if (or arg (not fortran-electric-line-number)) |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
1033 (if arg |
1548 | 1034 (self-insert-command (prefix-numeric-value arg)) |
332 | 1035 (self-insert-command 1)) |
1036 (if (or (and (= 5 (current-column)) | |
1037 (save-excursion | |
1038 (beginning-of-line) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1039 ;; In col 5 with only spaces to the left. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1040 (looking-at " \\{5\\}"))) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1041 (and (= (if indent-tabs-mode |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1042 fortran-minimum-statement-indent-tab |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1043 fortran-minimum-statement-indent-fixed) (current-column)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1044 ;; In col 8 with a single tab to the left. |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59244
diff
changeset
|
1045 (eq ?\t (char-after (line-beginning-position))) |
332 | 1046 (not (or (eq last-command 'fortran-indent-line) |
1047 (eq last-command | |
3567
2ca5f216e445
(fortran-indent-new-line): Renamed from
Richard M. Stallman <rms@gnu.org>
parents:
3400
diff
changeset
|
1048 'fortran-indent-new-line)))) |
332 | 1049 (save-excursion |
1050 (re-search-backward "[^ \t0-9]" | |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1051 (line-beginning-position) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1052 t)) ; not a line number |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1053 (looking-at "[0-9]")) ; within a line number |
1548 | 1054 (self-insert-command (prefix-numeric-value arg)) |
332 | 1055 (skip-chars-backward " \t") |
1056 (insert last-command-char) | |
1057 (fortran-indent-line)))) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1058 |
332 | 1059 |
23711 | 1060 (defun fortran-check-end-prog-re () |
1061 "Check a preliminary match against `fortran-end-prog-re'." | |
1062 ;; Having got a possible match for the subprogram end, we need a | |
1063 ;; match of whitespace, avoiding possible column 73+ stuff. | |
1064 (save-match-data | |
23838
e494267843f7
(fortran-check-end-prog-re): Allow trailing
Dave Love <fx@gnu.org>
parents:
23754
diff
changeset
|
1065 (string-match "^\\s-*\\(\\'\\|\\s<\\)" |
23711 | 1066 (buffer-substring (match-end 0) |
1067 (min (line-end-position) | |
1068 (+ 72 (line-beginning-position))))))) | |
1069 | |
1070 ;; Note that you can't just check backwards for `subroutine' &c in | |
1071 ;; case of un-marked main programs not at the start of the file. | |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1072 (defun fortran-beginning-of-subprogram () |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
1073 "Move point to the beginning of the current Fortran subprogram." |
332 | 1074 (interactive) |
25054
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1075 (save-match-data |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1076 (let ((case-fold-search t)) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1077 (beginning-of-line -1) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1078 (if (catch 'ok |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1079 (while (re-search-backward fortran-end-prog-re nil 'move) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1080 (if (fortran-check-end-prog-re) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1081 (throw 'ok t)))) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1082 (forward-line))))) |
332 | 1083 |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1084 (defun fortran-end-of-subprogram () |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
1085 "Move point to the end of the current Fortran subprogram." |
332 | 1086 (interactive) |
25054
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1087 (save-match-data |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1088 (let ((case-fold-search t)) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1089 (if (save-excursion ; on END |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1090 (beginning-of-line) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1091 (and (looking-at fortran-end-prog-re) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1092 (fortran-check-end-prog-re))) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1093 (forward-line) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1094 (beginning-of-line 2) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1095 (catch 'ok |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1096 (while (re-search-forward fortran-end-prog-re nil 'move) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1097 (if (fortran-check-end-prog-re) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1098 (throw 'ok t)))) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1099 (goto-char (match-beginning 0)) |
888326cb8ffb
(fortran-mode-syntax-table): Change `\' to `\'
Dave Love <fx@gnu.org>
parents:
24800
diff
changeset
|
1100 (forward-line))))) |
332 | 1101 |
1102 (defun fortran-previous-statement () | |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
1103 "Move point to beginning of the previous Fortran statement. |
45242
52d991be0698
(fortran-preprocessor-re): New variable. Use it for font-locking.
Glenn Morris <rgm@gnu.org>
parents:
45067
diff
changeset
|
1104 Returns 'first-statement if that statement is the first |
52d991be0698
(fortran-preprocessor-re): New variable. Use it for font-locking.
Glenn Morris <rgm@gnu.org>
parents:
45067
diff
changeset
|
1105 non-comment Fortran statement in the file, and nil otherwise. |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1106 Directive lines are treated as comments." |
332 | 1107 (interactive) |
1108 (let (not-first-statement continue-test) | |
1109 (beginning-of-line) | |
1110 (setq continue-test | |
1548 | 1111 (and |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1112 (not (looking-at fortran-comment-line-start-skip)) |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1113 (not (looking-at fortran-directive-re)) |
1548 | 1114 (or (looking-at |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1115 (concat "[ \t]*" |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1116 (regexp-quote fortran-continuation-string))) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1117 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")))) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1118 (while (and (setq not-first-statement (zerop (forward-line -1))) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1119 (or (looking-at fortran-comment-line-start-skip) |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1120 (looking-at fortran-directive-re) |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1121 (looking-at |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1122 (concat "[ \t]*" |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1123 (regexp-quote fortran-continuation-string))) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1124 (looking-at "[ \t]*$\\| \\{5\\}[^ 0\n]\\|\t[1-9]") |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1125 (looking-at (concat "[ \t]*" comment-start-skip))))) |
332 | 1126 (cond ((and continue-test |
1127 (not not-first-statement)) | |
1128 (message "Incomplete continuation statement.")) | |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
1129 (continue-test |
332 | 1130 (fortran-previous-statement)) |
1131 ((not not-first-statement) | |
1132 'first-statement)))) | |
1133 | |
1134 (defun fortran-next-statement () | |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
1135 "Move point to beginning of the next Fortran statement. |
45242
52d991be0698
(fortran-preprocessor-re): New variable. Use it for font-locking.
Glenn Morris <rgm@gnu.org>
parents:
45067
diff
changeset
|
1136 Returns 'last-statement if that statement is the last |
52d991be0698
(fortran-preprocessor-re): New variable. Use it for font-locking.
Glenn Morris <rgm@gnu.org>
parents:
45067
diff
changeset
|
1137 non-comment Fortran statement in the file, and nil otherwise. |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1138 Directive lines are treated as comments." |
332 | 1139 (interactive) |
1140 (let (not-last-statement) | |
1141 (beginning-of-line) | |
1548 | 1142 (while (and (setq not-last-statement |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1143 (and (zerop (forward-line 1)) |
1548 | 1144 (not (eobp)))) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1145 (or (looking-at fortran-comment-line-start-skip) |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1146 (looking-at fortran-directive-re) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1147 (looking-at "[ \t]*$\\| [^ 0\n]\\|\t[1-9]") |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1148 (looking-at (concat "[ \t]*" comment-start-skip))))) |
332 | 1149 (if (not not-last-statement) |
1150 'last-statement))) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1151 |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1152 (defun fortran-looking-at-if-then () |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1153 "Return non-nil if at the start of a line with an IF ... THEN statement." |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1154 ;; cf f90-looking-at-if-then. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1155 (let ((p (point)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1156 (i (fortran-beginning-if))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1157 (if i |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1158 (save-excursion |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1159 (goto-char i) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1160 (beginning-of-line) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1161 (= (point) p))))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1162 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1163 ;; Used in hs-special-modes-alist. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1164 (defun fortran-end-of-block (&optional num) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1165 "Move point forward to the end of the current code block. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1166 With optional argument NUM, go forward that many balanced blocks. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1167 If NUM is negative, go backward to the start of a block. Does |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1168 not check for consistency of block types. Interactively, pushes |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1169 mark before moving point." |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1170 (interactive "p") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1171 (if (interactive-p) (push-mark (point) t)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1172 (and num (< num 0) (fortran-beginning-of-block (- num))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1173 (let ((case-fold-search t) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1174 (count (or num 1))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1175 (end-of-line) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1176 (while (and (> count 0) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1177 (re-search-forward |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1178 (concat "\\(" fortran-blocks-re |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1179 (if fortran-check-all-num-for-matching-do |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1180 "\\|^[ \t]*[0-9]+" "") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1181 "\\|continue\\|end\\)\\>") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1182 nil 'move)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1183 (beginning-of-line) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1184 (if (if (looking-at (concat "^[0-9 \t]*" fortran-if-start-re)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1185 (fortran-looking-at-if-then) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1186 (looking-at fortran-start-block-re)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1187 (setq count (1+ count)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1188 (if (or (looking-at fortran-end-block-re) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1189 (and (or (looking-at "^[0-9 \t]*continue") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1190 (and fortran-check-all-num-for-matching-do |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1191 (looking-at "[ \t]*[0-9]+"))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1192 (fortran-check-for-matching-do))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1193 (setq count (1- count)))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1194 (end-of-line)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1195 (if (> count 0) (error "Missing block end")))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1196 |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1197 (defun fortran-beginning-of-block (&optional num) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1198 "Move point backwards to the start of the current code block. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1199 With optional argument NUM, go backward that many balanced |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1200 blocks. If NUM is negative, go forward to the end of a block. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1201 Does not check for consistency of block types. Interactively, |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1202 pushes mark before moving point." |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1203 (interactive "p") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1204 (if (interactive-p) (push-mark (point) t)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1205 (and num (< num 0) (fortran-end-of-block (- num))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1206 (let ((case-fold-search t) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1207 (count (or num 1))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1208 (beginning-of-line) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1209 (while (and (> count 0) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1210 (re-search-backward |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1211 (concat "\\(" fortran-blocks-re |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1212 (if fortran-check-all-num-for-matching-do |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1213 "\\|^[ \t]*[0-9]+" "") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1214 "\\|continue\\|end\\)\\>") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1215 nil 'move)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1216 (beginning-of-line) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1217 (if (if (looking-at (concat "^[0-9 \t]*" fortran-if-start-re)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1218 (fortran-looking-at-if-then) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1219 (looking-at fortran-start-block-re)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1220 (setq count (1- count)) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1221 (if (or (looking-at fortran-end-block-re) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1222 (and (or (looking-at "^[0-9 \t]*continue") |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1223 (and fortran-check-all-num-for-matching-do |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1224 (looking-at "[ \t]*[0-9]+"))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1225 (fortran-check-for-matching-do))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1226 (setq count (1+ count))))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1227 ;; Includes an un-named main program block. |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1228 (if (> count 0) (error "Missing block start")))) |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1229 |
332 | 1230 |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1231 (defun fortran-blink-match (regex keyword find-begin) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1232 "From a line matching REGEX, blink matching KEYWORD statement line. |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1233 Use function FIND-BEGIN to match it." |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1234 (let ((top-of-window (window-start)) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1235 (end-point (point)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1236 (case-fold-search t) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1237 matching |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1238 message) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1239 (when (save-excursion |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1240 (beginning-of-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1241 (skip-chars-forward " \t0-9") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1242 (looking-at regex)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1243 (if (not (setq matching (funcall find-begin))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1244 (setq message (concat "No matching " keyword ".")) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1245 (if (< matching top-of-window) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1246 (save-excursion |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1247 (goto-char matching) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1248 (beginning-of-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1249 (setq message |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1250 (concat "Matches " |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1251 (buffer-substring (point) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1252 (line-end-position))))))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1253 (if message |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1254 (message "%s" message) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1255 (goto-char matching) |
66635
462d9824004b
(fortran-blink-match): Use `blink-matching-delay'.
Glenn Morris <rgm@gnu.org>
parents:
65919
diff
changeset
|
1256 (sit-for blink-matching-delay) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1257 (goto-char end-point))))) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1258 |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1259 (defun fortran-blink-matching-if () |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1260 "From an ENDIF or ELSE statement, blink the matching IF statement." |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1261 (fortran-blink-match "e\\(nd[ \t]*if\\|lse\\([ \t]*if\\)?\\)\\b" |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1262 "if" #'fortran-beginning-if)) |
6731
23d9c2bc097b
(fortran-blink-matching-do): New function,
Richard M. Stallman <rms@gnu.org>
parents:
5720
diff
changeset
|
1263 |
23d9c2bc097b
(fortran-blink-matching-do): New function,
Richard M. Stallman <rms@gnu.org>
parents:
5720
diff
changeset
|
1264 (defun fortran-blink-matching-do () |
23754 | 1265 "From an ENDDO statement, blink the matching DO or DO WHILE statement." |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1266 (fortran-blink-match "end[ \t]*do\\b" "do" #'fortran-beginning-do)) |
10189
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1267 |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1268 (defun fortran-mark-do () |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
1269 "Put mark at end of Fortran DO [WHILE]-ENDDO construct, point at beginning. |
10189
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1270 The marks are pushed." |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1271 (interactive) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1272 (let (enddo-point do-point) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1273 (if (setq enddo-point (fortran-end-do)) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1274 (if (not (setq do-point (fortran-beginning-do))) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1275 (message "No matching do.") |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1276 (goto-char enddo-point) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1277 (push-mark) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1278 (goto-char do-point))))) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1279 |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1280 (defun fortran-end-do () |
23754 | 1281 "Search forward for first unmatched ENDDO. |
1282 Return point or nil." | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1283 (let ((case-fold-search t)) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1284 (if (save-excursion (beginning-of-line) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1285 (skip-chars-forward " \t0-9") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1286 (looking-at "end[ \t]*do\\b")) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1287 ;; Sitting on one. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1288 (match-beginning 0) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1289 ;; Search for one. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1290 (save-excursion |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1291 (let ((count 1)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1292 (while (and (not (zerop count)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1293 (not (eq (fortran-next-statement) 'last-statement)) |
50611 | 1294 ;; Keep local to subprogram. |
23754 | 1295 (not (and (looking-at fortran-end-prog-re) |
1296 (fortran-check-end-prog-re)))) | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1297 (skip-chars-forward " \t0-9") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1298 (cond ((looking-at "end[ \t]*do\\b") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1299 (setq count (1- count))) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1300 ((looking-at |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1301 "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]") |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1302 (setq count (1+ count))))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1303 (and (zerop count) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1304 ;; All pairs accounted for. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1305 (point))))))) |
10189
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1306 |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1307 (defun fortran-beginning-do () |
23754 | 1308 "Search backwards for first unmatched DO [WHILE]. |
47767
1ad06cb931a9
(fortran-beginning-do): Ignore labelled DO loops altogether.
Glenn Morris <rgm@gnu.org>
parents:
46979
diff
changeset
|
1309 Return point or nil. Ignores labelled DO loops (ie DO 10 ... 10 CONTINUE)." |
1ad06cb931a9
(fortran-beginning-do): Ignore labelled DO loops altogether.
Glenn Morris <rgm@gnu.org>
parents:
46979
diff
changeset
|
1310 (let ((case-fold-search t) |
1ad06cb931a9
(fortran-beginning-do): Ignore labelled DO loops altogether.
Glenn Morris <rgm@gnu.org>
parents:
46979
diff
changeset
|
1311 (dostart-re "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?do[ \t]+[^0-9]")) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1312 (if (save-excursion |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1313 (beginning-of-line) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1314 (skip-chars-forward " \t0-9") |
47767
1ad06cb931a9
(fortran-beginning-do): Ignore labelled DO loops altogether.
Glenn Morris <rgm@gnu.org>
parents:
46979
diff
changeset
|
1315 (looking-at dostart-re)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1316 ;; Sitting on one. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1317 (match-beginning 0) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1318 ;; Search for one. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1319 (save-excursion |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1320 (let ((count 1)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1321 (while (and (not (zerop count)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1322 (not (eq (fortran-previous-statement) 'first-statement)) |
50611 | 1323 ;; Keep local to subprogram. |
23754 | 1324 (not (and (looking-at fortran-end-prog-re) |
1325 (fortran-check-end-prog-re)))) | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1326 (skip-chars-forward " \t0-9") |
47767
1ad06cb931a9
(fortran-beginning-do): Ignore labelled DO loops altogether.
Glenn Morris <rgm@gnu.org>
parents:
46979
diff
changeset
|
1327 (cond ((looking-at dostart-re) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1328 (setq count (1- count))) |
47767
1ad06cb931a9
(fortran-beginning-do): Ignore labelled DO loops altogether.
Glenn Morris <rgm@gnu.org>
parents:
46979
diff
changeset
|
1329 ;; Note labelled loop ends not considered. |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1330 ((looking-at "end[ \t]*do\\b") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1331 (setq count (1+ count))))) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1332 (and (zerop count) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1333 ;; All pairs accounted for. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1334 (point))))))) |
10189
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1335 |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1336 (defun fortran-mark-if () |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1337 "Put mark at end of Fortran IF-ENDIF construct, point at beginning. |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1338 The marks are pushed." |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1339 (interactive) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1340 (let (endif-point if-point) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1341 (if (setq endif-point (fortran-end-if)) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1342 (if (not (setq if-point (fortran-beginning-if))) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1343 (message "No matching if.") |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1344 ;; Set mark, move point. |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1345 (goto-char endif-point) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1346 (push-mark) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1347 (goto-char if-point))))) |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1348 |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1349 (defun fortran-end-if () |
23754 | 1350 "Search forwards for first unmatched ENDIF. |
1351 Return point or nil." | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1352 (let ((case-fold-search t)) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1353 (if (save-excursion (beginning-of-line) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1354 (skip-chars-forward " \t0-9") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1355 (looking-at "end[ \t]*if\\b")) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1356 ;; Sitting on one. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1357 (match-beginning 0) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1358 ;; Search for one. The point has been already been moved to first |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1359 ;; letter on line but this should not cause troubles. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1360 (save-excursion |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1361 (let ((count 1)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1362 (while (and (not (zerop count)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1363 (not (eq (fortran-next-statement) 'last-statement)) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1364 ;; Keep local to subprogram. |
23754 | 1365 (not (and (looking-at fortran-end-prog-re) |
1366 (fortran-check-end-prog-re)))) | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1367 (skip-chars-forward " \t0-9") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1368 (cond ((looking-at "end[ \t]*if\\b") |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1369 (setq count (1- count))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1370 ((looking-at fortran-if-start-re) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1371 (save-excursion |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1372 (if (or |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1373 (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") |
50611 | 1374 (let (then-test) ; multi-line if-then |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1375 (while |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1376 (and |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1377 (zerop (forward-line 1)) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1378 ;; Search forward for then. |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1379 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1380 (not |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1381 (setq then-test |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1382 (looking-at |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1383 ".*then\\b[ \t]*[^ \t(=a-z0-9]"))))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1384 then-test)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1385 (setq count (1+ count))))))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1386 (and (zerop count) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1387 ;; All pairs accounted for. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1388 (point))))))) |
10189
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1389 |
b2d6d69b7707
(fortran-end-if, fortran-end-do,
Richard M. Stallman <rms@gnu.org>
parents:
9476
diff
changeset
|
1390 (defun fortran-beginning-if () |
23754 | 1391 "Search backwards for first unmatched IF-THEN. |
1392 Return point or nil." | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1393 (let ((case-fold-search t)) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1394 (if (save-excursion |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1395 ;; May be sitting on multi-line if-then statement, first |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1396 ;; move to beginning of current statement. Note: |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1397 ;; `fortran-previous-statement' moves to previous statement |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1398 ;; *unless* current statement is first one. Only move |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1399 ;; forward if not first-statement. |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1400 (if (not (eq (fortran-previous-statement) 'first-statement)) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1401 (fortran-next-statement)) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1402 (skip-chars-forward " \t0-9") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1403 (and |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1404 (looking-at fortran-if-start-re) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1405 (save-match-data |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1406 (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1407 ;; Multi-line if-then. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1408 (let (then-test) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1409 (while |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1410 (and (zerop (forward-line 1)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1411 ;; Search forward for then. |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1412 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1413 (not |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1414 (setq then-test |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1415 (looking-at |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1416 ".*then\\b[ \t]*[^ \t(=a-z0-9]"))))) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1417 then-test))))) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1418 ;; Sitting on one. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1419 (match-beginning 0) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1420 ;; Search for one. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1421 (save-excursion |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1422 (let ((count 1)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1423 (while (and (not (zerop count)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1424 (not (eq (fortran-previous-statement) 'first-statement)) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1425 ;; Keep local to subprogram. |
23754 | 1426 (not (and (looking-at fortran-end-prog-re) |
1427 (fortran-check-end-prog-re)))) | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1428 (skip-chars-forward " \t0-9") |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1429 (cond ((looking-at fortran-if-start-re) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1430 (save-excursion |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1431 (if (or |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1432 (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t(=a-z0-9]") |
50611 | 1433 (let (then-test) ; multi-line if-then |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1434 (while |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1435 (and |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1436 (zerop (forward-line 1)) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1437 ;; Search forward for then. |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1438 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1439 (not |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1440 (setq then-test |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1441 (looking-at |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1442 (concat ".*then\\b[ \t]*" |
41676
82c2143ec3eb
Fontify rewind, backspace. Doc fixes.
Dave Love <fx@gnu.org>
parents:
41234
diff
changeset
|
1443 "[^ \t(=a-z0-9]")))))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1444 then-test)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1445 (setq count (1- count))))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1446 ((looking-at "end[ \t]*if\\b") |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1447 (setq count (1+ count))))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1448 (and (zerop count) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1449 ;; All pairs accounted for. |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1450 (point))))))) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1451 |
332 | 1452 |
1453 (defun fortran-indent-line () | |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1454 "Indent current Fortran line based on its contents and on previous lines." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1455 (interactive "*") |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1456 (let ((cfi (fortran-calculate-indent))) |
332 | 1457 (save-excursion |
1458 (beginning-of-line) | |
1459 (if (or (not (= cfi (fortran-current-line-indentation))) | |
1460 (and (re-search-forward "^[ \t]*[0-9]+" (+ (point) 4) t) | |
1461 (not (fortran-line-number-indented-correctly-p)))) | |
1462 (fortran-indent-to-column cfi) | |
1463 (beginning-of-line) | |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1464 (if (fortran-find-comment-start-skip) |
332 | 1465 (fortran-indent-comment)))) |
1466 ;; Never leave point in left margin. | |
1467 (if (< (current-column) cfi) | |
1468 (move-to-column cfi)) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1469 (and auto-fill-function |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1470 (> (save-excursion (end-of-line) (current-column)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1471 fill-column) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1472 (save-excursion |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1473 (end-of-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1474 (fortran-fill))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1475 (when fortran-blink-matching-if |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1476 (fortran-blink-matching-if) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1477 (fortran-blink-matching-do)))) |
332 | 1478 |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1479 (defun fortran-auto-fill () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1480 "Function to use for `normal-auto-fill-function' in Fortran mode." |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1481 (if (> (current-column) (current-fill-column)) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1482 (let ((cfi (fortran-calculate-indent))) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1483 (save-excursion |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1484 (beginning-of-line) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1485 (if (or (not (= cfi (fortran-current-line-indentation))) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1486 (and (re-search-forward "^[ \t]*[0-9]+" |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1487 (+ (point) 4) t) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1488 (not (fortran-line-number-indented-correctly-p)))) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1489 (fortran-indent-to-column cfi) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1490 (beginning-of-line) |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1491 (if (fortran-find-comment-start-skip) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1492 (fortran-indent-comment)))) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1493 (fortran-fill) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1494 ;; Never leave point in left margin. |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1495 (if (< (current-column) cfi) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1496 (move-to-column cfi))))) |
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1497 |
25162
ec613559ec18
(fortran-indent-new-line): Make it an alias
Dave Love <fx@gnu.org>
parents:
25054
diff
changeset
|
1498 ;; Historically this was a separate function which advertised itself |
ec613559ec18
(fortran-indent-new-line): Make it an alias
Dave Love <fx@gnu.org>
parents:
25054
diff
changeset
|
1499 ;; as reindenting but only did so where `most likely to be necessary'. |
ec613559ec18
(fortran-indent-new-line): Make it an alias
Dave Love <fx@gnu.org>
parents:
25054
diff
changeset
|
1500 (defalias 'fortran-indent-new-line 'reindent-then-newline-and-indent) |
1548 | 1501 |
332 | 1502 (defun fortran-indent-subprogram () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1503 "Properly indent the Fortran subprogram containing point." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1504 (interactive "*") |
332 | 1505 (save-excursion |
27199
4a15e79c5fb0
(fortran-mode-map): Don't bind M-C-a,
Dave Love <fx@gnu.org>
parents:
26665
diff
changeset
|
1506 (mark-defun) |
24254
93993abff564
(mark-fortran-subprogram): Activate mark
Dave Love <fx@gnu.org>
parents:
24125
diff
changeset
|
1507 (message "Indenting subprogram...") |
93993abff564
(mark-fortran-subprogram): Activate mark
Dave Love <fx@gnu.org>
parents:
24125
diff
changeset
|
1508 (indent-region (point) (mark) nil)) |
332 | 1509 (message "Indenting subprogram...done.")) |
1510 | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1511 (defun fortran-calculate-indent () |
1548 | 1512 "Calculates the Fortran indent column based on previous lines." |
332 | 1513 (let (icol first-statement (case-fold-search t) |
1514 (fortran-minimum-statement-indent | |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1515 (if indent-tabs-mode |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1516 fortran-minimum-statement-indent-tab |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1517 fortran-minimum-statement-indent-fixed))) |
332 | 1518 (save-excursion |
1519 (setq first-statement (fortran-previous-statement)) | |
1520 (if first-statement | |
1521 (setq icol fortran-minimum-statement-indent) | |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1522 (if (= (point) (point-min)) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1523 (setq icol fortran-minimum-statement-indent) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1524 (setq icol (fortran-current-line-indentation))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1525 (skip-chars-forward " \t0-9") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1526 (cond ((looking-at "\\(\\(\\sw\\|\\s_\\)+:[ \t]*\\)?if[ \t]*(") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1527 (if (or (looking-at ".*)[ \t]*then\\b[ \t]*[^ \t_$(=a-z0-9]") |
50611 | 1528 (let (then-test) ; multi-line if-then |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1529 (while (and (zerop (forward-line 1)) |
50611 | 1530 ;; Search forward for then. |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1531 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1532 (not (setq then-test |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1533 (looking-at |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1534 ".*then\\b[ \t]\ |
1548 | 1535 *[^ \t_$(=a-z0-9]"))))) |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1536 then-test)) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1537 (setq icol (+ icol fortran-if-indent)))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1538 ((looking-at "else\\(if\\)?\\b") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1539 (setq icol (+ icol fortran-if-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1540 ((looking-at "select[ \t]*case[ \t](.*)") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1541 (setq icol (+ icol fortran-if-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1542 ((looking-at "case[ \t]*(.*)") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1543 (setq icol (+ icol fortran-if-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1544 ((looking-at "case[ \t]*default\\b") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1545 (setq icol (+ icol fortran-if-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1546 ((looking-at "\\(otherwise\\|else[ \t]*where\\)\\b") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1547 (setq icol (+ icol fortran-if-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1548 ((looking-at "where[ \t]*(.*)[ \t]*\n") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1549 (setq icol (+ icol fortran-if-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1550 ((looking-at "do\\b") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1551 (setq icol (+ icol fortran-do-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1552 ((looking-at |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1553 "\\(structure\\|union\\|map\\|interface\\)\ |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1554 \\b[ \t]*[^ \t=(a-z]") |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1555 (setq icol (+ icol fortran-structure-indent))) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1556 ((and (looking-at fortran-end-prog-re1) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1557 (fortran-check-end-prog-re)) |
50611 | 1558 ;; Previous END resets indent to minimum. |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1559 (setq icol fortran-minimum-statement-indent))))) |
332 | 1560 (save-excursion |
1561 (beginning-of-line) | |
1562 (cond ((looking-at "[ \t]*$")) | |
45301
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1563 ;; Check for directive before comment, so as not to indent. |
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1564 ((looking-at fortran-directive-re) |
793bb00af917
(fortran-directive-re): New name for fortran-preprocessor-re. All usage
Glenn Morris <rgm@gnu.org>
parents:
45255
diff
changeset
|
1565 (setq fortran-minimum-statement-indent 0 icol 0)) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1566 ((looking-at fortran-comment-line-start-skip) |
332 | 1567 (cond ((eq fortran-comment-indent-style 'relative) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1568 (setq icol (+ icol fortran-comment-line-extra-indent))) |
332 | 1569 ((eq fortran-comment-indent-style 'fixed) |
1548 | 1570 (setq icol (+ fortran-minimum-statement-indent |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1571 fortran-comment-line-extra-indent)))) |
1548 | 1572 (setq fortran-minimum-statement-indent 0)) |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1573 ((or (looking-at (concat "[ \t]*" |
1548 | 1574 (regexp-quote |
1575 fortran-continuation-string))) | |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1576 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1577 (skip-chars-forward " \t") |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1578 ;; Do not introduce extra whitespace into a broken string. |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1579 (setq icol |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1580 (if (fortran-is-in-string-p (point)) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1581 6 |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1582 (+ icol fortran-continuation-indent)))) |
332 | 1583 (first-statement) |
1584 ((and fortran-check-all-num-for-matching-do | |
1585 (looking-at "[ \t]*[0-9]+") | |
1586 (fortran-check-for-matching-do)) | |
1587 (setq icol (- icol fortran-do-indent))) | |
1588 (t | |
1589 (skip-chars-forward " \t0-9") | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1590 (cond ((looking-at "end[ \t]*\\(if\\|select\\|where\\)\\b") |
332 | 1591 (setq icol (- icol fortran-if-indent))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1592 ((looking-at "else\\(if\\)?\\b") |
5720
fe1a71db966f
(calculate-fortran-indent): Handle
Richard M. Stallman <rms@gnu.org>
parents:
5065
diff
changeset
|
1593 (setq icol (- icol fortran-if-indent))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1594 ((looking-at "case[ \t]*\\((.*)\\|default\\>\\)") |
5720
fe1a71db966f
(calculate-fortran-indent): Handle
Richard M. Stallman <rms@gnu.org>
parents:
5065
diff
changeset
|
1595 (setq icol (- icol fortran-if-indent))) |
1548 | 1596 ((looking-at "\\(otherwise\\|else[ \t]*where\\)\\b") |
1597 (setq icol (- icol fortran-if-indent))) | |
332 | 1598 ((and (looking-at "continue\\b") |
1599 (fortran-check-for-matching-do)) | |
1600 (setq icol (- icol fortran-do-indent))) | |
1601 ((looking-at "end[ \t]*do\\b") | |
1602 (setq icol (- icol fortran-do-indent))) | |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1603 ((looking-at "end[ \t]*\ |
5720
fe1a71db966f
(calculate-fortran-indent): Handle
Richard M. Stallman <rms@gnu.org>
parents:
5065
diff
changeset
|
1604 \\(structure\\|union\\|map\\|interface\\)\\b[ \t]*[^ \t=(a-z]") |
1548 | 1605 (setq icol (- icol fortran-structure-indent))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1606 ((and (looking-at fortran-end-prog-re1) |
23754 | 1607 (fortran-check-end-prog-re) |
332 | 1608 (not (= icol fortran-minimum-statement-indent))) |
1609 (message "Warning: `end' not in column %d. Probably\ | |
1610 an unclosed block." fortran-minimum-statement-indent)))))) | |
1611 (max fortran-minimum-statement-indent icol))) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1612 |
332 | 1613 |
1614 (defun fortran-current-line-indentation () | |
1615 "Indentation of current line, ignoring Fortran line number or continuation. | |
1616 This is the column position of the first non-whitespace character | |
1617 aside from the line number and/or column 5/8 line-continuation character. | |
1618 For comment lines, returns indentation of the first | |
1619 non-indentation text within the comment." | |
1620 (save-excursion | |
1621 (beginning-of-line) | |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1622 (cond ((looking-at fortran-comment-line-start-skip) |
332 | 1623 (goto-char (match-end 0)) |
1624 (skip-chars-forward | |
1548 | 1625 (if (stringp fortran-comment-indent-char) |
1626 fortran-comment-indent-char | |
1627 (char-to-string fortran-comment-indent-char)))) | |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1628 ((or (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) |
332 | 1629 (goto-char (match-end 0))) |
1630 (t | |
1631 ;; Move past line number. | |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1632 (skip-chars-forward "[ \t0-9]"))) |
332 | 1633 ;; Move past whitespace. |
1634 (skip-chars-forward " \t") | |
1635 (current-column))) | |
1636 | |
1637 (defun fortran-indent-to-column (col) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1638 "Indent current line to column COL. |
332 | 1639 notes: 1) A non-zero/non-blank character in column 5 indicates a continuation |
1640 line, and this continuation character is retained on indentation; | |
1548 | 1641 2) If `fortran-continuation-string' is the first non-whitespace |
1642 character, this is a continuation line; | |
332 | 1643 3) A non-continuation line which has a number as the first |
1644 non-whitespace character is a numbered line. | |
1548 | 1645 4) A TAB followed by a digit indicates a continuation line." |
332 | 1646 (save-excursion |
1647 (beginning-of-line) | |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1648 (if (looking-at fortran-comment-line-start-skip) |
332 | 1649 (if fortran-comment-indent-style |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1650 (let* ((char (if (stringp fortran-comment-indent-char) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1651 (aref fortran-comment-indent-char 0) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1652 fortran-comment-indent-char)) |
65230
4d20d00ea5c4
(fortran-indent-to-column): "?\ " -> "?\s".
Juanma Barranquero <lekktu@gmail.com>
parents:
64699
diff
changeset
|
1653 (chars (string ?\s ?\t char))) |
332 | 1654 (goto-char (match-end 0)) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1655 (skip-chars-backward chars) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1656 (delete-region (point) (progn (skip-chars-forward chars) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1657 (point))) |
332 | 1658 (insert-char char (- col (current-column))))) |
1659 (if (looking-at "\t[1-9]") | |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1660 (if indent-tabs-mode |
332 | 1661 (goto-char (match-end 0)) |
1662 (delete-char 2) | |
65230
4d20d00ea5c4
(fortran-indent-to-column): "?\ " -> "?\s".
Juanma Barranquero <lekktu@gmail.com>
parents:
64699
diff
changeset
|
1663 (insert-char ?\s 5) |
332 | 1664 (insert fortran-continuation-string)) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1665 (if (looking-at " \\{5\\}[^ 0\n]") |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1666 (if indent-tabs-mode |
332 | 1667 (progn (delete-char 6) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1668 (insert ?\t (fortran-numerical-continuation-char) 1)) |
332 | 1669 (forward-char 6)) |
1670 (delete-horizontal-space) | |
50611 | 1671 ;; Put line number in columns 0-4, or |
1672 ;; continuation character in column 5. | |
332 | 1673 (cond ((eobp)) |
1674 ((looking-at (regexp-quote fortran-continuation-string)) | |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1675 (if indent-tabs-mode |
332 | 1676 (progn |
20207
38616c4cf58c
(fortran-imenu-generic-expression): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
20205
diff
changeset
|
1677 (indent-to |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1678 (if indent-tabs-mode |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1679 fortran-minimum-statement-indent-tab |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1680 fortran-minimum-statement-indent-fixed)) |
332 | 1681 (delete-char 1) |
1682 (insert-char (fortran-numerical-continuation-char) 1)) | |
1548 | 1683 (indent-to 5) |
1684 (forward-char 1))) | |
332 | 1685 ((looking-at "[0-9]+") |
1686 (let ((extra-space (- 5 (- (match-end 0) (point))))) | |
1687 (if (< extra-space 0) | |
1688 (message "Warning: line number exceeds 5-digit limit.") | |
1689 (indent-to (min fortran-line-number-indent extra-space)))) | |
1690 (skip-chars-forward "0-9"))))) | |
1691 ;; Point is now after any continuation character or line number. | |
1692 ;; Put body of statement where specified. | |
1693 (delete-horizontal-space) | |
1694 (indent-to col) | |
1695 ;; Indent any comment following code on the same line. | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1696 (when (fortran-find-comment-start-skip) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1697 (goto-char (match-beginning 0)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1698 (unless (= (current-column) (fortran-comment-indent)) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1699 (delete-horizontal-space) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1700 (indent-to (fortran-comment-indent))))))) |
332 | 1701 |
1702 (defun fortran-line-number-indented-correctly-p () | |
1703 "Return t if current line's line number is correctly indented. | |
1704 Do not call if there is no line number." | |
1705 (save-excursion | |
1706 (beginning-of-line) | |
1707 (skip-chars-forward " \t") | |
1708 (and (<= (current-column) fortran-line-number-indent) | |
1709 (or (= (current-column) fortran-line-number-indent) | |
1710 (progn (skip-chars-forward "0-9") | |
1711 (= (current-column) 5)))))) | |
1712 | |
1713 (defun fortran-check-for-matching-do () | |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1714 "When called from a numbered statement, return t if matching DO is found. |
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1715 Otherwise return nil." |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1716 (let ((case-fold-search t) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1717 charnum) |
332 | 1718 (save-excursion |
1719 (beginning-of-line) | |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1720 (when (looking-at "[ \t]*[0-9]+") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1721 (skip-chars-forward " \t") |
50611 | 1722 (skip-chars-forward "0") ; skip past leading zeros |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1723 (setq charnum |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1724 (buffer-substring (point) (progn |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1725 (skip-chars-forward "0-9") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1726 (point)))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1727 (beginning-of-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1728 (save-restriction |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1729 (save-excursion |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1730 (narrow-to-defun) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1731 (and (re-search-backward |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1732 (concat |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1733 "\\(^[ \t0-9]*do[ \t]*0*" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1734 charnum "\\b\\)\\|" "\\(^[ \t]*0*" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1735 charnum "\\b\\)") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1736 nil t) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1737 (looking-at |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1738 (concat "^[ \t0-9]*do[ \t]*0*" |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1739 charnum))))))))) |
332 | 1740 |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1741 (defun fortran-find-comment-start-skip (&optional all) |
1548 | 1742 "Move to past `comment-start-skip' found on current line. |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1743 Return non-nil if `comment-start-skip' found, nil if not. |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1744 If ALL is nil, only match comments that start in column > 0." |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1745 ;; Hopefully at some point we can just use the line below! -stef |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1746 ;; (comment-search-forward (line-end-position) t)) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1747 (when (or all comment-start-skip) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1748 (let ((pos (point)) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1749 (css (if comment-start-skip |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1750 (concat fortran-comment-line-start-skip |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1751 "\\|" comment-start-skip) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1752 fortran-comment-line-start-skip))) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1753 (when (re-search-forward css (line-end-position) t) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1754 (if (and (or all (> (match-beginning 0) (line-beginning-position))) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1755 (or (save-match-data |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1756 (not (fortran-is-in-string-p (match-beginning 0)))) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1757 ;; Recurse for rest of line. |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1758 (fortran-find-comment-start-skip all))) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1759 (point) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1760 (goto-char pos) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1761 nil))))) |
11516
e7c26522b881
Use new fortran-match-!-comment to do !-style fontification; do rest in regexps
Simon Marshall <simon@gnu.org>
parents:
10883
diff
changeset
|
1762 |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1763 ;; From: ralf@up3aud1.gwdg.de (Ralf Fassel) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1764 ;; Test if TAB format continuation lines work. |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1765 (defun fortran-is-in-string-p (where) |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1766 "Return non-nil iff WHERE (a buffer position) is inside a Fortran string." |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1767 (save-excursion |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1768 (goto-char where) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1769 (cond |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1770 ((bolp) nil) ; bol is never inside a string |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1771 ((save-excursion ; comment lines too |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1772 (beginning-of-line) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1773 (looking-at fortran-comment-line-start-skip)) nil) |
50611 | 1774 (t (let ((parse-state '(0 nil nil nil nil nil 0)) |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1775 (quoted-comment-start (if comment-start |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1776 (regexp-quote comment-start))) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1777 (not-done t) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1778 parse-limit end-of-line) |
50611 | 1779 ;; Move to start of current statement. |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1780 (fortran-next-statement) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1781 (fortran-previous-statement) |
50611 | 1782 ;; Now parse up to WHERE. |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1783 (while not-done |
50611 | 1784 (if (or ;; Skip to next line if: |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1785 ;; - comment line? |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1786 (looking-at fortran-comment-line-start-skip) |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1787 ;; - at end of line? |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1788 (eolp) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1789 ;; - not in a string and after comment-start? |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1790 (and (not (nth 3 parse-state)) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1791 comment-start |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1792 (equal comment-start |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1793 (char-to-string (preceding-char))))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1794 (if (> (forward-line) 0) |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1795 (setq not-done nil)) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1796 ;; else: |
50611 | 1797 ;; If we are at beginning of code line, skip any |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1798 ;; whitespace, labels and tab continuation markers. |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1799 (if (bolp) (skip-chars-forward " \t0-9")) |
50611 | 1800 ;; If we are in column <= 5 now, check for continuation char. |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1801 (cond ((= 5 (current-column)) (forward-char 1)) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1802 ((and (< (current-column) 5) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1803 (equal fortran-continuation-string |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1804 (char-to-string (following-char))) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1805 (forward-char 1)))) |
50611 | 1806 ;; Find out parse-limit from here. |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1807 (setq end-of-line (line-end-position)) |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1808 (setq parse-limit (min where end-of-line)) |
50611 | 1809 ;; Parse max up to comment-start, if non-nil and in current line. |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1810 (if comment-start |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1811 (save-excursion |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1812 (if (re-search-forward quoted-comment-start end-of-line t) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1813 (setq parse-limit (min (point) parse-limit))))) |
50611 | 1814 ;; Now parse if still in limits. |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1815 (if (< (point) where) |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1816 (setq parse-state (parse-partial-sexp |
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1817 (point) parse-limit nil nil parse-state)) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1818 (setq not-done nil)))) |
50611 | 1819 ;; Result. |
3400
927c3d8374ef
(fortran-mode): Replace comment-indent-hook with
Richard M. Stallman <rms@gnu.org>
parents:
2307
diff
changeset
|
1820 (nth 3 parse-state)))))) |
1548 | 1821 |
31847 | 1822 ;; From old version. |
1823 (defalias 'fortran-auto-fill-mode 'auto-fill-mode) | |
1548 | 1824 |
12772
f4b2913b7f58
(fortran-auto-fill-mode, fortran-do-auto-fill, fortran-fill):
Richard M. Stallman <rms@gnu.org>
parents:
12715
diff
changeset
|
1825 (defun fortran-fill () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1826 "Fill the current line at an appropriate point(s)." |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1827 (let* ((auto-fill-function #'fortran-auto-fill) |
24800 | 1828 (opoint (point)) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1829 (bol (line-beginning-position)) |
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1830 (eol (line-end-position)) |
1548 | 1831 (bos (min eol (+ bol (fortran-current-line-indentation)))) |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1832 ;; If in a string at fill-column, break it either before the |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1833 ;; initial quote, or at fill-col (if string is too long). |
1548 | 1834 (quote |
1835 (save-excursion | |
1836 (goto-char bol) | |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1837 ;; OK to break quotes on comment lines. |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1838 (unless (looking-at fortran-comment-line-start-skip) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1839 (let (fcpoint start) |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1840 (move-to-column fill-column) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1841 (when (fortran-is-in-string-p (setq fcpoint (point))) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1842 (save-excursion |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1843 (re-search-backward "\\S\"\\s\"\\S\"?" bol t) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1844 (setq start |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1845 (if fortran-break-before-delimiters |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1846 (point) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1847 (1+ (point))))) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1848 (if (re-search-forward "\\S\"\\s\"\\S\"" eol t) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1849 (backward-char 2)) |
61107
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1850 ;; If the current string is longer than (fill-column |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1851 ;; - 6) chars, break it at the fill column (else |
9554f19ae068
Reformat and update copyright years.
Glenn Morris <rgm@gnu.org>
parents:
59996
diff
changeset
|
1852 ;; infinite loop). |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1853 (if (> (- (point) start) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1854 (- fill-column 6 fortran-continuation-indent)) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1855 fcpoint |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1856 start)))))) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1857 ;; Decide where to split the line. If a position for a quoted |
1548 | 1858 ;; string was found above then use that, else break the line |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1859 ;; before/after the last delimiter. |
1548 | 1860 (fill-point |
1861 (or quote | |
1862 (save-excursion | |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1863 ;; If f-b-b-d is t, have an extra column to play with, |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1864 ;; since delimiter gets shifted to new line. |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1865 (move-to-column (if fortran-break-before-delimiters |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1866 (1+ fill-column) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1867 fill-column)) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1868 (let ((repeat t)) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1869 (while repeat |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1870 (setq repeat nil) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1871 ;; Adapted from f90-find-breakpoint. |
55251
f5da8d364dba
(fortran-fill): Use local var `bol' rather than duplicate call to
Glenn Morris <rgm@gnu.org>
parents:
53700
diff
changeset
|
1872 (re-search-backward fortran-break-delimiters-re bol) |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1873 (if (not fortran-break-before-delimiters) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1874 (if (looking-at fortran-no-break-re) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1875 ;; Deal with cases such as "**" split over |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1876 ;; fill-col. Simpler alternative would be |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1877 ;; to start from (1- fill-column) above. |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1878 (if (> (+ 2 (current-column)) fill-column) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1879 (setq repeat t) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1880 (forward-char 2)) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1881 (forward-char 1)) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1882 (backward-char) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1883 (or (looking-at fortran-no-break-re) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1884 (forward-char))))) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1885 ;; Line indented beyond fill-column? |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1886 (when (<= (point) bos) |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1887 (move-to-column (1+ fill-column)) |
50611 | 1888 ;; What is this doing??? |
50579
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1889 (or (re-search-forward "[\t\n,'+-/*)=]" eol t) |
603b312a33d1
(fortran-previous-statement): Check for fortran-continuation-string.
Glenn Morris <rgm@gnu.org>
parents:
50561
diff
changeset
|
1890 (goto-char bol))) |
1548 | 1891 (if (bolp) |
53700
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1892 (re-search-forward "[ \t]" opoint t)) |
444062830592
(fortran-break-before-delimiters): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
1893 (point))))) |
50611 | 1894 ;; If we are in an in-line comment, don't break unless the |
1548 | 1895 ;; line of code is longer than it should be. Otherwise |
1896 ;; break the line at the column computed above. | |
1897 ;; | |
50611 | 1898 ;; Need to use fortran-find-comment-start-skip to make sure that |
1899 ;; quoted !'s don't prevent a break. | |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1900 (when (and (save-excursion |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1901 (beginning-of-line) |
49755
fb628fd7f726
(fortran-fill): Fill lines that do not have comments.
Glenn Morris <rgm@gnu.org>
parents:
49751
diff
changeset
|
1902 (if (not (fortran-find-comment-start-skip)) |
fb628fd7f726
(fortran-fill): Fill lines that do not have comments.
Glenn Morris <rgm@gnu.org>
parents:
49751
diff
changeset
|
1903 t |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1904 (goto-char (match-beginning 0)) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1905 (>= (point) fill-point))) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1906 (save-excursion |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1907 (goto-char fill-point) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1908 (not (bolp))) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1909 (> (save-excursion |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1910 (goto-char opoint) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1911 (current-column)) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1912 (min (1+ fill-column) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1913 (+ (fortran-calculate-indent) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1914 fortran-continuation-indent)))) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1915 (goto-char fill-point) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1916 (fortran-break-line) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1917 (end-of-line)))) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1918 |
1548 | 1919 (defun fortran-break-line () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1920 "Call `fortran-split-line'. Joins continuation lines first, then refills." |
68244
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
1921 (let ((bol (line-beginning-position)) |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1922 (comment-string |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1923 (save-excursion |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1924 (if (fortran-find-comment-start-skip) |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1925 (delete-and-extract-region |
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1926 (match-beginning 0) (line-end-position)))))) |
50611 | 1927 ;; Forward line 1 really needs to go to next non white line. |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1928 (if (save-excursion (forward-line) |
43882
e601e469e7a4
(fortran-mode): Set comment-padding to "$$$".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42443
diff
changeset
|
1929 (looking-at " \\{5\\}[^ 0\n]\\|\t[1-9]")) |
1548 | 1930 (progn |
12715
ad18c3ad23b3
(fortran-break-line): Fixed a bug that sometimes
Richard M. Stallman <rms@gnu.org>
parents:
12386
diff
changeset
|
1931 (end-of-line) |
ad18c3ad23b3
(fortran-break-line): Fixed a bug that sometimes
Richard M. Stallman <rms@gnu.org>
parents:
12386
diff
changeset
|
1932 (delete-region (point) (match-end 0)) |
1548 | 1933 (delete-horizontal-space) |
12772
f4b2913b7f58
(fortran-auto-fill-mode, fortran-do-auto-fill, fortran-fill):
Richard M. Stallman <rms@gnu.org>
parents:
12715
diff
changeset
|
1934 (fortran-fill)) |
1548 | 1935 (fortran-split-line)) |
1936 (if comment-string | |
1937 (save-excursion | |
1938 (goto-char bol) | |
1939 (end-of-line) | |
1940 (delete-horizontal-space) | |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1941 (indent-to (fortran-comment-indent)) |
1548 | 1942 (insert comment-string))))) |
1943 | |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1944 (defun fortran-analyze-file-format () |
20805
918448e5d294
Various docstring and commentary fixes, including
Dave Love <fx@gnu.org>
parents:
20277
diff
changeset
|
1945 "Return nil if fixed format is used, t if TAB formatting is used. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1946 Use `fortran-tab-mode-default' if no non-comment statements are found |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1947 before the end or in the first `fortran-analyze-depth' lines." |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1948 (let ((i 0)) |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1949 (save-excursion |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1950 (goto-char (point-min)) |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1951 (while (not (or |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1952 (eobp) |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1953 (eq (char-after) ?\t) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1954 (looking-at " \\{6\\}") |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1955 (> i fortran-analyze-depth))) |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1956 (forward-line) |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1957 (setq i (1+ i))) |
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1958 (cond |
26560
edf06ac56d1f
(fortran-comment-line-start): Renamed from comment-line-start.
Dave Love <fx@gnu.org>
parents:
25162
diff
changeset
|
1959 ((eq (char-after) ?\t) t) |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1960 ((looking-at " \\{6\\}") nil) |
50600
418cea060d92
(fortran-tab-mode-minor-mode-string): Delete this variable,
Glenn Morris <rgm@gnu.org>
parents:
50598
diff
changeset
|
1961 (t fortran-tab-mode-default))))) |
1633
65af7bcd5e31
* fortran.el: New version of version 1.30 (!) from Stephen A. Wood
Jim Blandy <jimb@redhat.com>
parents:
1611
diff
changeset
|
1962 |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1963 (defun fortran-fill-paragraph (&optional justify) |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1964 "Fill surrounding comment block as paragraphs, else fill statement. |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1965 Intended as the value of `fill-paragraph-function'. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1966 A comment block is filled by calling `fill-comment-paragraph' with |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1967 argument JUSTIFY, otherwise `fortran-fill-statement' is called. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1968 Always returns non-nil (to prevent `fill-paragraph' being called)." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1969 (interactive "*P") |
49751
cc3cda196420
(fortran-mode): Set comment-use-syntax.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48815
diff
changeset
|
1970 (or (fill-comment-paragraph justify) |
cc3cda196420
(fortran-mode): Set comment-use-syntax.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48815
diff
changeset
|
1971 (fortran-fill-statement) |
cc3cda196420
(fortran-mode): Set comment-use-syntax.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
48815
diff
changeset
|
1972 t)) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1973 |
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1974 (defun fortran-fill-statement () |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1975 "Fill a Fortran statement up to `fill-column'." |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1976 (interactive "*") |
30149
1c8c6dbfcfb9
Don't require easymenu. Use repeat counts in various regexps.
Dave Love <fx@gnu.org>
parents:
28079
diff
changeset
|
1977 (let ((auto-fill-function #'fortran-auto-fill)) |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1978 (unless (save-excursion |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1979 (beginning-of-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1980 (or (looking-at "[ \t]*$") |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1981 (looking-at fortran-comment-line-start-skip) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1982 (and comment-start-skip |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1983 (looking-at (concat "[ \t]*" comment-start-skip))))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1984 (save-excursion |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1985 ;; Find beginning of statement. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1986 (fortran-next-statement) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1987 (fortran-previous-statement) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1988 ;; Re-indent initially. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1989 (fortran-indent-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1990 ;; Replace newline plus continuation field plus indentation with |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1991 ;; single space. |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1992 (while (progn |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1993 (forward-line) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1994 (fortran-remove-continuation))) |
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
1995 (fortran-previous-statement))) |
24800 | 1996 (fortran-indent-line))) |
21410
d68f866455c6
Use regexp-opt and eval-and-compile to
Dave Love <fx@gnu.org>
parents:
21167
diff
changeset
|
1997 |
45067
b7f97570f3f7
(fortran-strip-sequence-nos): Rename from typo `fortran-strip-sqeuence-nos'.
Glenn Morris <rgm@gnu.org>
parents:
44726
diff
changeset
|
1998 (defun fortran-strip-sequence-nos (&optional do-space) |
36171
5d300b531da9
(fortran-strip-sqeuence-nos): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
35244
diff
changeset
|
1999 "Delete all text in column 72 and up (assumed to be sequence numbers). |
5d300b531da9
(fortran-strip-sqeuence-nos): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
35244
diff
changeset
|
2000 Normally also deletes trailing whitespace after stripping such text. |
5d300b531da9
(fortran-strip-sqeuence-nos): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
35244
diff
changeset
|
2001 Supplying prefix arg DO-SPACE prevents stripping the whitespace." |
50598
5f26cbba48ba
Whitespace changes, some re-ordering of code, trivial commentary change.
Glenn Morris <rgm@gnu.org>
parents:
50579
diff
changeset
|
2002 (interactive "*p") |
26665
4aede027bedb
(fortran-strip-sqeuence-nos): New command.
Dave Love <fx@gnu.org>
parents:
26560
diff
changeset
|
2003 (save-excursion |
4aede027bedb
(fortran-strip-sqeuence-nos): New command.
Dave Love <fx@gnu.org>
parents:
26560
diff
changeset
|
2004 (goto-char (point-min)) |
35244
682d1ffa0b5e
(fortran-mode-map): Modify Customization
Dave Love <fx@gnu.org>
parents:
33947
diff
changeset
|
2005 (while (re-search-forward "^.\\{72\\}\\(.*\\)" nil t) |
26665
4aede027bedb
(fortran-strip-sqeuence-nos): New command.
Dave Love <fx@gnu.org>
parents:
26560
diff
changeset
|
2006 (replace-match "" nil nil nil 1) |
4aede027bedb
(fortran-strip-sqeuence-nos): New command.
Dave Love <fx@gnu.org>
parents:
26560
diff
changeset
|
2007 (unless do-space (delete-horizontal-space))))) |
4aede027bedb
(fortran-strip-sqeuence-nos): New command.
Dave Love <fx@gnu.org>
parents:
26560
diff
changeset
|
2008 |
28079
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
2009 ;; This code used to live in add-log.el, but this is a better place |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
2010 ;; for it. |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
2011 (defun fortran-current-defun () |
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
2012 "Function to use for `add-log-current-defun-function' in Fortran mode." |
46979
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2013 (save-excursion |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2014 ;; We must be inside function body for this to work. |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2015 (fortran-beginning-of-subprogram) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2016 (let ((case-fold-search t)) ; case-insensitive |
50611 | 2017 ;; Search for fortran subprogram start. |
46979
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2018 (if (re-search-forward |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2019 (concat "^[ \t]*\\(program\\|subroutine\\|function" |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2020 "\\|[ \ta-z0-9*()]*[ \t]+function\\|" |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2021 "\\(block[ \t]*data\\)\\)") |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2022 (save-excursion (fortran-end-of-subprogram) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2023 (point)) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2024 t) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2025 (or (match-string-no-properties 2) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2026 (progn |
50611 | 2027 ;; Move to EOL or before first left paren. |
46979
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2028 (if (re-search-forward "[(\n]" nil t) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2029 (progn (backward-char) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2030 (skip-chars-backward " \t")) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2031 (end-of-line)) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2032 ;; Use the name preceding that. |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2033 (buffer-substring-no-properties (point) (progn (backward-sexp) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2034 (point))))) |
0ea82abe061c
(fortran-current-defun): Use save-excursion.
Glenn Morris <rgm@gnu.org>
parents:
45345
diff
changeset
|
2035 "main")))) |
28079
07cbc9269fbc
(fortran-comment-line-start): Define as
Dave Love <fx@gnu.org>
parents:
27417
diff
changeset
|
2036 |
584 | 2037 (provide 'fortran) |
2038 | |
68244
d5d3ecca3943
Move defvars out of eval-when-compile.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
66963
diff
changeset
|
2039 ;; arch-tag: 74935096-21c4-4cab-8ee5-6ef16090dc04 |
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2040 ;;; fortran.el ends here |