diff options
| author | Richard M. Stallman | 1995-10-17 03:33:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-10-17 03:33:46 +0000 |
| commit | 5e1cecee20f6745014f2b2a0fff80d89a5b37206 (patch) | |
| tree | f05f0b3bc9ae4fe0a7125bc08852cb908f78079c | |
| parent | 7c36a59a73e46a852aff9351792bd1077253cdb0 (diff) | |
| download | emacs-5e1cecee20f6745014f2b2a0fff80d89a5b37206.tar.gz emacs-5e1cecee20f6745014f2b2a0fff80d89a5b37206.zip | |
All doc strings changed to comply with standard Emacs conventions.
(ada-mode): Support new font-lock-mode.
(ada-format-paramlist): Changed all `accept' to `access'.
(ada-insert-paramlist): Changed all `accept' to `access'.
(ada-in-comment-p): Use standard Emacs way `parse-partial-sexp'.
(ada-font-lock-keywords-1): Change order of some alternatives.
| -rw-r--r-- | lisp/progmodes/ada-mode.el | 198 |
1 files changed, 109 insertions, 89 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el index 13a3a7134d0..1dace8d055f 100644 --- a/lisp/progmodes/ada-mode.el +++ b/lisp/progmodes/ada-mode.el | |||
| @@ -112,15 +112,13 @@ Examples are 'is', 'loop', 'record', ...") | |||
| 112 | "*Defines the indentation for 'record' relative to 'type' or 'use'.") | 112 | "*Defines the indentation for 'record' relative to 'type' or 'use'.") |
| 113 | 113 | ||
| 114 | (defvar ada-indent-comment-as-code t | 114 | (defvar ada-indent-comment-as-code t |
| 115 | "*If non-nil, comment-lines get indented as ada-code.") | 115 | "*If non-nil, comment-lines get indented as Ada code.") |
| 116 | 116 | ||
| 117 | (defvar ada-indent-is-separate t | 117 | (defvar ada-indent-is-separate t |
| 118 | "*If non-nil, 'is separate' or 'is abstract' on a separate line are | 118 | "*If non-nil, 'is separate' or 'is abstract' on a single line are indented.") |
| 119 | indented.") | ||
| 120 | 119 | ||
| 121 | (defvar ada-indent-to-open-paren t | 120 | (defvar ada-indent-to-open-paren t |
| 122 | "*If non-nil, following lines get indented according to the innermost | 121 | "*If non-nil, indent according to the innermost open parenthesis.") |
| 123 | open parenthesis.") | ||
| 124 | 122 | ||
| 125 | (defvar ada-search-paren-char-count-limit 3000 | 123 | (defvar ada-search-paren-char-count-limit 3000 |
| 126 | "*Search that many characters for an open parenthesis.") | 124 | "*Search that many characters for an open parenthesis.") |
| @@ -130,16 +128,17 @@ open parenthesis.") | |||
| 130 | 128 | ||
| 131 | (defvar ada-tab-policy 'indent-auto | 129 | (defvar ada-tab-policy 'indent-auto |
| 132 | "*Control behaviour of the TAB key. | 130 | "*Control behaviour of the TAB key. |
| 133 | Must be one of 'indent-rigidly, 'indent-auto, 'gei, 'indent-af or 'always-tab. | 131 | Must be one of `indent-rigidly', `indent-auto', `gei', `indent-af' |
| 132 | or `always-tab'. | ||
| 134 | 133 | ||
| 135 | 'indent-rigidly : always adds ada-indent blanks at the beginning of the line. | 134 | `indent-rigidly' : always adds ada-indent blanks at the beginning of the line. |
| 136 | 'indent-auto : use indentation functions in this file. | 135 | `indent-auto' : use indentation functions in this file. |
| 137 | 'gei : use David Kågedal's Generic Indentation Engine. | 136 | `gei' : use David Kågedal's Generic Indentation Engine. |
| 138 | 'indent-af : use Gary E. Barnes' ada-format.el | 137 | `indent-af' : use Gary E. Barnes' ada-format.el |
| 139 | 'always-tab : do indent-relative.") | 138 | `always-tab' : do indent-relative.") |
| 140 | 139 | ||
| 141 | (defvar ada-move-to-declaration nil | 140 | (defvar ada-move-to-declaration nil |
| 142 | "*If non-nil, ada-move-to-start moves point to the subprog-declaration, | 141 | "*If non-nil, `ada-move-to-start' moves point to the subprog declaration, |
| 143 | not to 'begin'.") | 142 | not to 'begin'.") |
| 144 | 143 | ||
| 145 | (defvar ada-spec-suffix ".ads" | 144 | (defvar ada-spec-suffix ".ads" |
| @@ -149,26 +148,30 @@ not to 'begin'.") | |||
| 149 | "*Suffix of Ada body files.") | 148 | "*Suffix of Ada body files.") |
| 150 | 149 | ||
| 151 | (defvar ada-language-version 'ada95 | 150 | (defvar ada-language-version 'ada95 |
| 152 | "*Do we program in 'ada83 or 'ada95?") | 151 | "*Do we program in `ada83' or `ada95'?") |
| 153 | 152 | ||
| 154 | (defvar ada-case-keyword 'downcase-word | 153 | (defvar ada-case-keyword 'downcase-word |
| 155 | "*downcase-word, upcase-word, ada-loose-case-word or capitalize-word | 154 | "*Function to call to adjust the case of Ada keyworrds. |
| 156 | to adjust ada keywords case.") | 155 | It may be `downcase-word', `upcase-word', `ada-loose-case-word' or |
| 156 | `capitalize-word'.") | ||
| 157 | 157 | ||
| 158 | (defvar ada-case-identifier 'ada-loose-case-word | 158 | (defvar ada-case-identifier 'ada-loose-case-word |
| 159 | "*downcase-word, upcase-word, ada-loose-case-word or capitalize-word | 159 | "*Function to call to adjust the case of an Ada identifier. |
| 160 | to adjust ada identifier case.") | 160 | It may be `downcase-word', `upcase-word', `ada-loose-case-word' or |
| 161 | `capitalize-word'.") | ||
| 161 | 162 | ||
| 162 | (defvar ada-case-attribute 'capitalize-word | 163 | (defvar ada-case-attribute 'capitalize-word |
| 163 | "*downcase-word, upcase-word, ada-loose-case-word or capitalize-word | 164 | "*Function to call to adjust the case of Ada attributes. |
| 164 | to adjust ada identifier case.") | 165 | It may be `downcase-word', `upcase-word', `ada-loose-case-word' or |
| 166 | `capitalize-word'.") | ||
| 165 | 167 | ||
| 166 | (defvar ada-auto-case t | 168 | (defvar ada-auto-case t |
| 167 | "*Non-nil automatically changes casing of preceeding word while typing. | 169 | "*Non-nil automatically changes casing of preceeding word while typing. |
| 168 | Casing is done according to ada-case-keyword and ada-case-identifier.") | 170 | Casing is done according to `ada-case-keyword', `ada-case-identifier' |
| 171 | and `ada-cacse-attribute'.") | ||
| 169 | 172 | ||
| 170 | (defvar ada-clean-buffer-before-saving nil | 173 | (defvar ada-clean-buffer-before-saving nil |
| 171 | "*If non-nil, remove-trailing-spaces and untabify buffer before saving.") | 174 | "*If non-nil, `remove-trailing-spaces' and `untabify' buffer before saving.") |
| 172 | 175 | ||
| 173 | (defvar ada-mode-hook nil | 176 | (defvar ada-mode-hook nil |
| 174 | "*List of functions to call when Ada Mode is invoked. | 177 | "*List of functions to call when Ada Mode is invoked. |
| @@ -184,8 +187,8 @@ This is a good place to add Ada environment specific bindings.") | |||
| 184 | "*This is inserted in the first columns when filling a comment paragraph.") | 187 | "*This is inserted in the first columns when filling a comment paragraph.") |
| 185 | 188 | ||
| 186 | (defvar ada-fill-comment-postfix " --" | 189 | (defvar ada-fill-comment-postfix " --" |
| 187 | "*This is inserted at the end of each line when filling a comment paragraph | 190 | "*This is inserted at the end of each line when filling a comment paragraph. |
| 188 | with ada-fill-comment-paragraph postfix.") | 191 | with `ada-fill-comment-paragraph-postfix'.") |
| 189 | 192 | ||
| 190 | (defvar ada-krunch-args "0" | 193 | (defvar ada-krunch-args "0" |
| 191 | "*Argument of gnatk8, a string containing the max number of characters. | 194 | "*Argument of gnatk8, a string containing the max number of characters. |
| @@ -199,7 +202,7 @@ Set to 0, if you dont use crunched filenames.") | |||
| 199 | (define-abbrev-table 'ada-mode-abbrev-table ()) | 202 | (define-abbrev-table 'ada-mode-abbrev-table ()) |
| 200 | 203 | ||
| 201 | (defvar ada-mode-map () | 204 | (defvar ada-mode-map () |
| 202 | "Local keymap used for ada-mode.") | 205 | "Local keymap used for Ada Mode.") |
| 203 | 206 | ||
| 204 | (defvar ada-mode-syntax-table nil | 207 | (defvar ada-mode-syntax-table nil |
| 205 | "Syntax table to be used for editing Ada source code.") | 208 | "Syntax table to be used for editing Ada source code.") |
| @@ -216,6 +219,16 @@ new\\|not\\|null\\|of\\|or\\|others\\|out\\|package\\|pragma\\|\ | |||
| 216 | private\\|procedure\\|raise\\|range\\|record\\|rem\\|renames\\|\ | 219 | private\\|procedure\\|raise\\|range\\|record\\|rem\\|renames\\|\ |
| 217 | return\\|reverse\\|select\\|separate\\|subtype\\|task\\|terminate\\|\ | 220 | return\\|reverse\\|select\\|separate\\|subtype\\|task\\|terminate\\|\ |
| 218 | then\\|type\\|use\\|when\\|while\\|with\\|xor\\)\\>" | 221 | then\\|type\\|use\\|when\\|while\\|with\\|xor\\)\\>" |
| 222 | ; "\\<\\(a\\(b\\(ort\\|s\\)\\|cce\\(pt\\|ss\\)\\|ll\\|nd\\|rray\\|t\\)\\|\ | ||
| 223 | ;b\\(egin\\|ody\\)\\|c\\(ase\\|onstant\\)\\|\ | ||
| 224 | ;d\\(e\\(clare\\|l\\(ay\\|ta\\)\\)\\|igits\\|o\\)\\|\ | ||
| 225 | ;e\\(ls\\(e\\|if\\)\\|n\\(d\\|try\\)\\|x\\(ception\\|it\\)\\)\\|\ | ||
| 226 | ;f\\(or\\|unction\\)\\|g\\(eneric\\|oto\\)\\|i[fns]\\|l\\(imited\\|oop\\)\\|\ | ||
| 227 | ;mod\\|n\\(ew\\|ot\\|ull\\)\\|o\\([fr]\\|thers\\|ut\\)\\|\ | ||
| 228 | ;p\\(ackage\\|r\\(agma\\|ivate\\|ocedure\\)\\)\\|\ | ||
| 229 | ;r\\(a\\(ise\\|nge\\)\\|e\\(cord\\|m\\|names\\|turn\\|verse\\)\\)\\|\ | ||
| 230 | ;s\\(e\\(lect\\|parate\\)\\|ubtype\\)\\|use\\| | ||
| 231 | ;t\\(ask\\|erminate\\|hen\\|ype\\)\\|w\\(h\\(en\\|ile\\)\\|ith\\)\\|xor\\)\\>" | ||
| 219 | "regular expression for looking at Ada83 keywords.") | 232 | "regular expression for looking at Ada83 keywords.") |
| 220 | 233 | ||
| 221 | (defconst ada-95-keywords | 234 | (defconst ada-95-keywords |
| @@ -231,7 +244,7 @@ type\\|until\\|use\\|when\\|while\\|with\\|xor\\)\\>" | |||
| 231 | "regular expression for looking at Ada95 keywords.") | 244 | "regular expression for looking at Ada95 keywords.") |
| 232 | 245 | ||
| 233 | (defvar ada-keywords ada-95-keywords | 246 | (defvar ada-keywords ada-95-keywords |
| 234 | "regular expression for looking at Ada keywords.") | 247 | "Regular expression for looking at Ada keywords.") |
| 235 | 248 | ||
| 236 | (defvar ada-ret-binding nil | 249 | (defvar ada-ret-binding nil |
| 237 | "Variable to save key binding of RET when casing is activated.") | 250 | "Variable to save key binding of RET when casing is activated.") |
| @@ -260,7 +273,7 @@ type\\|until\\|use\\|when\\|while\\|with\\|xor\\)\\>" | |||
| 260 | "\\<\\(begin\\|select\\|declare\\|private\\|or\\|generic\\|\ | 273 | "\\<\\(begin\\|select\\|declare\\|private\\|or\\|generic\\|\ |
| 261 | exception\\|loop\\|else\\|\ | 274 | exception\\|loop\\|else\\|\ |
| 262 | \\(\\(limited\\|abstract\\|tagged\\)[ \t]+\\)*record\\)\\>" | 275 | \\(\\(limited\\|abstract\\|tagged\\)[ \t]+\\)*record\\)\\>" |
| 263 | "Regexp for keywords starting ada-blocks.") | 276 | "Regexp for keywords starting Ada blocks.") |
| 264 | 277 | ||
| 265 | (defvar ada-end-stmt-re | 278 | (defvar ada-end-stmt-re |
| 266 | "\\(;\\|=>\\|^[ \t]*separate[ \t]+([a-zA-Z0-9_\\.]+)\\|\ | 279 | "\\(;\\|=>\\|^[ \t]*separate[ \t]+([a-zA-Z0-9_\\.]+)\\|\ |
| @@ -269,7 +282,7 @@ declare\\|generic\\|private\\)\\>\\|\ | |||
| 269 | ^[ \t]*\\(package\\|procedure\\|function\\)[ \ta-zA-Z0-9_\\.]+is\\|\ | 282 | ^[ \t]*\\(package\\|procedure\\|function\\)[ \ta-zA-Z0-9_\\.]+is\\|\ |
| 270 | ^[ \t]*exception\\>\\)" | 283 | ^[ \t]*exception\\>\\)" |
| 271 | "Regexp of possible ends for a non-broken statement. | 284 | "Regexp of possible ends for a non-broken statement. |
| 272 | 'end' means that there has to start a new statement after these.") | 285 | A new statement starts after these.") |
| 273 | 286 | ||
| 274 | (defvar ada-loop-start-re | 287 | (defvar ada-loop-start-re |
| 275 | "\\<\\(for\\|while\\|loop\\)\\>" | 288 | "\\<\\(for\\|while\\|loop\\)\\>" |
| @@ -298,9 +311,9 @@ task\\|accept\\|entry\\)\\>" | |||
| 298 | (string-match "XEmacs" emacs-version))) | 311 | (string-match "XEmacs" emacs-version))) |
| 299 | 312 | ||
| 300 | (defun ada-create-syntax-table () | 313 | (defun ada-create-syntax-table () |
| 301 | "Create the syntax table for ada-mode." | 314 | "Create the syntax table for Ada Mode." |
| 302 | ;; There are two different syntax-tables. The standard one declares | 315 | ;; There are two different syntax-tables. The standard one declares |
| 303 | ;; `_' a symbol constituent, in the second one, it is a word | 316 | ;; `_' as a symbol constituent, in the second one, it is a word |
| 304 | ;; constituent. For some search and replacing routines we | 317 | ;; constituent. For some search and replacing routines we |
| 305 | ;; temporarily switch between the two. | 318 | ;; temporarily switch between the two. |
| 306 | (setq ada-mode-syntax-table (make-syntax-table)) | 319 | (setq ada-mode-syntax-table (make-syntax-table)) |
| @@ -440,7 +453,12 @@ If you use ada-xref.el: | |||
| 440 | (setq imenu-generic-expression ada-imenu-generic-expression) | 453 | (setq imenu-generic-expression ada-imenu-generic-expression) |
| 441 | 454 | ||
| 442 | (make-local-variable 'font-lock-defaults) | 455 | (make-local-variable 'font-lock-defaults) |
| 443 | (setq font-lock-defaults '(ada-font-lock-keywords nil t ((?\_ . "w")))) | 456 | (setq font-lock-defaults '((ada-font-lock-keywords |
| 457 | ada-font-lock-keywords-1 | ||
| 458 | ada-font-lock-keywords-2) | ||
| 459 | nil t | ||
| 460 | ((?\_ . "w")) | ||
| 461 | beginning-of-line)) | ||
| 444 | 462 | ||
| 445 | (setq major-mode 'ada-mode) | 463 | (setq major-mode 'ada-mode) |
| 446 | (setq mode-name "Ada") | 464 | (setq mode-name "Ada") |
| @@ -499,9 +517,9 @@ Prompts for a postfix to be appended to each line." | |||
| 499 | (defun ada-fill-comment-paragraph (&optional justify postfix) | 517 | (defun ada-fill-comment-paragraph (&optional justify postfix) |
| 500 | "Fills the current comment paragraph. | 518 | "Fills the current comment paragraph. |
| 501 | If JUSTIFY is non-nil, each line is justified as well. | 519 | If JUSTIFY is non-nil, each line is justified as well. |
| 502 | If POSTFIX and JUSTIFY are non-nil, ada-fill-comment-postfix is appended | 520 | If POSTFIX and JUSTIFY are non-nil, `ada-fill-comment-postfix' is appended |
| 503 | to each filled and justified line. | 521 | to each filled and justified line. |
| 504 | If ada-indent-comment-as code is non-nil, the paragraph is idented." | 522 | If `ada-indent-comment-as-code' is non-nil, the paragraph is idented." |
| 505 | (interactive "P") | 523 | (interactive "P") |
| 506 | (let ((opos (point-marker)) | 524 | (let ((opos (point-marker)) |
| 507 | (begin nil) | 525 | (begin nil) |
| @@ -639,11 +657,11 @@ If ada-indent-comment-as code is non-nil, the paragraph is idented." | |||
| 639 | 657 | ||
| 640 | (defun ada-call-pretty-printer () | 658 | (defun ada-call-pretty-printer () |
| 641 | "Calls the external Pretty Printer. | 659 | "Calls the external Pretty Printer. |
| 642 | The name is specified in ada-external-pretty-print-program. Saves the | 660 | The name is specified in `ada-external-pretty-print-program'. Saves the |
| 643 | current buffer in a directory specified by ada-tmp-directory, | 661 | current buffer in a directory specified by `ada-tmp-directory', |
| 644 | starts the Pretty Printer as external process on that file and then | 662 | starts the pretty printer as external process on that file and then |
| 645 | reloads the beautyfied program in the buffer and cleans up | 663 | reloads the beautyfied program in the buffer and cleans up |
| 646 | ada-tmp-directory." | 664 | `ada-tmp-directory'." |
| 647 | (interactive) | 665 | (interactive) |
| 648 | (let ((filename-with-path buffer-file-name) | 666 | (let ((filename-with-path buffer-file-name) |
| 649 | (curbuf (current-buffer)) | 667 | (curbuf (current-buffer)) |
| @@ -729,10 +747,10 @@ ada-tmp-directory." | |||
| 729 | 747 | ||
| 730 | 748 | ||
| 731 | (defun ada-adjust-case (&optional force-identifier) | 749 | (defun ada-adjust-case (&optional force-identifier) |
| 732 | "Adjust the case of the word before the just-typed character, | 750 | "Adjust the case of the word before the just typed character. |
| 733 | according to ada-case-keyword and ada-case-identifier | 751 | Respect options `ada-case-keyword', `ada-case-identifier', and |
| 734 | If FORCE-IDENTIFIER is non-nil then also adjust keyword as | 752 | `ada-case-attribute'. |
| 735 | identifier." ; (MH) | 753 | If FORCE-IDENTIFIER is non-nil then also adjust keyword as identifier." ; (MH) |
| 736 | (forward-char -1) | 754 | (forward-char -1) |
| 737 | (if (and (> (point) 1) (not (or (ada-in-string-p) | 755 | (if (and (> (point) 1) (not (or (ada-in-string-p) |
| 738 | (ada-in-comment-p) | 756 | (ada-in-comment-p) |
| @@ -781,7 +799,7 @@ identifier." ; (MH) | |||
| 781 | ;; save original keybindings to allow swapping ret/lfd | 799 | ;; save original keybindings to allow swapping ret/lfd |
| 782 | ;; when casing is activated | 800 | ;; when casing is activated |
| 783 | ;; the 'or ...' is there to be sure that the value will not | 801 | ;; the 'or ...' is there to be sure that the value will not |
| 784 | ;; be changed again when ada-mode is called more than once (MH) | 802 | ;; be changed again when Ada Mode is called more than once (MH) |
| 785 | (or ada-ret-binding | 803 | (or ada-ret-binding |
| 786 | (setq ada-ret-binding (key-binding "\C-M"))) | 804 | (setq ada-ret-binding (key-binding "\C-M"))) |
| 787 | (or ada-lfd-binding | 805 | (or ada-lfd-binding |
| @@ -799,7 +817,7 @@ identifier." ; (MH) | |||
| 799 | ;; added by MH | 817 | ;; added by MH |
| 800 | ;; | 818 | ;; |
| 801 | (defun ada-loose-case-word (&optional arg) | 819 | (defun ada-loose-case-word (&optional arg) |
| 802 | "Capitalizes the first and the letters following _ | 820 | "Capitalizes the first letter and the letters following `_'. |
| 803 | ARG is ignored, it's there to fit the standard casing functions' style." | 821 | ARG is ignored, it's there to fit the standard casing functions' style." |
| 804 | (let ((pos (point)) | 822 | (let ((pos (point)) |
| 805 | (first t)) | 823 | (first t)) |
| @@ -817,8 +835,8 @@ ARG is ignored, it's there to fit the standard casing functions' style." | |||
| 817 | ;; added by MH | 835 | ;; added by MH |
| 818 | ;; | 836 | ;; |
| 819 | (defun ada-adjust-case-region (from to) | 837 | (defun ada-adjust-case-region (from to) |
| 820 | "Adjusts the case of all identifiers and keywords in the region. | 838 | "Adjusts the case of all words in the region. |
| 821 | ATTENTION: This function might take very long for big regions !" | 839 | Attention: This function might take very long for big regions !" |
| 822 | (interactive "*r") | 840 | (interactive "*r") |
| 823 | (let ((begin nil) | 841 | (let ((begin nil) |
| 824 | (end nil) | 842 | (end nil) |
| @@ -867,7 +885,7 @@ ATTENTION: This function might take very long for big regions !" | |||
| 867 | ;; added by MH | 885 | ;; added by MH |
| 868 | ;; | 886 | ;; |
| 869 | (defun ada-adjust-case-buffer () | 887 | (defun ada-adjust-case-buffer () |
| 870 | "Adjusts the case of all identifiers and keywords in the whole buffer. | 888 | "Adjusts the case of all words in the whole buffer. |
| 871 | ATTENTION: This function might take very long for big buffers !" | 889 | ATTENTION: This function might take very long for big buffers !" |
| 872 | (interactive "*") | 890 | (interactive "*") |
| 873 | (ada-adjust-case-region (point-min) (point-max))) | 891 | (ada-adjust-case-region (point-min) (point-max))) |
| @@ -878,11 +896,11 @@ ATTENTION: This function might take very long for big buffers !" | |||
| 878 | ;;;------------------------;;; | 896 | ;;;------------------------;;; |
| 879 | 897 | ||
| 880 | (defun ada-format-paramlist () | 898 | (defun ada-format-paramlist () |
| 881 | "Re-formats a parameter-list. | 899 | "Reformats a parameter list. |
| 882 | ATTENTION: 1) Comments inside the list are killed ! | 900 | ATTENTION: 1) Comments inside the list are killed ! |
| 883 | 2) If the syntax is not correct (especially, if there are | 901 | 2) If the syntax is not correct (especially, if there are |
| 884 | semicolons missing), it can get totally confused ! | 902 | semicolons missing), it can get totally confused ! |
| 885 | In such a case, use 'undo', correct the syntax and try again." | 903 | In such a case, use `undo', correct the syntax and try again." |
| 886 | 904 | ||
| 887 | (interactive) | 905 | (interactive) |
| 888 | (let ((begin nil) | 906 | (let ((begin nil) |
| @@ -947,7 +965,7 @@ In such a case, use 'undo', correct the syntax and try again." | |||
| 947 | ;; of its contents. | 965 | ;; of its contents. |
| 948 | ;; The list has the following format: | 966 | ;; The list has the following format: |
| 949 | ;; | 967 | ;; |
| 950 | ;; Name of Param in? out? accept? Name of Type Default-Exp or nil | 968 | ;; Name of Param in? out? access? Name of Type Default-Exp or nil |
| 951 | ;; | 969 | ;; |
| 952 | ;; ( ('Name_Param_1' t nil t Type_Param_1 ':= expression') | 970 | ;; ( ('Name_Param_1' t nil t Type_Param_1 ':= expression') |
| 953 | ;; ('Name_Param_2' nil nil t Type_Param_2 nil) ) | 971 | ;; ('Name_Param_2' nil nil t Type_Param_2 nil) ) |
| @@ -1019,24 +1037,24 @@ In such a case, use 'undo', correct the syntax and try again." | |||
| 1019 | t))))) | 1037 | t))))) |
| 1020 | 1038 | ||
| 1021 | ;; | 1039 | ;; |
| 1022 | ;; look for 'accept' | 1040 | ;; look for 'access' |
| 1023 | ;; | 1041 | ;; |
| 1024 | (goto-char apos) | 1042 | (goto-char apos) |
| 1025 | (setq param | 1043 | (setq param |
| 1026 | (append param | 1044 | (append param |
| 1027 | (list | 1045 | (list |
| 1028 | (consp | 1046 | (consp |
| 1029 | (ada-search-ignore-string-comment "\\<accept\\>" | 1047 | (ada-search-ignore-string-comment "\\<access\\>" |
| 1030 | nil | 1048 | nil |
| 1031 | epos | 1049 | epos |
| 1032 | t))))) | 1050 | t))))) |
| 1033 | 1051 | ||
| 1034 | ;; | 1052 | ;; |
| 1035 | ;; skip 'in'/'out'/'accept' | 1053 | ;; skip 'in'/'out'/'access' |
| 1036 | ;; | 1054 | ;; |
| 1037 | (goto-char apos) | 1055 | (goto-char apos) |
| 1038 | (ada-goto-next-non-ws) | 1056 | (ada-goto-next-non-ws) |
| 1039 | (while (looking-at "\\<\\(in\\|out\\|accept\\)\\>") | 1057 | (while (looking-at "\\<\\(in\\|out\\|access\\)\\>") |
| 1040 | (forward-word 1) | 1058 | (forward-word 1) |
| 1041 | (ada-goto-next-non-ws)) | 1059 | (ada-goto-next-non-ws)) |
| 1042 | 1060 | ||
| @@ -1084,14 +1102,14 @@ In such a case, use 'undo', correct the syntax and try again." | |||
| 1084 | 1102 | ||
| 1085 | (defun ada-insert-paramlist (paramlist) | 1103 | (defun ada-insert-paramlist (paramlist) |
| 1086 | ;; Inserts a formatted PARAMLIST in the buffer. | 1104 | ;; Inserts a formatted PARAMLIST in the buffer. |
| 1087 | ;; See doc of ada-scan-paramlist for the format. | 1105 | ;; See doc of `ada-scan-paramlist' for the format. |
| 1088 | (let ((i (length paramlist)) | 1106 | (let ((i (length paramlist)) |
| 1089 | (parlen 0) | 1107 | (parlen 0) |
| 1090 | (typlen 0) | 1108 | (typlen 0) |
| 1091 | (temp 0) | 1109 | (temp 0) |
| 1092 | (inp nil) | 1110 | (inp nil) |
| 1093 | (outp nil) | 1111 | (outp nil) |
| 1094 | (acceptp nil) | 1112 | (accessp nil) |
| 1095 | (column nil) | 1113 | (column nil) |
| 1096 | (orgpoint 0) | 1114 | (orgpoint 0) |
| 1097 | (firstcol nil)) | 1115 | (firstcol nil)) |
| @@ -1135,10 +1153,10 @@ In such a case, use 'undo', correct the syntax and try again." | |||
| 1135 | (nth 2 (nth i paramlist)))) | 1153 | (nth 2 (nth i paramlist)))) |
| 1136 | 1154 | ||
| 1137 | ;; | 1155 | ;; |
| 1138 | ;; is there any 'accept' ? | 1156 | ;; is there any 'access' ? |
| 1139 | ;; | 1157 | ;; |
| 1140 | (setq acceptp | 1158 | (setq accessp |
| 1141 | (or acceptp | 1159 | (or accessp |
| 1142 | (nth 3 (nth i paramlist))))) ; end of loop | 1160 | (nth 3 (nth i paramlist))))) ; end of loop |
| 1143 | 1161 | ||
| 1144 | ;; | 1162 | ;; |
| @@ -1189,7 +1207,7 @@ In such a case, use 'undo', correct the syntax and try again." | |||
| 1189 | (insert "in ") | 1207 | (insert "in ") |
| 1190 | (if (and | 1208 | (if (and |
| 1191 | (or inp | 1209 | (or inp |
| 1192 | acceptp) | 1210 | accessp) |
| 1193 | (not (nth 3 (nth i paramlist)))) | 1211 | (not (nth 3 (nth i paramlist)))) |
| 1194 | (insert " "))) | 1212 | (insert " "))) |
| 1195 | 1213 | ||
| @@ -1200,15 +1218,15 @@ In such a case, use 'undo', correct the syntax and try again." | |||
| 1200 | (insert "out ") | 1218 | (insert "out ") |
| 1201 | (if (and | 1219 | (if (and |
| 1202 | (or outp | 1220 | (or outp |
| 1203 | acceptp) | 1221 | accessp) |
| 1204 | (not (nth 3 (nth i paramlist)))) | 1222 | (not (nth 3 (nth i paramlist)))) |
| 1205 | (insert " "))) | 1223 | (insert " "))) |
| 1206 | 1224 | ||
| 1207 | ;; | 1225 | ;; |
| 1208 | ;; insert 'accept' | 1226 | ;; insert 'access' |
| 1209 | ;; | 1227 | ;; |
| 1210 | (if (nth 3 (nth i paramlist)) | 1228 | (if (nth 3 (nth i paramlist)) |
| 1211 | (insert "accept ")) | 1229 | (insert "access ")) |
| 1212 | 1230 | ||
| 1213 | (setq column (current-column)) | 1231 | (setq column (current-column)) |
| 1214 | 1232 | ||
| @@ -1250,7 +1268,7 @@ In such a case, use 'undo', correct the syntax and try again." | |||
| 1250 | ;;;----------------------------;;; | 1268 | ;;;----------------------------;;; |
| 1251 | 1269 | ||
| 1252 | (defun ada-move-to-start () | 1270 | (defun ada-move-to-start () |
| 1253 | "Moves point to the matching start of the current end ... around point." | 1271 | "Moves point to the matching start of the current Ada structure." |
| 1254 | (interactive) | 1272 | (interactive) |
| 1255 | (let ((pos (point))) | 1273 | (let ((pos (point))) |
| 1256 | (unwind-protect | 1274 | (unwind-protect |
| @@ -1368,7 +1386,7 @@ Moves to 'begin' if in a declarative part." | |||
| 1368 | ;; ---- main functions for indentation | 1386 | ;; ---- main functions for indentation |
| 1369 | 1387 | ||
| 1370 | (defun ada-indent-region (beg end) | 1388 | (defun ada-indent-region (beg end) |
| 1371 | "Indents the region using ada-indent-current on each line." | 1389 | "Indents the region using `ada-indent-current' on each line." |
| 1372 | (interactive "*r") | 1390 | (interactive "*r") |
| 1373 | (goto-char beg) | 1391 | (goto-char beg) |
| 1374 | (let ((block-done 0) | 1392 | (let ((block-done 0) |
| @@ -1441,7 +1459,7 @@ Moves to 'begin' if in a declarative part." | |||
| 1441 | (defun ada-indent-current () | 1459 | (defun ada-indent-current () |
| 1442 | "Indents current line as Ada code. | 1460 | "Indents current line as Ada code. |
| 1443 | This works by two steps: | 1461 | This works by two steps: |
| 1444 | 1) It moves point to the end of the previous code-line. | 1462 | 1) It moves point to the end of the previous code line. |
| 1445 | Then it calls the function to calculate the indentation for the | 1463 | Then it calls the function to calculate the indentation for the |
| 1446 | following line as if a newline would be inserted there. | 1464 | following line as if a newline would be inserted there. |
| 1447 | The calculated column # is saved and the old position of point | 1465 | The calculated column # is saved and the old position of point |
| @@ -3052,8 +3070,12 @@ This works by two steps: | |||
| 3052 | 3070 | ||
| 3053 | (defun ada-in-comment-p () | 3071 | (defun ada-in-comment-p () |
| 3054 | ;; Returns t if inside a comment. | 3072 | ;; Returns t if inside a comment. |
| 3055 | (save-excursion (and (re-search-backward "\\(--\\|\n\\)" nil 1) | 3073 | ;; (save-excursion (and (re-search-backward "\\(--\\|\n\\)" nil 1) |
| 3056 | (looking-at "-")))) | 3074 | ;; (looking-at "-")))) |
| 3075 | (nth 4 (parse-partial-sexp | ||
| 3076 | (save-excursion (beginning-of-line) (point)) | ||
| 3077 | (point)))) | ||
| 3078 | |||
| 3057 | 3079 | ||
| 3058 | 3080 | ||
| 3059 | (defun ada-in-string-p () | 3081 | (defun ada-in-string-p () |
| @@ -3206,14 +3228,14 @@ This works by two steps: | |||
| 3206 | 3228 | ||
| 3207 | 3229 | ||
| 3208 | (defun ada-uncomment-region (beg end) | 3230 | (defun ada-uncomment-region (beg end) |
| 3209 | "delete comment-start at the beginning of a line in the region." | 3231 | "delete `comment-start' at the beginning of a line in the region." |
| 3210 | (interactive "r") | 3232 | (interactive "r") |
| 3211 | (comment-region beg end -1)) | 3233 | (comment-region beg end -1)) |
| 3212 | 3234 | ||
| 3213 | 3235 | ||
| 3214 | ;; define a function to support find-file.el if loaded | 3236 | ;; define a function to support find-file.el if loaded |
| 3215 | (defun ada-ff-other-window () | 3237 | (defun ada-ff-other-window () |
| 3216 | "Find other file in other window using ff-find-other-file." | 3238 | "Find other file in other window using `ff-find-other-file'." |
| 3217 | (interactive) | 3239 | (interactive) |
| 3218 | (and (fboundp 'ff-find-other-file) | 3240 | (and (fboundp 'ff-find-other-file) |
| 3219 | (ff-find-other-file t))) | 3241 | (ff-find-other-file t))) |
| @@ -3301,7 +3323,7 @@ This works by two steps: | |||
| 3301 | 3323 | ||
| 3302 | ;; Change basic functionality | 3324 | ;; Change basic functionality |
| 3303 | 3325 | ||
| 3304 | ;; substitute-key-definition is not defined equally in GNU Emacs | 3326 | ;; `substitute-key-definition' is not defined equally in GNU Emacs |
| 3305 | ;; and XEmacs, you cannot put in an optional 4th parameter in | 3327 | ;; and XEmacs, you cannot put in an optional 4th parameter in |
| 3306 | ;; XEmacs. I don't think it's necessary, so I leave it out for | 3328 | ;; XEmacs. I don't think it's necessary, so I leave it out for |
| 3307 | ;; GNU Emacs as well. If you encounter any problems with the | 3329 | ;; GNU Emacs as well. If you encounter any problems with the |
| @@ -3328,7 +3350,7 @@ This works by two steps: | |||
| 3328 | (require 'easymenu) | 3350 | (require 'easymenu) |
| 3329 | 3351 | ||
| 3330 | (defun ada-add-ada-menu () | 3352 | (defun ada-add-ada-menu () |
| 3331 | "Adds the menu 'Ada' to the menu-bar in Ada Mode." | 3353 | "Adds the menu 'Ada' to the menu bar in Ada Mode." |
| 3332 | (easy-menu-define ada-mode-menu ada-mode-map "Menu keymap for Ada mode." | 3354 | (easy-menu-define ada-mode-menu ada-mode-map "Menu keymap for Ada mode." |
| 3333 | '("Ada" | 3355 | '("Ada" |
| 3334 | ["Next Package" ada-next-package t] | 3356 | ["Next Package" ada-next-package t] |
| @@ -3410,7 +3432,7 @@ This works by two steps: | |||
| 3410 | 3432 | ||
| 3411 | ;;;###autoload | 3433 | ;;;###autoload |
| 3412 | (defun ada-make-filename-from-adaname (adaname) | 3434 | (defun ada-make-filename-from-adaname (adaname) |
| 3413 | "determine the filename of a package/procedure from its own Ada name." | 3435 | "Determine the filename of a package/procedure from its own Ada name." |
| 3414 | ;; this is done simply by calling gkrunch, when we work with GNAT. It | 3436 | ;; this is done simply by calling gkrunch, when we work with GNAT. It |
| 3415 | ;; must be a more complex function in other compiler environments. | 3437 | ;; must be a more complex function in other compiler environments. |
| 3416 | (interactive "s") | 3438 | (interactive "s") |
| @@ -3450,8 +3472,8 @@ This works by two steps: | |||
| 3450 | 3472 | ||
| 3451 | ;;; functions for placing the cursor on the corresponding subprogram | 3473 | ;;; functions for placing the cursor on the corresponding subprogram |
| 3452 | (defun ada-which-function-are-we-in () | 3474 | (defun ada-which-function-are-we-in () |
| 3453 | "Determine whether we are on a function definition/declaration and remember | 3475 | "Determine whether we are on a function definition/declaration. |
| 3454 | the name of that function." | 3476 | If that is the case remember the name of that function." |
| 3455 | 3477 | ||
| 3456 | (setq ff-function-name nil) | 3478 | (setq ff-function-name nil) |
| 3457 | 3479 | ||
| @@ -3471,7 +3493,7 @@ the name of that function." | |||
| 3471 | ;;;--------------------------------------------------- | 3493 | ;;;--------------------------------------------------- |
| 3472 | 3494 | ||
| 3473 | (defun imenu-create-ada-index (&optional regexp) | 3495 | (defun imenu-create-ada-index (&optional regexp) |
| 3474 | "create index alist for Ada files." | 3496 | "Create index alist for Ada files." |
| 3475 | (let ((index-alist '()) | 3497 | (let ((index-alist '()) |
| 3476 | prev-pos char) | 3498 | prev-pos char) |
| 3477 | (goto-char (point-min)) | 3499 | (goto-char (point-min)) |
| @@ -3522,13 +3544,14 @@ the name of that function." | |||
| 3522 | "\\<\\(" | 3544 | "\\<\\(" |
| 3523 | "accept\\|" | 3545 | "accept\\|" |
| 3524 | "entry\\|" | 3546 | "entry\\|" |
| 3525 | "function\\|" | 3547 | "function\\|" |
| 3526 | "package\\|" | 3548 | "package[ \t]+body\\|" |
| 3527 | "package[ \t]+body\\|" | 3549 | "package\\|" |
| 3528 | "procedure\\|" | 3550 | "pragma\\|" |
| 3529 | "protected\\|" | 3551 | "procedure\\|" |
| 3530 | "protected[ \t]+body\\|" | 3552 | "protected[ \t]+body\\|" |
| 3531 | "protected[ \t]+type\\|" | 3553 | "protected[ \t]+type\\|" |
| 3554 | "protected\\|" | ||
| 3532 | ;; "p\\(\\(ackage\\|rotected\\)\\(\\|[ \t]+\\(body\\|type\\)\\)\ | 3555 | ;; "p\\(\\(ackage\\|rotected\\)\\(\\|[ \t]+\\(body\\|type\\)\\)\ |
| 3533 | ;;\\|r\\(agma\\|ocedure\\)\\)\\|" | 3556 | ;;\\|r\\(agma\\|ocedure\\)\\)\\|" |
| 3534 | "task\\|" | 3557 | "task\\|" |
| @@ -3538,8 +3561,7 @@ the name of that function." | |||
| 3538 | "\\)\\>[ \t]*" | 3561 | "\\)\\>[ \t]*" |
| 3539 | "\\(\\sw+\\(\\.\\sw*\\)*\\)?") | 3562 | "\\(\\sw+\\(\\.\\sw*\\)*\\)?") |
| 3540 | '(1 font-lock-keyword-face) '(2 font-lock-function-name-face nil t))) | 3563 | '(1 font-lock-keyword-face) '(2 font-lock-function-name-face nil t))) |
| 3541 | "For consideration as a value of `ada-font-lock-keywords'. | 3564 | "Subdued level highlighting for Ada mode.") |
| 3542 | This does fairly subdued highlighting.") | ||
| 3543 | 3565 | ||
| 3544 | (defconst ada-font-lock-keywords-2 | 3566 | (defconst ada-font-lock-keywords-2 |
| 3545 | (append ada-font-lock-keywords-1 | 3567 | (append ada-font-lock-keywords-1 |
| @@ -3603,13 +3625,11 @@ This does fairly subdued highlighting.") | |||
| 3603 | ;; Goto tags. | 3625 | ;; Goto tags. |
| 3604 | '("<<\\(\\sw+\\)>>" 1 font-lock-reference-face) | 3626 | '("<<\\(\\sw+\\)>>" 1 font-lock-reference-face) |
| 3605 | )) | 3627 | )) |
| 3606 | "For consideration as a value of `ada-font-lock-keywords'. | 3628 | "Gaudy level highlighting for Ada mode.") |
| 3607 | This does a lot more highlighting.") | ||
| 3608 | 3629 | ||
| 3609 | (defvar ada-font-lock-keywords (if font-lock-maximum-decoration | 3630 | (defvar ada-font-lock-keywords ada-font-lock-keywords-2 |
| 3610 | ada-font-lock-keywords-2 | 3631 | "Default Expressions to highlight in Ada mode. |
| 3611 | ada-font-lock-keywords-1) | 3632 | See the doc to `font-lock-maximum-decoration' for user configuration.") |
| 3612 | "*Expressions to highlight in Ada mode.") | ||
| 3613 | 3633 | ||
| 3614 | ;;; | 3634 | ;;; |
| 3615 | ;;; ???? | 3635 | ;;; ???? |