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