aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2005-06-17 00:20:14 +0000
committerJuanma Barranquero2005-06-17 00:20:14 +0000
commit6d533a6ef87b826f43ef415083e3c8d5088dd989 (patch)
treed038fb4bdb3b98e82f47f17c8e77c6c1cc701ce7
parent67c1390d8c1264ff5e58ef6b25a5c33c91a40086 (diff)
downloademacs-6d533a6ef87b826f43ef415083e3c8d5088dd989.tar.gz
emacs-6d533a6ef87b826f43ef415083e3c8d5088dd989.zip
(ada-format-paramlist)
(ada-get-indent-case, ada-check-matching-start) (ada-check-defun-name, ada-goto-matching-decl-start) (ada-goto-matching-start, ada-goto-matching-end, ada-tab) (ada-untab, ada-move-to-start, ada-fill-comment-paragraph) (ada-make-subprogram-body): Follow error conventions. (ada-case-exception-file, ada-indent-comment-as-code) (ada-indent-handle-comment-special, ada-indent-renames) (ada-indent-return, ada-search-directories-internal) (ada-tab-policy, ada-case-exception-substring) (ada-other-file-alist, ada-matching-start-re) (ada-matching-decl-start-re, ada-contextual-menu-last-point) (ada-imenu-generic-expression, ada-compile-goto-error) (ada-in-comment-p, ada-in-string-p, ada-in-string-or-comment-p) (ada-popup-menu, ada-add-extensions, ada-mode) (ada-region-selected, ada-create-case-exception) (ada-create-case-exception-substring, ada-after-keyword-p) (ada-activate-keys-for-case, ada-adjust-case-region) (ada-adjust-case-buffer, ada-format-paramlist) (ada-scan-paramlist, ada-insert-paramlist) (ada-indent-newline-indent) (ada-indent-newline-indent-conditional) (ada-justified-indent-current, ada-goto-previous-word) (ada-indent-current, ada-get-indent-open-paren) (ada-get-indent-paramlist, ada-get-indent-end) (ada-get-indent-case, ada-get-indent-when, ada-get-indent-if) (ada-get-indent-block-start, ada-get-indent-subprog) (ada-get-indent-noindent, ada-get-indent-label) (ada-get-indent-loop, ada-get-indent-type, ada-goto-stmt-start) (ada-search-prev-end-stmt, ada-goto-next-non-ws) (ada-goto-stmt-end, ada-goto-next-word) (ada-check-matching-start, ada-check-defun-name) (ada-goto-matching-decl-start, ada-goto-matching-start) (ada-goto-matching-end, ada-search-ignore-string-comment) (ada-in-decl-p, ada-looking-at-semi-or) (ada-looking-at-semi-private, ada-in-paramlist-p) (ada-in-open-paren-p, ada-tab, ada-indent-current-function) (ada-untab-hard, ada-move-to-start, ada-move-to-end) (ada-next-procedure, ada-previous-procedure, ada-next-package) (ada-previous-package, ada-create-menu) (ada-fill-comment-paragraph-justify) (ada-fill-comment-paragraph-postfix, ada-fill-comment-paragraph) (ada-other-file-name, ada-last-which-function-line) (ada-last-which-function-subprog, ada-which-function) (ada-get-body-name, ada-outline-level, ada-narrow-to-defun) (ada-gen-treat-proc, ada-check-emacs-version) (ada-continuation-indent, ada-align-region-separate): Fix typos in docstrings. (ada-adjust-case, ada-adjust-case-interactive): Doc fixes.
-rw-r--r--lisp/progmodes/ada-mode.el278
1 files changed, 138 insertions, 140 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index ba4702d90a4..68afd8ee649 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -31,9 +31,9 @@
31;;; This mode is a major mode for editing Ada83 and Ada95 source code. 31;;; This mode is a major mode for editing Ada83 and Ada95 source code.
32;;; This is a major rewrite of the file packaged with Emacs-20. The 32;;; This is a major rewrite of the file packaged with Emacs-20. The
33;;; ada-mode is composed of four lisp files, ada-mode.el, ada-xref.el, 33;;; ada-mode is composed of four lisp files, ada-mode.el, ada-xref.el,
34;;; ada-prj.el and ada-stmt.el. Only this file (ada-mode.el) is 34;;; ada-prj.el and ada-stmt.el. Only this file (ada-mode.el) is
35;;; completely independent from the GNU Ada compiler Gnat, distributed 35;;; completely independent from the GNU Ada compiler Gnat, distributed
36;;; by Ada Core Technologies. All the other files rely heavily on 36;;; by Ada Core Technologies. All the other files rely heavily on
37;;; features provided only by Gnat. 37;;; features provided only by Gnat.
38;;; 38;;;
39;;; Note: this mode will not work with Emacs 19. If you are on a VMS 39;;; Note: this mode will not work with Emacs 19. If you are on a VMS
@@ -136,7 +136,7 @@
136;; this function is needed at compile time 136;; this function is needed at compile time
137(eval-and-compile 137(eval-and-compile
138 (defun ada-check-emacs-version (major minor &optional is-xemacs) 138 (defun ada-check-emacs-version (major minor &optional is-xemacs)
139 "Returns t if Emacs's version is greater or equal to MAJOR.MINOR. 139 "Return t if Emacs's version is greater or equal to MAJOR.MINOR.
140If IS-XEMACS is non-nil, check for XEmacs instead of Emacs." 140If IS-XEMACS is non-nil, check for XEmacs instead of Emacs."
141 (let ((xemacs-running (or (string-match "Lucid" emacs-version) 141 (let ((xemacs-running (or (string-match "Lucid" emacs-version)
142 (string-match "XEmacs" emacs-version)))) 142 (string-match "XEmacs" emacs-version))))
@@ -186,8 +186,7 @@ An example is :
186 :type 'integer :group 'ada) 186 :type 'integer :group 'ada)
187 187
188(defcustom ada-continuation-indent ada-broken-indent 188(defcustom ada-continuation-indent ada-broken-indent
189 "*Number of columns to indent the continuation of broken lines in 189 "*Number of columns to indent the continuation of broken lines in parenthesis.
190parenthesis.
191 190
192An example is : 191An example is :
193 Func (Param1, 192 Func (Param1,
@@ -212,10 +211,10 @@ The first file is the one where new exceptions will be saved by Emacs
212when you call `ada-create-case-exception'. 211when you call `ada-create-case-exception'.
213 212
214These files should contain one word per line, that gives the casing 213These files should contain one word per line, that gives the casing
215to be used for that word in Ada files. If the line starts with the 214to be used for that word in Ada files. If the line starts with the
216character *, then the exception will be used for substrings that either 215character *, then the exception will be used for substrings that either
217start at the beginning of a word or after a _ character, and end either 216start at the beginning of a word or after a _ character, and end either
218at the end of the word or at a _ character. Each line can be terminated by 217at the end of the word or at a _ character. Each line can be terminated by
219a comment." 218a comment."
220 :type '(repeat (file)) 219 :type '(repeat (file))
221 :group 'ada) 220 :group 'ada)
@@ -271,15 +270,14 @@ For instance:
271 270
272(defcustom ada-indent-comment-as-code t 271(defcustom ada-indent-comment-as-code t
273 "*Non-nil means indent comment lines as code. 272 "*Non-nil means indent comment lines as code.
274nil means do not auto-indent comments." 273A nil value means do not auto-indent comments."
275 :type 'boolean :group 'ada) 274 :type 'boolean :group 'ada)
276 275
277(defcustom ada-indent-handle-comment-special nil 276(defcustom ada-indent-handle-comment-special nil
278 "*Non-nil if comment lines should be handled specially inside 277 "*Non-nil if comment lines should be handled specially inside parenthesis.
279parenthesis.
280By default, if the line that contains the open parenthesis has some 278By default, if the line that contains the open parenthesis has some
281text following it, then the following lines will be indented in the 279text following it, then the following lines will be indented in the
282same column as this text. This will not be true if the first line is 280same column as this text. This will not be true if the first line is
283a comment and `ada-indent-handle-comment-special' is t. 281a comment and `ada-indent-handle-comment-special' is t.
284 282
285type A is 283type A is
@@ -311,8 +309,8 @@ An example is:
311 309
312(defcustom ada-indent-renames ada-broken-indent 310(defcustom ada-indent-renames ada-broken-indent
313 "*Indentation for renames relative to the matching function statement. 311 "*Indentation for renames relative to the matching function statement.
314If ada-indent-return is null or negative, the indentation is done relative to 312If `ada-indent-return' is null or negative, the indentation is done relative to
315the open parenthesis (if there is no parenthesis, ada-broken-indent is used). 313the open parenthesis (if there is no parenthesis, `ada-broken-indent' is used).
316 314
317An example is: 315An example is:
318 function A (B : Integer) 316 function A (B : Integer)
@@ -322,8 +320,8 @@ An example is:
322 320
323(defcustom ada-indent-return 0 321(defcustom ada-indent-return 0
324 "*Indentation for 'return' relative to the matching 'function' statement. 322 "*Indentation for 'return' relative to the matching 'function' statement.
325If ada-indent-return is null or negative, the indentation is done relative to 323If `ada-indent-return' is null or negative, the indentation is done relative to
326the open parenthesis (if there is no parenthesis, ada-broken-indent is used). 324the open parenthesis (if there is no parenthesis, `ada-broken-indent' is used).
327 325
328An example is: 326An example is:
329 function A (B : Integer) 327 function A (B : Integer)
@@ -342,7 +340,7 @@ again to take account of the new value."
342 340
343(defcustom ada-fill-comment-postfix " --" 341(defcustom ada-fill-comment-postfix " --"
344 "*Text inserted at the end of each line when filling a comment paragraph. 342 "*Text inserted at the end of each line when filling a comment paragraph.
345with `ada-fill-comment-paragraph-postfix'." 343Used by `ada-fill-comment-paragraph-postfix'."
346 :type 'string :group 'ada) 344 :type 'string :group 'ada)
347 345
348(defcustom ada-label-indent -4 346(defcustom ada-label-indent -4
@@ -377,7 +375,7 @@ If nil, no contextual menu is available."
377 '("/usr/adainclude" "/usr/local/adainclude" 375 '("/usr/adainclude" "/usr/local/adainclude"
378 "/opt/gnu/adainclude")) 376 "/opt/gnu/adainclude"))
379 "*List of directories to search for Ada files. 377 "*List of directories to search for Ada files.
380See the description for the `ff-search-directories' variable. This variable 378See the description for the `ff-search-directories' variable. This variable
381is the initial value of this variable, and is copied and modified in 379is the initial value of this variable, and is copied and modified in
382`ada-search-directories-internal'." 380`ada-search-directories-internal'."
383 :type '(repeat (choice :tag "Directory" 381 :type '(repeat (choice :tag "Directory"
@@ -389,7 +387,7 @@ is the initial value of this variable, and is copied and modified in
389 "Internal version of `ada-search-directories'. 387 "Internal version of `ada-search-directories'.
390Its value is the concatenation of the search path as read in the project file 388Its value is the concatenation of the search path as read in the project file
391and the standard runtime location, and the value of the user-defined 389and the standard runtime location, and the value of the user-defined
392ada-search-directories.") 390`ada-search-directories'.")
393 391
394(defcustom ada-stmt-end-indent 0 392(defcustom ada-stmt-end-indent 0
395 "*Number of columns to indent the end of a statement on a separate line. 393 "*Number of columns to indent the end of a statement on a separate line.
@@ -402,7 +400,7 @@ An example is:
402(defcustom ada-tab-policy 'indent-auto 400(defcustom ada-tab-policy 'indent-auto
403 "*Control the behavior of the TAB key. 401 "*Control the behavior of the TAB key.
404Must be one of : 402Must be one of :
405`indent-rigidly' : always adds ada-indent blanks at the beginning of the line. 403`indent-rigidly' : always adds `ada-indent' blanks at the beginning of the line.
406`indent-auto' : use indentation functions in this file. 404`indent-auto' : use indentation functions in this file.
407`always-tab' : do indent-relative." 405`always-tab' : do indent-relative."
408 :type '(choice (const indent-auto) 406 :type '(choice (const indent-auto)
@@ -438,7 +436,7 @@ An example is:
438 "*Name of the compiler to use. 436 "*Name of the compiler to use.
439This will determine what features are made available through the ada-mode. 437This will determine what features are made available through the ada-mode.
440The possible choices are : 438The possible choices are :
441`gnat': Use Ada Core Technologies' Gnat compiler. Add some cross-referencing 439`gnat': Use Ada Core Technologies' Gnat compiler. Add some cross-referencing
442 features 440 features
443`generic': Use a generic compiler" 441`generic': Use a generic compiler"
444 :type '(choice (const gnat) 442 :type '(choice (const gnat)
@@ -494,14 +492,14 @@ This variable is used to define `ada-83-keywords' and `ada-95-keywords'"))
494(defvar ada-case-exception-substring '() 492(defvar ada-case-exception-substring '()
495 "Alist of substrings (entities) that have special casing. 493 "Alist of substrings (entities) that have special casing.
496The substrings are detected for word constituant when the word 494The substrings are detected for word constituant when the word
497is not itself in ada-case-exception, and only for substrings that 495is not itself in `ada-case-exception', and only for substrings that
498either are at the beginning or end of the word, or start after '_'.") 496either are at the beginning or end of the word, or start after '_'.")
499 497
500(defvar ada-lfd-binding nil 498(defvar ada-lfd-binding nil
501 "Variable to save key binding of LFD when casing is activated.") 499 "Variable to save key binding of LFD when casing is activated.")
502 500
503(defvar ada-other-file-alist nil 501(defvar ada-other-file-alist nil
504 "Variable used by find-file to find the name of the other package. 502 "Variable used by `find-file' to find the name of the other package.
505See `ff-other-file-alist'.") 503See `ff-other-file-alist'.")
506 504
507(defvar ada-align-list 505(defvar ada-align-list
@@ -552,7 +550,7 @@ This variable defines several rules to use to align different lines.")
552 "type\\|" 550 "type\\|"
553 "when" 551 "when"
554 "\\)\\>\\)") 552 "\\)\\>\\)")
555 "see the variable `align-region-separate' for more information.") 553 "See the variable `align-region-separate' for more information.")
556 554
557;;; ---- Below are the regexp used in this package for parsing 555;;; ---- Below are the regexp used in this package for parsing
558 556
@@ -631,7 +629,7 @@ A new statement starts after these.")
631 '("end" "loop" "select" "begin" "case" "do" 629 '("end" "loop" "select" "begin" "case" "do"
632 "if" "task" "package" "record" "protected") t) 630 "if" "task" "package" "record" "protected") t)
633 "\\>")) 631 "\\>"))
634 "Regexp used in ada-goto-matching-start.") 632 "Regexp used in `ada-goto-matching-start'.")
635 633
636(defvar ada-matching-decl-start-re 634(defvar ada-matching-decl-start-re
637 (eval-when-compile 635 (eval-when-compile
@@ -639,7 +637,7 @@ A new statement starts after these.")
639 (regexp-opt 637 (regexp-opt
640 '("is" "separate" "end" "declare" "if" "new" "begin" "generic" "when") t) 638 '("is" "separate" "end" "declare" "if" "new" "begin" "generic" "when") t)
641 "\\>")) 639 "\\>"))
642 "Regexp used in ada-goto-matching-decl-start.") 640 "Regexp used in `ada-goto-matching-decl-start'.")
643 641
644(defvar ada-loop-start-re 642(defvar ada-loop-start-re
645 "\\<\\(for\\|while\\|loop\\)\\>" 643 "\\<\\(for\\|while\\|loop\\)\\>"
@@ -662,7 +660,7 @@ A new statement starts after these.")
662 "Position of point just before displaying the menu. 660 "Position of point just before displaying the menu.
663This is a list (point buffer). 661This is a list (point buffer).
664Since `ada-popup-menu' moves the point where the user clicked, the region 662Since `ada-popup-menu' moves the point where the user clicked, the region
665is modified. Therefore no command from the menu knows what the user selected 663is modified. Therefore no command from the menu knows what the user selected
666before displaying the contextual menu. 664before displaying the contextual menu.
667To get the original region, restore the point to this position before 665To get the original region, restore the point to this position before
668calling `region-end' and `region-beginning'. 666calling `region-end' and `region-beginning'.
@@ -717,7 +715,7 @@ displaying the menu if point was on an identifier."
717 "^[ \t]*protected[ \t]+\\(type[ \t]+\\)?\\(\\(body[ \t]+\\)?\\(\\sw\\|_\\)+\\)" 2) 715 "^[ \t]*protected[ \t]+\\(type[ \t]+\\)?\\(\\(body[ \t]+\\)?\\(\\sw\\|_\\)+\\)" 2)
718 '("*Packages*" "^[ \t]*package[ \t]+\\(\\(body[ \t]+\\)?\\(\\sw\\|[_.]\\)+\\)" 1)) 716 '("*Packages*" "^[ \t]*package[ \t]+\\(\\(body[ \t]+\\)?\\(\\sw\\|[_.]\\)+\\)" 1))
719 "Imenu generic expression for Ada mode. 717 "Imenu generic expression for Ada mode.
720See `imenu-generic-expression'. This variable will create several submenus for 718See `imenu-generic-expression'. This variable will create several submenus for
721each type of entity that can be found in an Ada file.") 719each type of entity that can be found in an Ada file.")
722 720
723 721
@@ -733,9 +731,9 @@ each type of entity that can be found in an Ada file.")
733 ) 731 )
734 732
735(defun ada-compile-goto-error (pos) 733(defun ada-compile-goto-error (pos)
736 "Replaces `compile-goto-error' from compile.el. 734 "Replace `compile-goto-error' from compile.el.
737If POS is on a file and line location, go to this position. It adds to 735If POS is on a file and line location, go to this position. It adds
738compile.el the capacity to go to a reference in an error message. 736to compile.el the capacity to go to a reference in an error message.
739For instance, on this line: 737For instance, on this line:
740 foo.adb:61:11: [...] in call to size declared at foo.ads:11 738 foo.adb:61:11: [...] in call to size declared at foo.ads:11
741both file locations can be clicked on and jumped to." 739both file locations can be clicked on and jumped to."
@@ -953,20 +951,20 @@ OLD-LEN indicates what the length of the replaced text was."
953;;------------------------------------------------------------------ 951;;------------------------------------------------------------------
954 952
955(defsubst ada-in-comment-p (&optional parse-result) 953(defsubst ada-in-comment-p (&optional parse-result)
956 "Returns t if inside a comment." 954 "Return t if inside a comment."
957 (nth 4 (or parse-result 955 (nth 4 (or parse-result
958 (parse-partial-sexp 956 (parse-partial-sexp
959 (line-beginning-position) (point))))) 957 (line-beginning-position) (point)))))
960 958
961(defsubst ada-in-string-p (&optional parse-result) 959(defsubst ada-in-string-p (&optional parse-result)
962 "Returns t if point is inside a string. 960 "Return t if point is inside a string.
963If parse-result is non-nil, use is instead of calling parse-partial-sexp." 961If parse-result is non-nil, use is instead of calling `parse-partial-sexp'."
964 (nth 3 (or parse-result 962 (nth 3 (or parse-result
965 (parse-partial-sexp 963 (parse-partial-sexp
966 (line-beginning-position) (point))))) 964 (line-beginning-position) (point)))))
967 965
968(defsubst ada-in-string-or-comment-p (&optional parse-result) 966(defsubst ada-in-string-or-comment-p (&optional parse-result)
969 "Returns t if inside a comment or string." 967 "Return t if inside a comment or string."
970 (setq parse-result (or parse-result 968 (setq parse-result (or parse-result
971 (parse-partial-sexp 969 (parse-partial-sexp
972 (line-beginning-position) (point)))) 970 (line-beginning-position) (point))))
@@ -994,8 +992,8 @@ It forces Emacs to change the cursor position."
994 "Pops up a contextual menu, depending on where the user clicked. 992 "Pops up a contextual menu, depending on where the user clicked.
995POSITION is the location the mouse was clicked on. 993POSITION is the location the mouse was clicked on.
996Sets `ada-contextual-menu-last-point' to the current position before 994Sets `ada-contextual-menu-last-point' to the current position before
997displaying the menu. When a function from the menu is called, the point is 995displaying the menu. When a function from the menu is called, the
998where the mouse button was clicked." 996point is where the mouse button was clicked."
999 (interactive "e") 997 (interactive "e")
1000 998
1001 ;; declare this as a local variable, so that the function called 999 ;; declare this as a local variable, so that the function called
@@ -1035,8 +1033,8 @@ where the mouse button was clicked."
1035 "Define SPEC and BODY as being valid extensions for Ada files. 1033 "Define SPEC and BODY as being valid extensions for Ada files.
1036Going from body to spec with `ff-find-other-file' used these 1034Going from body to spec with `ff-find-other-file' used these
1037extensions. 1035extensions.
1038SPEC and BODY are two regular expressions that must match against the file 1036SPEC and BODY are two regular expressions that must match against
1039name" 1037the file name."
1040 (let* ((reg (concat (regexp-quote body) "$")) 1038 (let* ((reg (concat (regexp-quote body) "$"))
1041 (tmp (assoc reg ada-other-file-alist))) 1039 (tmp (assoc reg ada-other-file-alist)))
1042 (if tmp 1040 (if tmp
@@ -1099,7 +1097,7 @@ Comments are handled using standard GNU Emacs conventions, including:
1099 Continue comment on next line '\\[indent-new-comment-line]' 1097 Continue comment on next line '\\[indent-new-comment-line]'
1100 1098
1101If you use imenu.el: 1099If you use imenu.el:
1102 Display index-menu of functions & procedures '\\[imenu]' 1100 Display index-menu of functions and procedures '\\[imenu]'
1103 1101
1104If you use find-file.el: 1102If you use find-file.el:
1105 Switch to other file (Body <-> Spec) '\\[ff-find-other-file]' 1103 Switch to other file (Body <-> Spec) '\\[ff-find-other-file]'
@@ -1408,7 +1406,7 @@ If you use ada-xref.el:
1408 1406
1409;; transient-mark-mode and mark-active are not defined in XEmacs 1407;; transient-mark-mode and mark-active are not defined in XEmacs
1410(defun ada-region-selected () 1408(defun ada-region-selected ()
1411 "t if a region has been selected by the user and is still active." 1409 "Return t if a region has been selected by the user and is still active."
1412 (or (and (featurep 'xemacs) (funcall (symbol-function 'region-active-p))) 1410 (or (and (featurep 'xemacs) (funcall (symbol-function 'region-active-p)))
1413 (and (not (featurep 'xemacs)) 1411 (and (not (featurep 'xemacs))
1414 (symbol-value 'transient-mark-mode) 1412 (symbol-value 'transient-mark-mode)
@@ -1447,7 +1445,7 @@ If you use ada-xref.el:
1447 ) 1445 )
1448 1446
1449(defun ada-create-case-exception (&optional word) 1447(defun ada-create-case-exception (&optional word)
1450 "Defines WORD as an exception for the casing system. 1448 "Define WORD as an exception for the casing system.
1451If WORD is not given, then the current word in the buffer is used instead. 1449If WORD is not given, then the current word in the buffer is used instead.
1452The new words is added to the first file in `ada-case-exception-file'. 1450The new words is added to the first file in `ada-case-exception-file'.
1453The standard casing rules will no longer apply to this word." 1451The standard casing rules will no longer apply to this word."
@@ -1487,10 +1485,10 @@ The standard casing rules will no longer apply to this word."
1487 )) 1485 ))
1488 1486
1489(defun ada-create-case-exception-substring (&optional word) 1487(defun ada-create-case-exception-substring (&optional word)
1490 "Defines the substring WORD as an exception for the casing system. 1488 "Define the substring WORD as an exception for the casing system.
1491If WORD is not given, then the current word in the buffer is used instead, 1489If WORD is not given, then the current word in the buffer is used instead,
1492or the selected region if any is active. 1490or the selected region if any is active.
1493The new words is added to the first file in `ada-case-exception-file'. 1491The new word is added to the first file in `ada-case-exception-file'.
1494When auto-casing a word, this substring will be special-cased, unless the 1492When auto-casing a word, this substring will be special-cased, unless the
1495word itself has a special casing." 1493word itself has a special casing."
1496 (interactive) 1494 (interactive)
@@ -1642,7 +1640,7 @@ the exceptions defined in `ada-case-exception-file'."
1642 (ada-adjust-case-substring)))))) 1640 (ada-adjust-case-substring))))))
1643 1641
1644(defun ada-after-keyword-p () 1642(defun ada-after-keyword-p ()
1645 "Returns t if cursor is after a keyword that is not an attribute." 1643 "Return t if cursor is after a keyword that is not an attribute."
1646 (save-excursion 1644 (save-excursion
1647 (forward-word -1) 1645 (forward-word -1)
1648 (and (not (and (char-before) 1646 (and (not (and (char-before)
@@ -1651,7 +1649,7 @@ the exceptions defined in `ada-case-exception-file'."
1651 (looking-at (concat ada-keywords "[^_]"))))) 1649 (looking-at (concat ada-keywords "[^_]")))))
1652 1650
1653(defun ada-adjust-case (&optional force-identifier) 1651(defun ada-adjust-case (&optional force-identifier)
1654 "Adjust the case of the word before the just typed character. 1652 "Adjust the case of the word before the character just typed.
1655If FORCE-IDENTIFIER is non-nil then also adjust keyword as identifier." 1653If FORCE-IDENTIFIER is non-nil then also adjust keyword as identifier."
1656 (if (not (bobp)) 1654 (if (not (bobp))
1657 (progn 1655 (progn
@@ -1682,7 +1680,7 @@ If FORCE-IDENTIFIER is non-nil then also adjust keyword as identifier."
1682 1680
1683(defun ada-adjust-case-interactive (arg) 1681(defun ada-adjust-case-interactive (arg)
1684 "Adjust the case of the previous word, and process the character just typed. 1682 "Adjust the case of the previous word, and process the character just typed.
1685ARG is the prefix the user entered with \C-u." 1683ARG is the prefix the user entered with \\[universal-argument]."
1686 (interactive "P") 1684 (interactive "P")
1687 1685
1688 (if ada-auto-case 1686 (if ada-auto-case
@@ -1729,7 +1727,7 @@ ARG is the prefix the user entered with \C-u."
1729 )) 1727 ))
1730 1728
1731(defun ada-activate-keys-for-case () 1729(defun ada-activate-keys-for-case ()
1732 "Modifies the key bindings for all the keys that should readjust the casing." 1730 "Modify the key bindings for all the keys that should readjust the casing."
1733 (interactive) 1731 (interactive)
1734 ;; Save original key-bindings to allow swapping ret/lfd 1732 ;; Save original key-bindings to allow swapping ret/lfd
1735 ;; when casing is activated. 1733 ;; when casing is activated.
@@ -1763,7 +1761,7 @@ ARG is ignored, and is there for compatibility with `capitalize-word' only."
1763 (delete-char 1))))) 1761 (delete-char 1)))))
1764 1762
1765(defun ada-no-auto-case (&optional arg) 1763(defun ada-no-auto-case (&optional arg)
1766 "Does nothing. 1764 "Do nothing.
1767This function can be used for the auto-casing variables in the ada-mode, to 1765This function can be used for the auto-casing variables in the ada-mode, to
1768adapt to unusal auto-casing schemes. Since it does nothing, you can for 1766adapt to unusal auto-casing schemes. Since it does nothing, you can for
1769instance use it for `ada-case-identifier' if you don't want any special 1767instance use it for `ada-case-identifier' if you don't want any special
@@ -1782,8 +1780,8 @@ ARG is ignored, and is there for compatibility with `capitalize-word' only."
1782 (modify-syntax-entry ?_ "w"))) 1780 (modify-syntax-entry ?_ "w")))
1783 1781
1784(defun ada-adjust-case-region (from to) 1782(defun ada-adjust-case-region (from to)
1785 "Adjusts the case of all words in the region between FROM and TO. 1783 "Adjust the case of all words in the region between FROM and TO.
1786Attention: This function might take very long for big regions !" 1784Attention: This function might take very long for big regions!"
1787 (interactive "*r") 1785 (interactive "*r")
1788 (let ((begin nil) 1786 (let ((begin nil)
1789 (end nil) 1787 (end nil)
@@ -1829,7 +1827,7 @@ Attention: This function might take very long for big regions !"
1829 1827
1830(defun ada-adjust-case-buffer () 1828(defun ada-adjust-case-buffer ()
1831 "Adjusts the case of all words in the whole buffer. 1829 "Adjusts the case of all words in the whole buffer.
1832ATTENTION: This function might take very long for big buffers !" 1830ATTENTION: This function might take very long for big buffers!"
1833 (interactive "*") 1831 (interactive "*")
1834 (ada-adjust-case-region (point-min) (point-max))) 1832 (ada-adjust-case-region (point-min) (point-max)))
1835 1833
@@ -1851,7 +1849,7 @@ ATTENTION: This function might take very long for big buffers !"
1851;;-------------------------------------------------------------- 1849;;--------------------------------------------------------------
1852 1850
1853(defun ada-format-paramlist () 1851(defun ada-format-paramlist ()
1854 "Reformats the parameter list point is in." 1852 "Reformat the parameter list point is in."
1855 (interactive) 1853 (interactive)
1856 (let ((begin nil) 1854 (let ((begin nil)
1857 (end nil) 1855 (end nil)
@@ -1864,7 +1862,7 @@ ATTENTION: This function might take very long for big buffers !"
1864 1862
1865 ;; check if really inside parameter list 1863 ;; check if really inside parameter list
1866 (or (ada-in-paramlist-p) 1864 (or (ada-in-paramlist-p)
1867 (error "not in parameter list")) 1865 (error "Not in parameter list"))
1868 1866
1869 ;; find start of current parameter-list 1867 ;; find start of current parameter-list
1870 (ada-search-ignore-string-comment 1868 (ada-search-ignore-string-comment
@@ -1899,7 +1897,7 @@ ATTENTION: This function might take very long for big buffers !"
1899 1897
1900(defun ada-scan-paramlist (begin end) 1898(defun ada-scan-paramlist (begin end)
1901 "Scan the parameter list found in between BEGIN and END. 1899 "Scan the parameter list found in between BEGIN and END.
1902Returns the equivalent internal parameter list." 1900Return the equivalent internal parameter list."
1903 (let ((paramlist (list)) 1901 (let ((paramlist (list))
1904 (param (list)) 1902 (param (list))
1905 (notend t) 1903 (notend t)
@@ -1996,7 +1994,7 @@ Returns the equivalent internal parameter list."
1996 (reverse paramlist))) 1994 (reverse paramlist)))
1997 1995
1998(defun ada-insert-paramlist (paramlist) 1996(defun ada-insert-paramlist (paramlist)
1999 "Inserts a formatted PARAMLIST in the buffer." 1997 "Insert a formatted PARAMLIST in the buffer."
2000 (let ((i (length paramlist)) 1998 (let ((i (length paramlist))
2001 (parlen 0) 1999 (parlen 0)
2002 (typlen 0) 2000 (typlen 0)
@@ -2163,7 +2161,7 @@ Returns the equivalent internal parameter list."
2163 (message "indenting ... done"))) 2161 (message "indenting ... done")))
2164 2162
2165(defun ada-indent-newline-indent () 2163(defun ada-indent-newline-indent ()
2166 "Indents the current line, inserts a newline and then indents the new line." 2164 "Indent the current line, insert a newline and then indent the new line."
2167 (interactive "*") 2165 (interactive "*")
2168 (ada-indent-current) 2166 (ada-indent-current)
2169 (newline) 2167 (newline)
@@ -2172,14 +2170,14 @@ Returns the equivalent internal parameter list."
2172(defun ada-indent-newline-indent-conditional () 2170(defun ada-indent-newline-indent-conditional ()
2173 "Insert a newline and indent it. 2171 "Insert a newline and indent it.
2174The original line is indented first if `ada-indent-after-return' is non-nil. 2172The original line is indented first if `ada-indent-after-return' is non-nil.
2175This function is intended to be bound to the \C-m and \C-j keys." 2173This function is intended to be bound to the C-m and C-j keys."
2176 (interactive "*") 2174 (interactive "*")
2177 (if ada-indent-after-return (ada-indent-current)) 2175 (if ada-indent-after-return (ada-indent-current))
2178 (newline) 2176 (newline)
2179 (ada-indent-current)) 2177 (ada-indent-current))
2180 2178
2181(defun ada-justified-indent-current () 2179(defun ada-justified-indent-current ()
2182 "Indent the current line and explains how the calculation was done." 2180 "Indent the current line and explain how the calculation was done."
2183 (interactive) 2181 (interactive)
2184 2182
2185 (let ((cur-indent (ada-indent-current))) 2183 (let ((cur-indent (ada-indent-current)))
@@ -2223,13 +2221,13 @@ command like:
2223 (kill-emacs 0)) 2221 (kill-emacs 0))
2224 2222
2225(defsubst ada-goto-previous-word () 2223(defsubst ada-goto-previous-word ()
2226 "Moves point to the beginning of the previous word of Ada code. 2224 "Move point to the beginning of the previous word of Ada code.
2227Returns the new position of point or nil if not found." 2225Return the new position of point or nil if not found."
2228 (ada-goto-next-word t)) 2226 (ada-goto-next-word t))
2229 2227
2230(defun ada-indent-current () 2228(defun ada-indent-current ()
2231 "Indent current line as Ada code. 2229 "Indent current line as Ada code.
2232Returns the calculation that was done, including the reference point and the 2230Return the calculation that was done, including the reference point and the
2233offset." 2231offset."
2234 (interactive) 2232 (interactive)
2235 (let ((previous-syntax-table (syntax-table)) 2233 (let ((previous-syntax-table (syntax-table))
@@ -2804,7 +2802,7 @@ if INITIAL-POS is non-nil, moves point to INITIAL-POS before calculation."
2804 )) 2802 ))
2805 2803
2806(defun ada-get-indent-open-paren () 2804(defun ada-get-indent-open-paren ()
2807 "Calculates the indentation when point is behind an unclosed parenthesis." 2805 "Calculate the indentation when point is behind an unclosed parenthesis."
2808 (list (ada-in-open-paren-p) 0)) 2806 (list (ada-in-open-paren-p) 0))
2809 2807
2810(defun ada-get-indent-nochange () 2808(defun ada-get-indent-nochange ()
@@ -2815,7 +2813,7 @@ if INITIAL-POS is non-nil, moves point to INITIAL-POS before calculation."
2815 (list (point) 0))) 2813 (list (point) 0)))
2816 2814
2817(defun ada-get-indent-paramlist () 2815(defun ada-get-indent-paramlist ()
2818 "Calculates the indentation when point is inside a parameter list." 2816 "Calculate the indentation when point is inside a parameter list."
2819 (save-excursion 2817 (save-excursion
2820 (ada-search-ignore-string-comment "[^ \t\n]" t nil t) 2818 (ada-search-ignore-string-comment "[^ \t\n]" t nil t)
2821 (cond 2819 (cond
@@ -2843,7 +2841,7 @@ if INITIAL-POS is non-nil, moves point to INITIAL-POS before calculation."
2843 (list (point) 0))))) 2841 (list (point) 0)))))
2844 2842
2845(defun ada-get-indent-end (orgpoint) 2843(defun ada-get-indent-end (orgpoint)
2846 "Calculates the indentation when point is just before an end_statement. 2844 "Calculate the indentation when point is just before an end statement.
2847ORGPOINT is the limit position used in the calculation." 2845ORGPOINT is the limit position used in the calculation."
2848 (let ((defun-name nil) 2846 (let ((defun-name nil)
2849 (indent nil)) 2847 (indent nil))
@@ -2909,7 +2907,7 @@ ORGPOINT is the limit position used in the calculation."
2909 'ada-broken-indent)))) 2907 'ada-broken-indent))))
2910 2908
2911(defun ada-get-indent-case (orgpoint) 2909(defun ada-get-indent-case (orgpoint)
2912 "Calculates the indentation when point is just before a case statement. 2910 "Calculate the indentation when point is just before a case statement.
2913ORGPOINT is the limit position used in the calculation." 2911ORGPOINT is the limit position used in the calculation."
2914 (let ((match-cons nil) 2912 (let ((match-cons nil)
2915 (opos (point))) 2913 (opos (point)))
@@ -2927,7 +2925,7 @@ ORGPOINT is the limit position used in the calculation."
2927 (save-excursion 2925 (save-excursion
2928 (goto-char (car match-cons)) 2926 (goto-char (car match-cons))
2929 (unless (ada-search-ignore-string-comment "when" t opos) 2927 (unless (ada-search-ignore-string-comment "when" t opos)
2930 (error "missing 'when' between 'case' and '=>'")) 2928 (error "Missing 'when' between 'case' and '=>'"))
2931 (list (save-excursion (back-to-indentation) (point)) 'ada-indent))) 2929 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)))
2932 ;; 2930 ;;
2933 ;; case..is..when 2931 ;; case..is..when
@@ -2952,7 +2950,7 @@ ORGPOINT is the limit position used in the calculation."
2952 'ada-broken-indent))))) 2950 'ada-broken-indent)))))
2953 2951
2954(defun ada-get-indent-when (orgpoint) 2952(defun ada-get-indent-when (orgpoint)
2955 "Calculates the indentation when point is just before a when statement. 2953 "Calculate the indentation when point is just before a when statement.
2956ORGPOINT is the limit position used in the calculation." 2954ORGPOINT is the limit position used in the calculation."
2957 (let ((cur-indent (save-excursion (back-to-indentation) (point)))) 2955 (let ((cur-indent (save-excursion (back-to-indentation) (point))))
2958 (if (ada-search-ignore-string-comment "[ \t\n]*=>" nil orgpoint) 2956 (if (ada-search-ignore-string-comment "[ \t\n]*=>" nil orgpoint)
@@ -2960,7 +2958,7 @@ ORGPOINT is the limit position used in the calculation."
2960 (list cur-indent 'ada-broken-indent)))) 2958 (list cur-indent 'ada-broken-indent))))
2961 2959
2962(defun ada-get-indent-if (orgpoint) 2960(defun ada-get-indent-if (orgpoint)
2963 "Calculates the indentation when point is just before an if statement. 2961 "Calculate the indentation when point is just before an if statement.
2964ORGPOINT is the limit position used in the calculation." 2962ORGPOINT is the limit position used in the calculation."
2965 (let ((cur-indent (save-excursion (back-to-indentation) (point))) 2963 (let ((cur-indent (save-excursion (back-to-indentation) (point)))
2966 (match-cons nil)) 2964 (match-cons nil))
@@ -2990,7 +2988,7 @@ ORGPOINT is the limit position used in the calculation."
2990 (list cur-indent 'ada-broken-indent)))) 2988 (list cur-indent 'ada-broken-indent))))
2991 2989
2992(defun ada-get-indent-block-start (orgpoint) 2990(defun ada-get-indent-block-start (orgpoint)
2993 "Calculates the indentation when point is at the start of a block. 2991 "Calculate the indentation when point is at the start of a block.
2994ORGPOINT is the limit position used in the calculation." 2992ORGPOINT is the limit position used in the calculation."
2995 (let ((pos nil)) 2993 (let ((pos nil))
2996 (cond 2994 (cond
@@ -3023,7 +3021,7 @@ ORGPOINT is the limit position used in the calculation."
3023 (list (save-excursion (back-to-indentation) (point)) 'ada-indent))))) 3021 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)))))
3024 3022
3025(defun ada-get-indent-subprog (orgpoint) 3023(defun ada-get-indent-subprog (orgpoint)
3026 "Calculates the indentation when point is just before a subprogram. 3024 "Calculate the indentation when point is just before a subprogram.
3027ORGPOINT is the limit position used in the calculation." 3025ORGPOINT is the limit position used in the calculation."
3028 (let ((match-cons nil) 3026 (let ((match-cons nil)
3029 (cur-indent (save-excursion (back-to-indentation) (point))) 3027 (cur-indent (save-excursion (back-to-indentation) (point)))
@@ -3092,7 +3090,7 @@ ORGPOINT is the limit position used in the calculation."
3092 (list cur-indent 'ada-broken-indent))))) 3090 (list cur-indent 'ada-broken-indent)))))
3093 3091
3094(defun ada-get-indent-noindent (orgpoint) 3092(defun ada-get-indent-noindent (orgpoint)
3095 "Calculates the indentation when point is just before a 'noindent stmt'. 3093 "Calculate the indentation when point is just before a 'noindent stmt'.
3096ORGPOINT is the limit position used in the calculation." 3094ORGPOINT is the limit position used in the calculation."
3097 (let ((label 0)) 3095 (let ((label 0))
3098 (save-excursion 3096 (save-excursion
@@ -3146,7 +3144,7 @@ ORGPOINT is the limit position used in the calculation."
3146 'ada-broken-indent))))))) 3144 'ada-broken-indent)))))))
3147 3145
3148(defun ada-get-indent-label (orgpoint) 3146(defun ada-get-indent-label (orgpoint)
3149 "Calculates the indentation when before a label or variable declaration. 3147 "Calculate the indentation when before a label or variable declaration.
3150ORGPOINT is the limit position used in the calculation." 3148ORGPOINT is the limit position used in the calculation."
3151 (let ((match-cons nil) 3149 (let ((match-cons nil)
3152 (cur-indent (save-excursion (back-to-indentation) (point)))) 3150 (cur-indent (save-excursion (back-to-indentation) (point))))
@@ -3178,7 +3176,7 @@ ORGPOINT is the limit position used in the calculation."
3178 (list cur-indent '(- ada-label-indent)))))) 3176 (list cur-indent '(- ada-label-indent))))))
3179 3177
3180(defun ada-get-indent-loop (orgpoint) 3178(defun ada-get-indent-loop (orgpoint)
3181 "Calculates the indentation when just before a loop or a for ... use. 3179 "Calculate the indentation when just before a loop or a for ... use.
3182ORGPOINT is the limit position used in the calculation." 3180ORGPOINT is the limit position used in the calculation."
3183 (let ((match-cons nil) 3181 (let ((match-cons nil)
3184 (pos (point)) 3182 (pos (point))
@@ -3290,7 +3288,7 @@ ORGPOINT is the limit position used in the calculation."
3290 'ada-broken-indent)))))) 3288 'ada-broken-indent))))))
3291 3289
3292(defun ada-get-indent-type (orgpoint) 3290(defun ada-get-indent-type (orgpoint)
3293 "Calculates the indentation when before a type statement. 3291 "Calculate the indentation when before a type statement.
3294ORGPOINT is the limit position used in the calculation." 3292ORGPOINT is the limit position used in the calculation."
3295 (let ((match-dat nil)) 3293 (let ((match-dat nil))
3296 (cond 3294 (cond
@@ -3345,8 +3343,8 @@ ORGPOINT is the limit position used in the calculation."
3345;; ----------------------------------------------------------- 3343;; -----------------------------------------------------------
3346 3344
3347(defun ada-goto-stmt-start () 3345(defun ada-goto-stmt-start ()
3348 "Moves point to the beginning of the statement that point is in or after. 3346 "Move point to the beginning of the statement that point is in or after.
3349Returns the new position of point. 3347Return the new position of point.
3350As a special case, if we are looking at a closing parenthesis, skip to the 3348As a special case, if we are looking at a closing parenthesis, skip to the
3351open parenthesis." 3349open parenthesis."
3352 (let ((match-dat nil) 3350 (let ((match-dat nil)
@@ -3391,9 +3389,9 @@ open parenthesis."
3391 3389
3392 3390
3393(defun ada-search-prev-end-stmt () 3391(defun ada-search-prev-end-stmt ()
3394 "Moves point to previous end-statement. 3392 "Move point to previous end statement.
3395Returns a cons cell whose car is the beginning and whose cdr the end of the 3393Return a cons cell whose car is the beginning and whose cdr
3396match." 3394is the end of the match."
3397 (let ((match-dat nil) 3395 (let ((match-dat nil)
3398 (found nil)) 3396 (found nil))
3399 3397
@@ -3442,7 +3440,7 @@ match."
3442 3440
3443 3441
3444(defun ada-goto-next-non-ws (&optional limit) 3442(defun ada-goto-next-non-ws (&optional limit)
3445 "Skips white spaces, newlines and comments to next non-ws character. 3443 "Skip white spaces, newlines and comments to next non-ws character.
3446Stop the search at LIMIT. 3444Stop the search at LIMIT.
3447Do not call this function from within a string." 3445Do not call this function from within a string."
3448 (unless limit 3446 (unless limit
@@ -3460,8 +3458,8 @@ Do not call this function from within a string."
3460 3458
3461 3459
3462(defun ada-goto-stmt-end (&optional limit) 3460(defun ada-goto-stmt-end (&optional limit)
3463 "Moves point to the end of the statement that point is in or before. 3461 "Move point to the end of the statement that point is in or before.
3464Returns the new position of point or nil if not found. 3462Return the new position of point or nil if not found.
3465Stop the search at LIMIT." 3463Stop the search at LIMIT."
3466 (if (ada-search-ignore-string-comment ada-end-stmt-re nil limit) 3464 (if (ada-search-ignore-string-comment ada-end-stmt-re nil limit)
3467 (point) 3465 (point)
@@ -3469,9 +3467,9 @@ Stop the search at LIMIT."
3469 3467
3470 3468
3471(defun ada-goto-next-word (&optional backward) 3469(defun ada-goto-next-word (&optional backward)
3472 "Moves point to the beginning of the next word of Ada code. 3470 "Move point to the beginning of the next word of Ada code.
3473If BACKWARD is non-nil, jump to the beginning of the previous word. 3471If BACKWARD is non-nil, jump to the beginning of the previous word.
3474Returns the new position of point or nil if not found." 3472Return the new position of point or nil if not found."
3475 (let ((match-cons nil) 3473 (let ((match-cons nil)
3476 (orgpoint (point)) 3474 (orgpoint (point))
3477 (old-syntax (char-to-string (char-syntax ?_)))) 3475 (old-syntax (char-to-string (char-syntax ?_))))
@@ -3499,16 +3497,16 @@ Returns the new position of point or nil if not found."
3499 3497
3500 3498
3501(defun ada-check-matching-start (keyword) 3499(defun ada-check-matching-start (keyword)
3502 "Signals an error if matching block start is not KEYWORD. 3500 "Signal an error if matching block start is not KEYWORD.
3503Moves point to the matching block start." 3501Moves point to the matching block start."
3504 (ada-goto-matching-start 0) 3502 (ada-goto-matching-start 0)
3505 (unless (looking-at (concat "\\<" keyword "\\>")) 3503 (unless (looking-at (concat "\\<" keyword "\\>"))
3506 (error "matching start is not '%s'" keyword))) 3504 (error "Matching start is not '%s'" keyword)))
3507 3505
3508 3506
3509(defun ada-check-defun-name (defun-name) 3507(defun ada-check-defun-name (defun-name)
3510 "Checks if the name of the matching defun really is DEFUN-NAME. 3508 "Check if the name of the matching defun really is DEFUN-NAME.
3511Assumes point to be already positioned by 'ada-goto-matching-start'. 3509Assumes point to be already positioned by `ada-goto-matching-start'.
3512Moves point to the beginning of the declaration." 3510Moves point to the beginning of the declaration."
3513 3511
3514 ;; named block without a `declare' 3512 ;; named block without a `declare'
@@ -3547,12 +3545,12 @@ Moves point to the beginning of the declaration."
3547 ;; should be looking-at the correct name 3545 ;; should be looking-at the correct name
3548 ;; 3546 ;;
3549 (unless (looking-at (concat "\\<" defun-name "\\>")) 3547 (unless (looking-at (concat "\\<" defun-name "\\>"))
3550 (error "matching defun has different name: %s" 3548 (error "Matching defun has different name: %s"
3551 (buffer-substring (point) 3549 (buffer-substring (point)
3552 (progn (forward-sexp 1) (point)))))))) 3550 (progn (forward-sexp 1) (point))))))))
3553 3551
3554(defun ada-goto-matching-decl-start (&optional noerror recursive) 3552(defun ada-goto-matching-decl-start (&optional noerror recursive)
3555 "Moves point to the matching declaration start of the current 'begin'. 3553 "Move point to the matching declaration start of the current 'begin'.
3556If NOERROR is non-nil, it only returns nil if no match was found." 3554If NOERROR is non-nil, it only returns nil if no match was found."
3557 (let ((nest-count 1) 3555 (let ((nest-count 1)
3558 3556
@@ -3709,13 +3707,13 @@ If NOERROR is non-nil, it only returns nil if no match was found."
3709 (looking-at "declare\\|generic"))) 3707 (looking-at "declare\\|generic")))
3710 t 3708 t
3711 (if noerror nil 3709 (if noerror nil
3712 (error "no matching proc/func/task/declare/package/protected"))) 3710 (error "No matching proc/func/task/declare/package/protected")))
3713 )) 3711 ))
3714 3712
3715(defun ada-goto-matching-start (&optional nest-level noerror gotothen) 3713(defun ada-goto-matching-start (&optional nest-level noerror gotothen)
3716 "Moves point to the beginning of a block-start. 3714 "Move point to the beginning of a block-start.
3717Which block depends on the value of NEST-LEVEL, which defaults to zero. If 3715Which block depends on the value of NEST-LEVEL, which defaults to zero.
3718NOERROR is non-nil, it only returns nil if no matching start was found. 3716If NOERROR is non-nil, it only returns nil if no matching start was found.
3719If GOTOTHEN is non-nil, point moves to the 'then' following 'if'." 3717If GOTOTHEN is non-nil, point moves to the 'then' following 'if'."
3720 (let ((nest-count (if nest-level nest-level 0)) 3718 (let ((nest-count (if nest-level nest-level 0))
3721 (found nil) 3719 (found nil)
@@ -3852,16 +3850,16 @@ If GOTOTHEN is non-nil, point moves to the 'then' following 'if'."
3852 (unless (ada-search-ignore-string-comment 3850 (unless (ada-search-ignore-string-comment
3853 "accept" t nil nil 3851 "accept" t nil nil
3854 'word-search-backward) 3852 'word-search-backward)
3855 (error "missing 'accept' in front of 'do'")))) 3853 (error "Missing 'accept' in front of 'do'"))))
3856 (point)) 3854 (point))
3857 3855
3858 (if noerror 3856 (if noerror
3859 nil 3857 nil
3860 (error "no matching start")))))) 3858 (error "No matching start"))))))
3861 3859
3862 3860
3863(defun ada-goto-matching-end (&optional nest-level noerror) 3861(defun ada-goto-matching-end (&optional nest-level noerror)
3864 "Moves point to the end of a block. 3862 "Move point to the end of a block.
3865Which block depends on the value of NEST-LEVEL, which defaults to zero. 3863Which block depends on the value of NEST-LEVEL, which defaults to zero.
3866If NOERROR is non-nil, it only returns nil if found no matching start." 3864If NOERROR is non-nil, it only returns nil if found no matching start."
3867 (let ((nest-count (or nest-level 0)) 3865 (let ((nest-count (or nest-level 0))
@@ -3963,20 +3961,20 @@ If NOERROR is non-nil, it only returns nil if found no matching start."
3963 t 3961 t
3964 (if noerror 3962 (if noerror
3965 nil 3963 nil
3966 (error "no matching end"))) 3964 (error "No matching end")))
3967 )) 3965 ))
3968 3966
3969 3967
3970(defun ada-search-ignore-string-comment 3968(defun ada-search-ignore-string-comment
3971 (search-re &optional backward limit paramlists search-func) 3969 (search-re &optional backward limit paramlists search-func)
3972 "Regexp-search for SEARCH-RE, ignoring comments, strings. 3970 "Regexp-search for SEARCH-RE, ignoring comments, strings.
3973If PARAMLISTS is nil, ignore parameter lists. Returns a cons cell of 3971If PARAMLISTS is nil, ignore parameter lists. Returns a cons cell of
3974begin and end of match data or nil, if not found. 3972begin and end of match data or nil, if not found.
3975The search is done using SEARCH-FUNC, which should search backward if 3973The search is done using SEARCH-FUNC, which should search backward if
3976BACKWARD is non-nil, forward otherwise. SEARCH-FUNC can be optimized in case 3974BACKWARD is non-nil, forward otherwise. SEARCH-FUNC can be optimized
3977we are searching for a constant string. 3975in case we are searching for a constant string.
3978The search stops at pos LIMIT. 3976The search stops at pos LIMIT.
3979Point is moved at the beginning of the search-re." 3977Point is moved at the beginning of the SEARCH-RE."
3980 (let (found 3978 (let (found
3981 begin 3979 begin
3982 end 3980 end
@@ -4061,7 +4059,7 @@ Point is moved at the beginning of the search-re."
4061;; ------------------------------------------------------- 4059;; -------------------------------------------------------
4062 4060
4063(defun ada-in-decl-p () 4061(defun ada-in-decl-p ()
4064 "Returns t if point is inside a declarative part. 4062 "Return t if point is inside a declarative part.
4065Assumes point to be at the end of a statement." 4063Assumes point to be at the end of a statement."
4066 (or (ada-in-paramlist-p) 4064 (or (ada-in-paramlist-p)
4067 (save-excursion 4065 (save-excursion
@@ -4069,7 +4067,7 @@ Assumes point to be at the end of a statement."
4069 4067
4070 4068
4071(defun ada-looking-at-semi-or () 4069(defun ada-looking-at-semi-or ()
4072 "Returns t if looking-at an 'or' following a semicolon." 4070 "Return t if looking at an 'or' following a semicolon."
4073 (save-excursion 4071 (save-excursion
4074 (and (looking-at "\\<or\\>") 4072 (and (looking-at "\\<or\\>")
4075 (progn 4073 (progn
@@ -4079,7 +4077,7 @@ Assumes point to be at the end of a statement."
4079 4077
4080 4078
4081(defun ada-looking-at-semi-private () 4079(defun ada-looking-at-semi-private ()
4082 "Returns t if looking at the start of a private section in a package. 4080 "Return t if looking at the start of a private section in a package.
4083Returns nil if the private is part of the package name, as in 4081Returns nil if the private is part of the package name, as in
4084'private package A is...' (this can only happen at top level)." 4082'private package A is...' (this can only happen at top level)."
4085 (save-excursion 4083 (save-excursion
@@ -4101,7 +4099,7 @@ Returns nil if the private is part of the package name, as in
4101 4099
4102 4100
4103(defun ada-in-paramlist-p () 4101(defun ada-in-paramlist-p ()
4104 "Returns t if point is inside a parameter-list." 4102 "Return t if point is inside a parameter-list."
4105 (save-excursion 4103 (save-excursion
4106 (and 4104 (and
4107 (ada-search-ignore-string-comment "(\\|)" t nil t) 4105 (ada-search-ignore-string-comment "(\\|)" t nil t)
@@ -4151,7 +4149,7 @@ boolean expressions 'and then' and 'or else'."
4151 result)) 4149 result))
4152 4150
4153(defun ada-in-open-paren-p () 4151(defun ada-in-open-paren-p ()
4154 "Returns the position of the first non-ws behind the last unclosed 4152 "Return the position of the first non-ws behind the last unclosed
4155parenthesis, or nil." 4153parenthesis, or nil."
4156 (save-excursion 4154 (save-excursion
4157 (let ((parse (parse-partial-sexp 4155 (let ((parse (parse-partial-sexp
@@ -4186,26 +4184,26 @@ parenthesis, or nil."
4186(defun ada-tab () 4184(defun ada-tab ()
4187 "Do indenting or tabbing according to `ada-tab-policy'. 4185 "Do indenting or tabbing according to `ada-tab-policy'.
4188In Transient Mark mode, if the mark is active, operate on the contents 4186In Transient Mark mode, if the mark is active, operate on the contents
4189of the region. Otherwise, operates only on the current line." 4187of the region. Otherwise, operate only on the current line."
4190 (interactive) 4188 (interactive)
4191 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-tab-hard)) 4189 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-tab-hard))
4192 ((eq ada-tab-policy 'indent-auto) 4190 ((eq ada-tab-policy 'indent-auto)
4193 (if (ada-region-selected) 4191 (if (ada-region-selected)
4194 (ada-indent-region (region-beginning) (region-end)) 4192 (ada-indent-region (region-beginning) (region-end))
4195 (ada-indent-current))) 4193 (ada-indent-current)))
4196 ((eq ada-tab-policy 'always-tab) (error "not implemented")) 4194 ((eq ada-tab-policy 'always-tab) (error "Not implemented"))
4197 )) 4195 ))
4198 4196
4199(defun ada-untab (arg) 4197(defun ada-untab (arg)
4200 "Delete leading indenting according to `ada-tab-policy'." 4198 "Delete leading indenting according to `ada-tab-policy'."
4201 (interactive "P") 4199 (interactive "P")
4202 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-untab-hard)) 4200 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-untab-hard))
4203 ((eq ada-tab-policy 'indent-auto) (error "not implemented")) 4201 ((eq ada-tab-policy 'indent-auto) (error "Not implemented"))
4204 ((eq ada-tab-policy 'always-tab) (error "not implemented")) 4202 ((eq ada-tab-policy 'always-tab) (error "Not implemented"))
4205 )) 4203 ))
4206 4204
4207(defun ada-indent-current-function () 4205(defun ada-indent-current-function ()
4208 "Ada mode version of the indent-line-function." 4206 "Ada mode version of the `indent-line-function'."
4209 (interactive "*") 4207 (interactive "*")
4210 (let ((starting-point (point-marker))) 4208 (let ((starting-point (point-marker)))
4211 (beginning-of-line) 4209 (beginning-of-line)
@@ -4225,7 +4223,7 @@ of the region. Otherwise, operates only on the current line."
4225 (forward-char ada-indent))) 4223 (forward-char ada-indent)))
4226 4224
4227(defun ada-untab-hard () 4225(defun ada-untab-hard ()
4228 "indent current line to previous tab stop." 4226 "Indent current line to previous tab stop."
4229 (interactive) 4227 (interactive)
4230 (let ((bol (save-excursion (progn (beginning-of-line) (point)))) 4228 (let ((bol (save-excursion (progn (beginning-of-line) (point))))
4231 (eol (save-excursion (progn (end-of-line) (point))))) 4229 (eol (save-excursion (progn (end-of-line) (point)))))
@@ -4327,7 +4325,7 @@ of the region. Otherwise, operates only on the current line."
4327;; ------------------------------------------------------------- 4325;; -------------------------------------------------------------
4328 4326
4329(defun ada-move-to-start () 4327(defun ada-move-to-start ()
4330 "Moves point to the matching start of the current Ada structure." 4328 "Move point to the matching start of the current Ada structure."
4331 (interactive) 4329 (interactive)
4332 (let ((pos (point)) 4330 (let ((pos (point))
4333 (previous-syntax-table (syntax-table))) 4331 (previous-syntax-table (syntax-table)))
@@ -4348,7 +4346,7 @@ of the region. Otherwise, operates only on the current line."
4348 (or (looking-at "[ \t]*\\<end\\>") 4346 (or (looking-at "[ \t]*\\<end\\>")
4349 (backward-word 1)) 4347 (backward-word 1))
4350 (or (looking-at "[ \t]*\\<end\\>") 4348 (or (looking-at "[ \t]*\\<end\\>")
4351 (error "not on end ...;"))) 4349 (error "Not on end ...;")))
4352 (ada-goto-matching-start 1) 4350 (ada-goto-matching-start 1)
4353 (setq pos (point)) 4351 (setq pos (point))
4354 4352
@@ -4369,7 +4367,7 @@ of the region. Otherwise, operates only on the current line."
4369 (set-syntax-table previous-syntax-table)))) 4367 (set-syntax-table previous-syntax-table))))
4370 4368
4371(defun ada-move-to-end () 4369(defun ada-move-to-end ()
4372 "Moves point to the matching end of the block around point. 4370 "Move point to the matching end of the block around point.
4373Moves to 'begin' if in a declarative part." 4371Moves to 'begin' if in a declarative part."
4374 (interactive) 4372 (interactive)
4375 (let ((pos (point)) 4373 (let ((pos (point))
@@ -4447,7 +4445,7 @@ Moves to 'begin' if in a declarative part."
4447 (set-syntax-table previous-syntax-table)))) 4445 (set-syntax-table previous-syntax-table))))
4448 4446
4449(defun ada-next-procedure () 4447(defun ada-next-procedure ()
4450 "Moves point to next procedure." 4448 "Move point to next procedure."
4451 (interactive) 4449 (interactive)
4452 (end-of-line) 4450 (end-of-line)
4453 (if (re-search-forward ada-procedure-start-regexp nil t) 4451 (if (re-search-forward ada-procedure-start-regexp nil t)
@@ -4455,7 +4453,7 @@ Moves to 'begin' if in a declarative part."
4455 (error "No more functions/procedures/tasks"))) 4453 (error "No more functions/procedures/tasks")))
4456 4454
4457(defun ada-previous-procedure () 4455(defun ada-previous-procedure ()
4458 "Moves point to previous procedure." 4456 "Move point to previous procedure."
4459 (interactive) 4457 (interactive)
4460 (beginning-of-line) 4458 (beginning-of-line)
4461 (if (re-search-backward ada-procedure-start-regexp nil t) 4459 (if (re-search-backward ada-procedure-start-regexp nil t)
@@ -4463,7 +4461,7 @@ Moves to 'begin' if in a declarative part."
4463 (error "No more functions/procedures/tasks"))) 4461 (error "No more functions/procedures/tasks")))
4464 4462
4465(defun ada-next-package () 4463(defun ada-next-package ()
4466 "Moves point to next package." 4464 "Move point to next package."
4467 (interactive) 4465 (interactive)
4468 (end-of-line) 4466 (end-of-line)
4469 (if (re-search-forward ada-package-start-regexp nil t) 4467 (if (re-search-forward ada-package-start-regexp nil t)
@@ -4471,7 +4469,7 @@ Moves to 'begin' if in a declarative part."
4471 (error "No more packages"))) 4469 (error "No more packages")))
4472 4470
4473(defun ada-previous-package () 4471(defun ada-previous-package ()
4474 "Moves point to previous package." 4472 "Move point to previous package."
4475 (interactive) 4473 (interactive)
4476 (beginning-of-line) 4474 (beginning-of-line)
4477 (if (re-search-backward ada-package-start-regexp nil t) 4475 (if (re-search-backward ada-package-start-regexp nil t)
@@ -4591,7 +4589,7 @@ Moves to 'begin' if in a declarative part."
4591 4589
4592 4590
4593(defun ada-create-menu () 4591(defun ada-create-menu ()
4594 "Create the ada menu as shown in the menu bar." 4592 "Create the Ada menu as shown in the menu bar."
4595 (let ((m '("Ada" 4593 (let ((m '("Ada"
4596 ("Help" 4594 ("Help"
4597 ["Ada Mode" (info "ada-mode") t] 4595 ["Ada Mode" (info "ada-mode") t]
@@ -4788,28 +4786,28 @@ Moves to 'begin' if in a declarative part."
4788 (ada-indent-region beg end))) 4786 (ada-indent-region beg end)))
4789 4787
4790(defun ada-fill-comment-paragraph-justify () 4788(defun ada-fill-comment-paragraph-justify ()
4791 "Fills current comment paragraph and justifies each line as well." 4789 "Fill current comment paragraph and justify each line as well."
4792 (interactive) 4790 (interactive)
4793 (ada-fill-comment-paragraph 'full)) 4791 (ada-fill-comment-paragraph 'full))
4794 4792
4795(defun ada-fill-comment-paragraph-postfix () 4793(defun ada-fill-comment-paragraph-postfix ()
4796 "Fills current comment paragraph and justifies each line as well. 4794 "Fill current comment paragraph and justify each line as well.
4797Adds `ada-fill-comment-postfix' at the end of each line." 4795Adds `ada-fill-comment-postfix' at the end of each line."
4798 (interactive) 4796 (interactive)
4799 (ada-fill-comment-paragraph 'full t)) 4797 (ada-fill-comment-paragraph 'full t))
4800 4798
4801(defun ada-fill-comment-paragraph (&optional justify postfix) 4799(defun ada-fill-comment-paragraph (&optional justify postfix)
4802 "Fills the current comment paragraph. 4800 "Fill the current comment paragraph.
4803If JUSTIFY is non-nil, each line is justified as well. 4801If JUSTIFY is non-nil, each line is justified as well.
4804If POSTFIX and JUSTIFY are non-nil, `ada-fill-comment-postfix' is appended 4802If POSTFIX and JUSTIFY are non-nil, `ada-fill-comment-postfix' is appended
4805to each filled and justified line. 4803to each line filled and justified.
4806The paragraph is indented on the first line." 4804The paragraph is indented on the first line."
4807 (interactive "P") 4805 (interactive "P")
4808 4806
4809 ;; check if inside comment or just in front a comment 4807 ;; check if inside comment or just in front a comment
4810 (if (and (not (ada-in-comment-p)) 4808 (if (and (not (ada-in-comment-p))
4811 (not (looking-at "[ \t]*--"))) 4809 (not (looking-at "[ \t]*--")))
4812 (error "not inside comment")) 4810 (error "Not inside comment"))
4813 4811
4814 (let* (indent from to 4812 (let* (indent from to
4815 (opos (point-marker)) 4813 (opos (point-marker))
@@ -4920,8 +4918,8 @@ This is a generic function, independent from any compiler."
4920 4918
4921(defun ada-other-file-name () 4919(defun ada-other-file-name ()
4922 "Return the name of the other file. 4920 "Return the name of the other file.
4923The name returned is the body if current-buffer is the spec, or the spec 4921The name returned is the body if `current-buffer' is the spec,
4924otherwise." 4922or the spec otherwise."
4925 4923
4926 (let ((is-spec nil) 4924 (let ((is-spec nil)
4927 (is-body nil) 4925 (is-body nil)
@@ -4990,15 +4988,15 @@ Redefines the function `ff-which-function-are-we-in'."
4990 4988
4991 4989
4992(defvar ada-last-which-function-line -1 4990(defvar ada-last-which-function-line -1
4993 "Last on which ada-which-function was called") 4991 "Last on which `ada-which-function' was called.")
4994(defvar ada-last-which-function-subprog 0 4992(defvar ada-last-which-function-subprog 0
4995 "Last subprogram name returned by ada-which-function") 4993 "Last subprogram name returned by `ada-which-function'.")
4996(make-variable-buffer-local 'ada-last-which-function-subprog) 4994(make-variable-buffer-local 'ada-last-which-function-subprog)
4997(make-variable-buffer-local 'ada-last-which-function-line) 4995(make-variable-buffer-local 'ada-last-which-function-line)
4998 4996
4999 4997
5000(defun ada-which-function () 4998(defun ada-which-function ()
5001 "Returns the name of the function whose body the point is in. 4999 "Return the name of the function whose body the point is in.
5002This function works even in the case of nested subprograms, whereas the 5000This function works even in the case of nested subprograms, whereas the
5003standard Emacs function `which-function' does not. 5001standard Emacs function `which-function' does not.
5004Since the search can be long, the results are cached." 5002Since the search can be long, the results are cached."
@@ -5082,8 +5080,8 @@ Since the search can be long, the results are cached."
5082 (goto-char (point-min)))))) 5080 (goto-char (point-min))))))
5083 5081
5084(defun ada-get-body-name (&optional spec-name) 5082(defun ada-get-body-name (&optional spec-name)
5085 "Returns the file name for the body of SPEC-NAME. 5083 "Return the file name for the body of SPEC-NAME.
5086If SPEC-NAME is nil, returns the body for the current package. 5084If SPEC-NAME is nil, return the body for the current package.
5087Returns nil if no body was found." 5085Returns nil if no body was found."
5088 (interactive) 5086 (interactive)
5089 5087
@@ -5230,7 +5228,7 @@ Returns nil if no body was found."
5230;; --------------------------------------------------------- 5228;; ---------------------------------------------------------
5231 5229
5232(defun ada-outline-level () 5230(defun ada-outline-level ()
5233 "This is so that `current-column` DTRT in otherwise-hidden text" 5231 "This is so that `current-column' DTRT in otherwise-hidden text."
5234 ;; patch from Dave Love <fx@gnu.org> 5232 ;; patch from Dave Love <fx@gnu.org>
5235 (let (buffer-invisibility-spec) 5233 (let (buffer-invisibility-spec)
5236 (save-excursion 5234 (save-excursion
@@ -5242,10 +5240,10 @@ Returns nil if no body was found."
5242;; --------------------------------------------------------- 5240;; ---------------------------------------------------------
5243 5241
5244(defun ada-narrow-to-defun (&optional arg) 5242(defun ada-narrow-to-defun (&optional arg)
5245 "make text outside current subprogram invisible. 5243 "Make text outside current subprogram invisible.
5246The subprogram visible is the one that contains or follow point. 5244The subprogram visible is the one that contains or follow point.
5247Optional ARG is ignored. 5245Optional ARG is ignored.
5248Use `M-x widen' to go back to the full visibility for the buffer" 5246Use `M-x widen' to go back to the full visibility for the buffer."
5249 5247
5250 (interactive) 5248 (interactive)
5251 (save-excursion 5249 (save-excursion
@@ -5276,8 +5274,8 @@ Use `M-x widen' to go back to the full visibility for the buffer"
5276 5274
5277(defun ada-gen-treat-proc (match) 5275(defun ada-gen-treat-proc (match)
5278 "Make dummy body of a procedure/function specification. 5276 "Make dummy body of a procedure/function specification.
5279MATCH is a cons cell containing the start and end location of the last search 5277MATCH is a cons cell containing the start and end locations of the last search
5280for ada-procedure-start-regexp." 5278for `ada-procedure-start-regexp'."
5281 (goto-char (car match)) 5279 (goto-char (car match))
5282 (let (func-found procname functype) 5280 (let (func-found procname functype)
5283 (cond 5281 (cond
@@ -5398,7 +5396,7 @@ This function typically is to be hooked into `ff-file-created-hooks'."
5398 (setq body-file (ada-get-body-name)) 5396 (setq body-file (ada-get-body-name))
5399 (if body-file 5397 (if body-file
5400 (find-file body-file) 5398 (find-file body-file)
5401 (error "No body found for the package. Create it first")) 5399 (error "No body found for the package. Create it first"))
5402 5400
5403 (save-restriction 5401 (save-restriction
5404 (widen) 5402 (widen)