• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/progmodes/

Lines Matching defs:ada

0 ;;; ada-mode.el --- major-mode for editing Ada sources
10 ;; Keywords: languages ada
32 ;;; composed of four Lisp files: ada-mode.el, ada-xref.el, ada-prj.el
33 ;;; and ada-stmt.el. Only this file (ada-mode.el) is completely
40 ;;; another file, called ada-vms.el, that provides some required
45 ;;; By default, the valid extensions for Ada files are .ads, .adb or .ada
46 ;;; If the ada-mode does not start automatically, then simply type the
48 ;;; M-x ada-mode
50 ;;; By default, ada-mode is configured to take full advantage of the GNAT
53 ;;; variable in your .emacs (Note: do not set this in the ada-mode-hook, it
55 ;;; (setq ada-which-compiler 'generic)
62 ;;; This was distributed as ada.el in versions of Emacs prior to 19.29.
67 ;;; (wuarchive.wustl.edu:/languages/ada) as ada-mode-1.06a.tar.Z.
69 ;;; The probably very first Ada mode (called electric-ada.el) was
71 ;;; Gosling Emacs. L. Slater based his development on ada.el and
72 ;;; electric-ada.el.
87 ;;; ada-imenu-generic-expression
89 ;;; to the ada-mode
101 ;;; The names start with ada-
108 ;;; should be loaded before the ada-mode, which will then setup some variables
138 (defun ada-check-emacs-version (major minor &optional is-xemacs)
149 (defun ada-mode-version ()
157 (defvar ada-mode-hook nil
159 This hook is automatically executed after the `ada-mode' is
163 (defgroup ada nil
168 (defcustom ada-auto-case t
170 Casing is done according to `ada-case-keyword', `ada-case-identifier'
171 and `ada-case-attribute'."
172 :type 'boolean :group 'ada)
174 (defcustom ada-broken-decl-indent 0
181 :type 'integer :group 'ada)
183 (defcustom ada-broken-indent 2
189 :type 'integer :group 'ada)
191 (defcustom ada-continuation-indent ada-broken-indent
197 :type 'integer :group 'ada)
199 (defcustom ada-case-attribute 'ada-capitalize-word
201 It may be `downcase-word', `upcase-word', `ada-loose-case-word',
202 `ada-capitalize-word' or `ada-no-auto-case'."
205 (const ada-capitalize-word)
206 (const ada-loose-case-word)
207 (const ada-no-auto-case))
208 :group 'ada)
210 (defcustom ada-case-exception-file
214 when you call `ada-create-case-exception'.
223 :group 'ada)
225 (defcustom ada-case-keyword 'downcase-word
227 It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
228 `ada-capitalize-word'."
231 (const ada-capitalize-word)
232 (const ada-loose-case-word)
233 (const ada-no-auto-case))
234 :group 'ada)
236 (defcustom ada-case-identifier 'ada-loose-case-word
238 It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
239 `ada-capitalize-word'."
242 (const ada-capitalize-word)
243 (const ada-loose-case-word)
244 (const ada-no-auto-case))
245 :group 'ada)
247 (defcustom ada-clean-buffer-before-saving t
249 :type 'boolean :group 'ada)
251 (defcustom ada-indent 3
258 :type 'integer :group 'ada)
260 (defcustom ada-indent-after-return t
262 :type 'boolean :group 'ada)
264 (defcustom ada-indent-align-comments t
267 Note that indentation is calculated only if `ada-indent-comment-as-code' is t.
271 -- aligned if ada-indent-align-comments is t"
272 :type 'boolean :group 'ada)
274 (defcustom ada-indent-comment-as-code t
277 :type 'boolean :group 'ada)
279 (defcustom ada-indent-handle-comment-special nil
284 a comment and `ada-indent-handle-comment-special' is t.
291 ( -- `ada-indent-handle-comment-special' is nil
296 ( -- `ada-indent-handle-comment-special' is non-nil
299 :type 'boolean :group 'ada)
301 (defcustom ada-indent-is-separate t
303 :type 'boolean :group 'ada)
305 (defcustom ada-indent-record-rel-type 3
311 :type 'integer :group 'ada)
313 (defcustom ada-indent-renames ada-broken-indent
315 If `ada-indent-return' is null or negative, the indentation is done relative to
316 the open parenthesis (if there is no parenthesis, `ada-broken-indent' is used).
322 :type 'integer :group 'ada)
324 (defcustom ada-indent-return 0
326 If `ada-indent-return' is null or negative, the indentation is done relative to
327 the open parenthesis (if there is no parenthesis, `ada-broken-indent' is used).
332 :type 'integer :group 'ada)
334 (defcustom ada-indent-to-open-paren t
336 :type 'boolean :group 'ada)
338 (defcustom ada-fill-comment-prefix "-- "
340 Note: if you modify this variable, you will have to invoke `ada-mode'
342 :type 'string :group 'ada)
344 (defcustom ada-fill-comment-postfix " --"
346 Used by `ada-fill-comment-paragraph-postfix'."
347 :type 'string :group 'ada)
349 (defcustom ada-label-indent -4
358 :type 'integer :group 'ada)
360 (defcustom ada-language-version 'ada95
362 :type '(choice (const ada83) (const ada95) (const ada2005)) :group 'ada)
364 (defcustom ada-move-to-declaration nil
365 "*Non-nil means `ada-move-to-start' moves to the subprogram declaration, not to 'begin'."
366 :type 'boolean :group 'ada)
368 (defcustom ada-popup-key '[down-mouse-3]
372 :group 'ada)
374 (defcustom ada-search-directories
381 is the initial value of `ada-search-directories-internal'."
385 :group 'ada)
387 (defvar ada-search-directories-internal ada-search-directories
388 "Internal version of `ada-search-directories'.
391 `ada-search-directories'.")
393 (defcustom ada-stmt-end-indent 0
399 :type 'integer :group 'ada)
401 (defcustom ada-tab-policy 'indent-auto
404 `indent-rigidly' : always adds `ada-indent' blanks at the beginning of the line.
410 :group 'ada)
412 (defcustom ada-use-indent ada-broken-indent
418 :type 'integer :group 'ada)
420 (defcustom ada-when-indent 3
426 :type 'integer :group 'ada)
428 (defcustom ada-with-indent ada-broken-indent
434 :type 'integer :group 'ada)
436 (defcustom ada-which-compiler 'gnat
445 :group 'ada)
452 (defvar ada-body-suffixes '(".adb")
456 (defvar ada-spec-suffixes '(".ads")
460 (defvar ada-mode-menu (make-sparse-keymap "Ada")
463 (defvar ada-mode-map (make-sparse-keymap)
466 (defvar ada-mode-abbrev-table nil
469 (defvar ada-mode-syntax-table nil
472 (defvar ada-mode-symbol-syntax-table nil
477 (defconst ada-83-string-keywords
487 Used to define `ada-*-keywords'.")
489 (defconst ada-95-string-keywords
492 Used to define `ada-*-keywords'.")
494 (defconst ada-2005-string-keywords
497 Used to define `ada-*-keywords.'"))
499 (defvar ada-ret-binding nil
502 (defvar ada-case-exception '()
505 (defvar ada-case-exception-substring '()
508 is not itself in `ada-case-exception', and only for substrings that
511 (defvar ada-lfd-binding nil
514 (defvar ada-other-file-alist nil
518 (defvar ada-align-list
527 (defvar ada-align-modes
528 '((ada-declaration
530 (valid . (lambda() (not (ada-in-comment-p))))
531 (modes . '(ada-mode)))
532 (ada-assignment
534 (valid . (lambda() (not (ada-in-comment-p))))
535 (modes . '(ada-mode)))
536 (ada-comment
538 (modes . '(ada-mode)))
539 (ada-use
541 (valid . (lambda() (not (ada-in-comment-p))))
542 (modes . '(ada-mode)))
547 (defconst ada-align-region-separate
571 (defconst ada-83-keywords
573 (concat "\\<" (regexp-opt ada-83-string-keywords t) "\\>"))
576 (defconst ada-95-keywords
580 ada-95-string-keywords
581 ada-83-string-keywords) t) "\\>"))
584 (defconst ada-2005-keywords
588 ada-2005-string-keywords
589 ada-83-string-keywords
590 ada-95-string-keywords) t) "\\>"))
593 (defvar ada-keywords ada-2005-keywords
597 (defconst ada-ident-re
603 (defvar ada-procedure-start-regexp
618 (defconst ada-name-regexp
622 (defconst ada-package-start-regexp
623 (concat "^[ \t]*\\(private[ \t]+\\)?\\(package\\)[ \t\n]+\\(body[ \t]*\\)?" ada-name-regexp)
627 (defconst ada-compile-goto-error-file-linenr-re
634 (defvar ada-block-start-re
642 (defvar ada-end-stmt-re
658 (defvar ada-matching-start-re
665 "Regexp used in `ada-goto-matching-start'.")
667 (defvar ada-matching-decl-start-re
673 "Regexp used in `ada-goto-matching-decl-start'.")
675 (defvar ada-loop-start-re
679 (defvar ada-subprog-start-re
685 (defvar ada-named-block-re
689 (defvar ada-contextual-menu-on-identifier nil
692 (defvar ada-contextual-menu-last-point nil
695 Since `ada-popup-menu' moves the point where the user clicked, the region
702 (easy-menu-define ada-contextual-menu nil
704 The variable `ada-contextual-menu-on-identifier' will be set to t before
707 ["Goto Declaration/Body" ada-point-and-xref
708 :included ada-contextual-menu-on-identifier]
709 ["Goto Body" ada-point-and-xref-body
710 :included ada-contextual-menu-on-identifier]
711 ["Goto Previous Reference" ada-xref-goto-previous-reference]
712 ["List References" ada-find-references
713 :included ada-contextual-menu-on-identifier]
714 ["List Local References" ada-find-local-references
715 :included ada-contextual-menu-on-identifier]
718 ["Goto Parent Unit" ada-goto-parent]))
726 (defconst ada-imenu-comment-re "\\([ \t]*--.*\\)?")
728 (defconst ada-imenu-subprogram-menu-re
731 ada-imenu-comment-re
735 (defvar ada-imenu-generic-expression
737 (list nil ada-imenu-subprogram-menu-re 2)
742 "\\(" ada-imenu-comment-re "[ \t\n]+\\|[ \t\n]*([^)]+)"
743 ada-imenu-comment-re "\\)";; parameter list or simple space
761 (defun ada-compile-mouse-goto-error ()
762 "Mouse interface for `ada-compile-goto-error'."
765 (ada-compile-goto-error (point))
768 (defun ada-compile-goto-error (pos)
784 (or (looking-at ada-compile-goto-error-file-linenr-re)
788 (looking-at ada-compile-goto-error-file-linenr-re))
796 (looking-at ada-compile-goto-error-file-linenr-re)
834 ;; the standard Emacs functions for sexp (see `ada-in-string-p')
841 ;; `ada-after-change-function', thanks to `ada-deactivate-properties' and
842 ;; `ada-initialize-properties'.
853 (defun ada-create-syntax-table ()
858 (setq ada-mode-syntax-table (make-syntax-table))
859 (set-syntax-table ada-mode-syntax-table)
864 (modify-syntax-entry ?% "$" ada-mode-syntax-table)
865 (modify-syntax-entry ?\" "\"" ada-mode-syntax-table)
867 (modify-syntax-entry ?: "." ada-mode-syntax-table)
868 (modify-syntax-entry ?\; "." ada-mode-syntax-table)
869 (modify-syntax-entry ?& "." ada-mode-syntax-table)
870 (modify-syntax-entry ?\| "." ada-mode-syntax-table)
871 (modify-syntax-entry ?+ "." ada-mode-syntax-table)
872 (modify-syntax-entry ?* "." ada-mode-syntax-table)
873 (modify-syntax-entry ?/ "." ada-mode-syntax-table)
874 (modify-syntax-entry ?= "." ada-mode-syntax-table)
875 (modify-syntax-entry ?< "." ada-mode-syntax-table)
876 (modify-syntax-entry ?> "." ada-mode-syntax-table)
877 (modify-syntax-entry ?$ "." ada-mode-syntax-table)
878 (modify-syntax-entry ?\[ "." ada-mode-syntax-table)
879 (modify-syntax-entry ?\] "." ada-mode-syntax-table)
880 (modify-syntax-entry ?\{ "." ada-mode-syntax-table)
881 (modify-syntax-entry ?\} "." ada-mode-syntax-table)
882 (modify-syntax-entry ?. "." ada-mode-syntax-table)
883 (modify-syntax-entry ?\\ "." ada-mode-syntax-table)
884 (modify-syntax-entry ?\' "." ada-mode-syntax-table)
887 (modify-syntax-entry ?- ". 12" ada-mode-syntax-table)
892 (modify-syntax-entry ?# "<" ada-mode-syntax-table)
893 (modify-syntax-entry ?# "$" ada-mode-syntax-table))
896 (modify-syntax-entry ?\f "> " ada-mode-syntax-table)
897 (modify-syntax-entry ?\n "> " ada-mode-syntax-table)
900 (modify-syntax-entry ?_ "_" ada-mode-syntax-table)
903 (modify-syntax-entry ?\( "()" ada-mode-syntax-table)
904 (modify-syntax-entry ?\) ")(" ada-mode-syntax-table)
906 (setq ada-mode-symbol-syntax-table (copy-syntax-table ada-mode-syntax-table))
907 (modify-syntax-entry ?_ "w" ada-mode-symbol-syntax-table)
943 (defun ada-deactivate-properties ()
946 (remove-hook 'after-change-functions 'ada-after-change-function t))
948 (defun ada-initialize-properties ()
968 (add-hook 'after-change-functions 'ada-after-change-function nil t)
971 (defun ada-after-change-function (beg end old-len)
992 (defsubst ada-in-comment-p (&optional parse-result)
999 (defsubst ada-in-string-p (&optional parse-result)
1006 (defsubst ada-in-string-or-comment-p (&optional parse-result)
1012 (or (ada-in-string-p parse-result) (ada-in-comment-p parse-result)))
1019 ;; Add items to this menu by modifying `ada-contextual-menu'. Note that the
1020 ;; variable `ada-contextual-menu-on-identifier' is set automatically to t
1024 (defun ada-call-from-contextual-menu (function)
1029 (setq ada-contextual-menu-last-point
1032 (defun ada-popup-menu (position)
1035 Sets `ada-contextual-menu-last-point' to the current position before
1044 (setq ada-contextual-menu-last-point
1048 (setq ada-contextual-menu-on-identifier
1052 (not (ada-in-string-or-comment-p))
1054 (not (ada-after-keyword-p)))
1057 (funcall (symbol-function 'popup-menu) ada-contextual-menu)
1059 (setq choice (x-popup-menu position ada-contextual-menu))
1061 (funcall (lookup-key ada-contextual-menu (vector (car choice)))))))
1063 (set-buffer (cadr ada-contextual-menu-last-point))
1064 (goto-char (car ada-contextual-menu-last-point))
1073 (defun ada-add-extensions (spec body)
1080 (tmp (assoc reg ada-other-file-alist)))
1083 (add-to-list 'ada-other-file-alist (list reg (list spec)))))
1086 (tmp (assoc reg ada-other-file-alist)))
1089 (add-to-list 'ada-other-file-alist (list reg (list body)))))
1092 (cons (concat (regexp-quote spec) "\\'") 'ada-mode))
1094 (cons (concat (regexp-quote body) "\\'") 'ada-mode))
1096 (add-to-list 'ada-spec-suffixes spec)
1097 (add-to-list 'ada-body-suffixes body)
1111 (defun ada-mode ()
1115 \\{ada-mode-map}
1117 Indent line '\\[ada-tab]'
1120 Re-format the parameter-list point is in '\\[ada-format-paramlist]'
1121 Indent all lines in region '\\[ada-indent-region]'
1123 Adjust case of identifiers and keywords in region '\\[ada-adjust-case-region]'
1124 Adjust case of identifiers and keywords in buffer '\\[ada-adjust-case-buffer]'
1128 Next func/proc/task '\\[ada-next-procedure]' Previous func/proc/task '\\[ada-previous-procedure]'
1129 Next package '\\[ada-next-package]' Previous package '\\[ada-previous-package]'
1131 Goto matching start of current 'end ...;' '\\[ada-move-to-start]'
1132 Goto end of current block '\\[ada-move-to-end]'
1137 Uncomment region '\\[ada-uncomment-region]'
1146 Switch to other file in other window '\\[ada-ff-other-window]'
1150 If you use ada-xref.el:
1151 Goto declaration: '\\[ada-point-and-xref]' on the identifier
1152 or '\\[ada-goto-declaration]' with point on the identifier
1153 Complete identifier: '\\[ada-complete-identifier]'."
1182 'ada-indent-current-function)
1191 (if (ada-check-emacs-version 20 3)
1203 'ada-fill-comment-paragraph)
1206 ada-imenu-generic-expression)
1215 'ada-compile-mouse-goto-error)
1217 'ada-compile-goto-error)
1219 'ada-compile-goto-error)))
1227 (put 'ada-mode 'font-lock-defaults
1228 '(ada-font-lock-keywords
1232 '(ada-font-lock-keywords
1236 (font-lock-syntactic-keywords . ada-font-lock-syntactic-keywords)))
1241 'ada-other-file-alist)
1243 'ada-search-directories-internal)
1244 (setq ff-post-load-hook 'ada-set-point-accordingly
1245 ff-file-created-hook 'ada-make-body)
1246 (add-hook 'ff-pre-load-hook 'ada-which-function-are-we-in)
1258 ada-search-directories-internal
1259 (ada-make-filename-from-adaname (match-string 3))
1260 ada-spec-suffixes)))
1266 ada-search-directories-internal
1267 (ada-make-filename-from-adaname (match-string 1))
1268 ada-spec-suffixes)))
1274 ada-search-directories-internal
1275 (ada-make-filename-from-adaname (match-string 1))
1276 ada-spec-suffixes)))
1282 (set (make-local-variable 'outline-level) 'ada-outline-level)
1291 (add-to-list 'align-dq-string-modes 'ada-mode)
1292 (add-to-list 'align-open-comment-modes 'ada-mode)
1293 (set (make-local-variable 'align-region-separate) ada-align-region-separate)
1297 '(ada-solo-comment
1299 (modes . '(ada-mode))))
1301 '(ada-solo-use
1303 (modes . '(ada-mode))))
1305 (setq ada-align-modes nil)
1307 (add-to-list 'ada-align-modes
1308 '(ada-declaration-assign
1310 (valid . (lambda() (not (ada-in-comment-p))))
1312 (modes . '(ada-mode))))
1313 (add-to-list 'ada-align-modes
1314 '(ada-associate
1316 (valid . (lambda() (not (ada-in-comment-p))))
1317 (modes . '(ada-mode))))
1318 (add-to-list 'ada-align-modes
1319 '(ada-comment
1321 (modes . '(ada-mode))))
1322 (add-to-list 'ada-align-modes
1323 '(ada-use
1325 (valid . (lambda() (not (ada-in-comment-p))))
1326 (modes . '(ada-mode))))
1327 (add-to-list 'ada-align-modes
1328 '(ada-at
1330 (modes . '(ada-mode))))
1332 (setq align-mode-rules-list ada-align-modes)
1335 (if ada-popup-key
1336 (define-key ada-mode-map ada-popup-key 'ada-popup-menu))
1339 (define-abbrev-table 'ada-mode-abbrev-table ())
1340 (setq local-abbrev-table ada-mode-abbrev-table)
1344 (setq which-func-functions '(ada-which-function))
1349 (setq major-mode 'ada-mode
1352 (use-local-map ada-mode-map)
1354 (easy-menu-add ada-mode-menu ada-mode-map)
1356 (set-syntax-table ada-mode-syntax-table)
1358 (if ada-clean-buffer-before-saving
1368 (min ada-indent (current-column))))))
1369 (add-hook 'skeleton-end-hook 'ada-adjust-case-skeleton nil t)
1371 (run-mode-hooks 'ada-mode-hook)
1374 ;; ada-fill-comment-prefix
1376 (if ada-fill-comment-prefix
1377 (set 'comment-start ada-fill-comment-prefix)
1385 (ada-initialize-properties)
1386 (add-hook 'font-lock-mode-hook 'ada-deactivate-properties nil t)))
1388 ;; the following has to be done after running the ada-mode-hook
1392 (cond ((eq ada-language-version 'ada83)
1393 (setq ada-keywords ada-83-keywords))
1394 ((eq ada-language-version 'ada95)
1395 (setq ada-keywords ada-95-keywords))
1396 ((eq ada-language-version 'ada2005)
1397 (setq ada-keywords ada-2005-keywords)))
1399 (if ada-auto-case
1400 (ada-activate-keys-for-case)))
1402 (defun ada-adjust-case-skeleton ()
1406 (ada-adjust-case-region
1411 (defun ada-region-selected ()
1425 ;; `ada-case-attribute', `ada-case-keyword' and `ada-case-identifier'. These
1430 ;; one word per line. These files are stored in `ada-case-exception-file'.
1434 (defun ada-save-exceptions-to-file (file-name)
1436 Casing exception lists are `ada-case-exception' and `ada-case-exception-substring'."
1440 (sort (copy-sequence ada-case-exception)
1443 (sort (copy-sequence ada-case-exception-substring)
1449 (defun ada-create-case-exception (&optional word)
1452 The new words is added to the first file in `ada-case-exception-file'.
1459 (cond ((stringp ada-case-exception-file)
1460 (setq file-name ada-case-exception-file))
1461 ((listp ada-case-exception-file)
1462 (setq file-name (car ada-case-exception-file)))
1465 "See variable ada-case-exception-file"))))
1467 (set-syntax-table ada-mode-symbol-syntax-table)
1476 (ada-case-read-exceptions-from-file file-name)
1480 (if (and (not (equal ada-case-exception '()))
1481 (assoc-string word ada-case-exception t))
1482 (setcar (assoc-string word ada-case-exception t) word)
1483 (add-to-list 'ada-case-exception (cons word t))
1486 (ada-save-exceptions-to-file file-name)
1489 (defun ada-create-case-exception-substring (&optional word)
1493 The new word is added to the first file in `ada-case-exception-file'.
1498 (cond ((stringp ada-case-exception-file)
1499 ada-case-exception-file)
1500 ((listp ada-case-exception-file)
1501 (car ada-case-exception-file))
1504 "See variable ada-case-exception-file"))))))
1511 ((ada-region-selected)
1529 (ada-case-read-exceptions-from-file file-name)
1533 (if (and (not (equal ada-case-exception-substring '()))
1534 (assoc-string word ada-case-exception-substring t))
1535 (setcar (assoc-string word ada-case-exception-substring t) word)
1536 (add-to-list 'ada-case-exception-substring (cons word t))
1539 (ada-save-exceptions-to-file file-name)
1543 (defun ada-case-read-exceptions-from-file (file-name)
1548 (set-syntax-table ada-mode-symbol-syntax-table)
1563 (unless (assoc-string word ada-case-exception-substring t)
1564 (add-to-list 'ada-case-exception-substring (cons word t))))
1565 (unless (assoc-string word ada-case-exception t)
1566 (add-to-list 'ada-case-exception (cons word t)))))
1573 (defun ada-case-read-exceptions ()
1574 "Read all the casing exception files from `ada-case-exception-file'."
1578 (setq ada-case-exception '()
1579 ada-case-exception-substring '())
1581 (cond ((stringp ada-case-exception-file)
1582 (ada-case-read-exceptions-from-file ada-case-exception-file))
1584 ((listp ada-case-exception-file)
1585 (mapcar 'ada-case-read-exceptions-from-file
1586 ada-case-exception-file))))
1588 (defun ada-adjust-case-substring ()
1591 (let ((substrings ada-case-exception-substring)
1616 (defun ada-adjust-case-identifier ()
1618 The auto-casing is done according to the value of `ada-case-identifier'
1619 and the exceptions defined in `ada-case-exception-file'."
1621 (if (or (equal ada-case-exception '())
1624 (funcall ada-case-identifier -1)
1625 (ada-adjust-case-substring))
1634 ada-case-exception t))
1641 (funcall ada-case-identifier -1)
1642 (ada-adjust-case-substring))))))
1644 (defun ada-after-keyword-p ()
1651 (looking-at (concat ada-keywords "[^_]")))))
1653 (defun ada-adjust-case (&optional force-identifier)
1666 (not (ada-in-string-or-comment-p))
1673 (funcall ada-case-attribute -1)
1676 (ada-after-keyword-p))
1677 (funcall ada-case-keyword -1)
1678 (ada-adjust-case-identifier))))
1683 (defun ada-adjust-case-interactive (arg)
1688 (if ada-auto-case
1694 (set-syntax-table ada-mode-symbol-syntax-table)
1699 (ada-adjust-case)
1705 (funcall ada-lfd-binding))
1707 (funcall ada-ret-binding))))
1708 ((eq lastk ?\C-i) (ada-tab))
1714 (ada-adjust-case t)
1715 (ada-adjust-case))
1724 (funcall ada-lfd-binding))
1726 (funcall ada-ret-binding))
1731 (defun ada-activate-keys-for-case ()
1738 (or ada-ret-binding (setq ada-ret-binding (key-binding "\C-M")))
1739 (or ada-lfd-binding (setq ada-lfd-binding (key-binding "\C-j")))
1743 ada-mode-map
1745 'ada-adjust-case-interactive)))
1749 (defun ada-loose-case-word (&optional arg)
1765 (defun ada-no-auto-case (&optional arg)
1769 instance use it for `ada-case-identifier' if you don't want any special
1771 See also `ada-auto-case' to disable auto casing altogether."
1774 (defun ada-capitalize-word (&optional arg)
1784 (defun ada-adjust-case-region (from to)
1796 (set-syntax-table ada-mode-symbol-syntax-table)
1810 (ada-in-string-or-comment-p)
1816 (setq keywordp (looking-at ada-keywords))
1822 (funcall ada-case-attribute -1)
1824 (funcall ada-case-keyword -1)
1825 (ada-adjust-case-identifier)))
1830 (defun ada-adjust-case-buffer ()
1834 (ada-adjust-case-region (point-min) (point-max)))
1846 ;; This is done in `ada-scan-paramlist'.
1848 ;; `ada-insert-paramlist'.
1849 ;; Both steps are called from `ada-format-paramlist'.
1854 (defun ada-format-paramlist ()
1864 (set-syntax-table ada-mode-symbol-syntax-table)
1867 (or (ada-in-paramlist-p)
1871 (ada-search-ignore-string-comment
1872 (concat ada-subprog-start-re "\\|\\<body\\>" ) t nil)
1888 (setq paramlist (ada-scan-paramlist (1+ begin) end))
1895 (ada-insert-paramlist paramlist))
1901 (defun ada-scan-paramlist (begin end)
1918 (ada-goto-next-non-ws)
1923 (ada-search-ignore-string-comment "[ \t\n]*;" nil end t))
1934 (ada-search-ignore-string-comment ":" nil epos t 'search-forward)
1942 (ada-search-ignore-string-comment
1951 (ada-search-ignore-string-comment
1960 (ada-search-ignore-string-comment
1965 (ada-goto-next-non-ws)
1968 (ada-goto-next-non-ws))
1984 (ada-search-ignore-string-comment
1999 (defun ada-insert-paramlist (paramlist)
2036 (ada-indent-current)
2052 (ada-indent-current)
2111 (ada-indent-newline-indent))
2134 ;; - `ada-indent-region': Re-indent a region of text
2135 ;; - `ada-justified-indent-current': Re-indent the current line and shows the
2137 ;; - `ada-indent-current': Re-indent the current line
2138 ;; - `ada-get-current-indent': Calculate the indentation for the current line,
2140 ;; - `ada-get-indent-*': Calculate the indentation in a specific context.
2145 (defun ada-indent-region (beg end)
2162 (ada-indent-current))
2167 (defun ada-indent-newline-indent ()
2170 (ada-indent-current)
2172 (ada-indent-current))
2174 (defun ada-indent-newline-indent-conditional ()
2176 The original line is indented first if `ada-indent-after-return' is non-nil."
2178 (if ada-indent-after-return (ada-indent-current))
2180 (ada-indent-current))
2182 (defun ada-justified-indent-current ()
2186 (let ((cur-indent (ada-indent-current)))
2209 (defun ada-batch-reformat ()
2213 emacs -batch -l ada-mode -f ada-batch-reformat file1 file2 ..."
2219 (ada-indent-region (point-min) (point-max))
2220 (ada-adjust-case-buffer)
2226 (defsubst ada-goto-previous-word ()
2229 (ada-goto-next-word t))
2231 (defun ada-indent-current ()
2243 (set-syntax-table ada-mode-symbol-syntax-table)
2257 (ada-get-current-indent))
2301 (defun ada-get-current-indent ()
2320 ((and ada-indent-to-open-paren
2321 (not (ada-in-paramlist-p))
2322 (setq column (ada-in-open-paren-p)))
2340 (list column 'ada-broken-indent)
2343 ;; (ada-broken-line from the opening parenthesis. However, in
2349 ;; and then C) -- indented by ada-broken-indent
2359 (list column 'ada-continuation-indent)
2367 (ada-indent-on-previous-lines nil orgpoint orgpoint))
2382 (ada-goto-matching-start 1)
2394 (setq limit (car (ada-search-ignore-string-comment ";" t))))
2398 (ada-search-ignore-string-comment ada-loop-start-re t limit))
2404 (if (looking-at ada-named-block-re)
2405 (setq label (- ada-label-indent))))))))
2420 (car (ada-search-ignore-string-comment "\\<type\\>" t)))
2430 (ada-goto-matching-start 1)
2436 (if (save-excursion (ada-goto-previous-word)
2438 (ada-indent-on-previous-lines nil orgpoint orgpoint)
2440 (ada-goto-matching-start 1 nil t)
2447 (ada-goto-matching-start 1 nil t)
2459 (ada-goto-matching-start 1)
2461 'ada-when-indent)))
2469 (if (save-excursion (ada-goto-previous-word)
2471 (ada-indent-on-previous-lines nil orgpoint orgpoint)
2474 (ada-search-ignore-string-comment
2477 'ada-stmt-end-indent))))
2488 (ada-goto-stmt-start)
2490 (ada-indent-on-previous-lines nil orgpoint orgpoint)
2491 (unless (looking-at ada-loop-start-re)
2492 (ada-search-ignore-string-comment ada-loop-start-re
2495 (ada-indent-on-previous-lines nil orgpoint orgpoint)
2496 (list (progn (back-to-indentation) (point)) 'ada-stmt-end-indent)))))
2508 (ada-search-ignore-string-comment
2511 (ada-search-ignore-string-comment "for" t nil nil
2514 'ada-indent-record-rel-type)))
2523 (if (ada-goto-matching-decl-start t)
2525 (ada-indent-on-previous-lines nil orgpoint orgpoint))))
2534 (if (and ada-indent-is-separate
2537 (ada-goto-next-non-ws (save-excursion (end-of-line)
2541 (ada-goto-stmt-start)
2542 (list (progn (back-to-indentation) (point)) 'ada-indent))
2544 (ada-goto-stmt-start)
2547 (list (progn (back-to-indentation) (point)) 'ada-indent)))))
2557 (let ((var 'ada-indent-return))
2562 (set 'pos (ada-search-ignore-string-comment ";\\|return\\>" t)))
2566 (set 'var 'ada-indent-renames)))
2586 ;; The indentation depends of the value of ada-indent-return
2601 (ada-indent-on-previous-lines nil orgpoint orgpoint)))))))
2611 (or (ada-looking-at-semi-or)
2612 (ada-looking-at-semi-private)))
2614 ;; ??? Wasn't this done already in ada-looking-at-semi-or ?
2615 (ada-goto-matching-start 1)
2625 (ada-goto-stmt-start)
2626 (list (progn (back-to-indentation) (point)) 'ada-stmt-end-indent)))
2633 (if ada-indent-comment-as-code
2640 (if (and ada-indent-align-comments
2649 (unless (ada-in-string-p)
2655 (ada-indent-on-previous-lines nil orgpoint orgpoint)))
2665 (equal ada-which-compiler 'gnat)
2684 (ada-indent-on-previous-lines nil orgpoint orgpoint))
2697 (ada-search-ignore-string-comment
2707 (ada-indent-on-previous-lines nil orgpoint orgpoint))))
2714 (if (ada-in-decl-p)
2715 (ada-indent-on-previous-lines nil orgpoint orgpoint)
2716 (append (ada-indent-on-previous-lines nil orgpoint orgpoint)
2717 '(ada-label-indent))))
2724 (or result (ada-indent-on-previous-lines nil orgpoint orgpoint))))
2726 (defun ada-indent-on-previous-lines (&optional nomove orgpoint initial-pos)
2736 (if (ada-in-paramlist-p)
2737 (ada-get-indent-paramlist)
2741 (ada-goto-stmt-start))
2746 (ada-get-indent-nochange)
2751 ada-indent-to-open-paren
2752 (ada-in-open-paren-p))
2753 (ada-get-indent-open-paren))
2756 (ada-get-indent-end orgpoint))
2758 ((looking-at ada-loop-start-re)
2759 (ada-get-indent-loop orgpoint))
2761 ((looking-at ada-subprog-start-re)
2762 (ada-get-indent-subprog orgpoint))
2764 ((looking-at ada-block-start-re)
2765 (ada-get-indent-block-start orgpoint))
2768 (ada-get-indent-type orgpoint))
2774 (ada-get-indent-if orgpoint))
2777 (ada-get-indent-case orgpoint))
2780 (ada-get-indent-when orgpoint))
2783 (ada-get-indent-label orgpoint))
2786 (ada-get-indent-nochange))
2791 (- ada-label-indent))))
2800 'ada-with-indent
2801 'ada-use-indent))))
2804 (ada-get-indent-noindent orgpoint)))))
2807 (defun ada-get-indent-open-paren ()
2809 (list (ada-in-open-paren-p) 0))
2811 (defun ada-get-indent-nochange ()
2818 (defun ada-get-indent-paramlist ()
2821 (ada-search-ignore-string-comment "[^ \t\n]" t nil t)
2830 (goto-char (cdr (ada-search-ignore-string-comment "(\\|;" t nil t)))
2831 (ada-goto-next-non-ws)
2838 (list (point) 'ada-broken-indent))
2842 (goto-char (cdr (ada-search-ignore-string-comment "(\\|;" t nil t)))
2843 (ada-goto-next-non-ws)
2846 (defun ada-get-indent-end (orgpoint)
2854 (ada-search-ignore-string-comment ";" nil orgpoint nil
2860 (ada-goto-next-non-ws)
2863 (save-excursion (ada-check-matching-start (match-string 0)))
2871 (ada-check-matching-start (match-string 0))
2874 (ada-goto-stmt-start)
2877 (ada-search-ignore-string-comment "\\<type\\>" t))
2882 ((looking-at ada-ident-re)
2885 (ada-goto-matching-start 0)
2886 (ada-check-defun-name defun-name))
2893 (ada-goto-matching-start 0)
2897 (if (ada-goto-matching-decl-start t)
2907 'ada-broken-indent))))
2910 'ada-broken-indent))))
2912 (defun ada-get-indent-case (orgpoint)
2924 (ada-search-ignore-string-comment
2926 (ada-search-ignore-string-comment
2930 (unless (ada-search-ignore-string-comment "when" t opos)
2932 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)))
2937 (setq match-cons (ada-search-ignore-string-comment
2940 (list (save-excursion (back-to-indentation) (point)) 'ada-broken-indent))
2945 (setq match-cons (ada-search-ignore-string-comment
2947 (list (save-excursion (back-to-indentation) (point)) 'ada-when-indent))
2953 'ada-broken-indent)))))
2955 (defun ada-get-indent-when (orgpoint)
2959 (if (ada-search-ignore-string-comment "[ \t\n]*=>" nil orgpoint)
2960 (list cur-indent 'ada-indent)
2961 (list cur-indent 'ada-broken-indent))))
2963 (defun ada-get-indent-if (orgpoint)
2971 (while (and (setq match-cons (ada-search-ignore-string-comment
2989 (list cur-indent 'ada-indent))
2991 (list cur-indent 'ada-broken-indent))))
2993 (defun ada-get-indent-block-start (orgpoint)
3000 (setq pos (ada-goto-next-non-ws orgpoint)))
3003 (ada-indent-on-previous-lines t orgpoint)))
3015 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)
3019 (car (ada-search-ignore-string-comment "\\<type\\>" t)))
3020 'ada-indent)))
3024 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)))))
3026 (defun ada-get-indent-subprog (orgpoint)
3037 (ada-search-ignore-string-comment
3049 (unless (ada-goto-next-non-ws orgpoint)
3059 (not (ada-search-ignore-string-comment
3061 (list cur-indent 'ada-indent))
3069 (ada-search-ignore-string-comment
3073 (ada-search-ignore-string-comment ada-subprog-start-re t)
3074 (ada-get-indent-noindent orgpoint))
3080 (save-excursion (setq match-cons (ada-goto-next-non-ws orgpoint)))
3082 (ada-indent-on-previous-lines t orgpoint)))
3087 (ada-search-ignore-string-comment ";" nil orgpoint nil 'search-forward))
3093 (list cur-indent 'ada-broken-indent)))))
3095 (defun ada-get-indent-noindent (orgpoint)
3107 ((ada-in-paramlist-p)
3108 (ada-previous-procedure)
3115 'ada-broken-decl-indent))
3120 (if (looking-at ada-named-block-re)
3121 (setq label (- ada-label-indent))
3127 (and (ada-search-ignore-string-comment "\\<private\\>" nil orgpoint)
3130 (ada-goto-previous-word)
3133 (and (ada-search-ignore-string-comment "\\<record\\>" nil orgpoint)
3136 (ada-goto-previous-word)
3143 (ada-search-ignore-string-comment ";" nil orgpoint nil
3147 'ada-broken-indent)))))))
3149 (defun ada-get-indent-label (orgpoint)
3154 (ada-search-ignore-string-comment ":" nil)
3158 (setq match-cons (ada-search-ignore-string-comment
3159 ada-loop-start-re nil orgpoint)))
3161 (ada-get-indent-loop orgpoint))
3165 (setq match-cons (ada-search-ignore-string-comment
3168 (list (save-excursion (back-to-indentation) (point)) 'ada-indent))
3171 ((ada-in-decl-p)
3173 (ada-search-ignore-string-comment ";" nil orgpoint))
3175 (list cur-indent 'ada-broken-indent)))
3179 (list cur-indent '(- ada-label-indent))))))
3181 (defun ada-get-indent-loop (orgpoint)
3190 (if (looking-at ada-named-block-re)
3191 (- ada-label-indent)
3200 (ada-search-ignore-string-comment ";" nil orgpoint nil
3207 (setq pos (ada-get-indent-block-start orgpoint))
3223 (ada-goto-next-non-ws orgpoint)
3226 (ada-goto-next-non-ws orgpoint)
3232 (setq match-cons (ada-search-ignore-string-comment
3238 (list (save-excursion (back-to-indentation) (point)) 'ada-indent))
3239 (list (save-excursion (back-to-indentation) (point)) 'ada-broken-indent))
3246 (setq match-cons (ada-search-ignore-string-comment
3258 'ada-indent))
3264 'ada-broken-indent))))
3274 (setq match-cons (ada-search-ignore-string-comment
3288 'ada-indent))
3291 'ada-broken-indent))))))
3293 (defun ada-get-indent-type (orgpoint)
3303 (setq match-dat (ada-search-ignore-string-comment
3305 (ada-goto-next-non-ws)
3308 (ada-goto-next-non-ws)
3316 (setq match-dat (ada-search-ignore-string-comment
3319 (list (save-excursion (back-to-indentation) (point)) 'ada-indent))
3324 (ada-search-ignore-string-comment ";" nil orgpoint nil
3332 (ada-search-ignore-string-comment "is" nil orgpoint nil
3334 (not (ada-goto-next-non-ws orgpoint))))
3335 (list (save-excursion (back-to-indentation) (point)) 'ada-broken-indent))
3341 'ada-broken-indent)))))
3349 (defun ada-goto-stmt-start ()
3357 (setq match-dat (ada-search-prev-end-stmt))
3367 (ada-goto-next-non-ws orgpoint))
3372 (setq match-dat (ada-search-prev-end-stmt)))
3378 (ada-goto-next-non-ws)
3390 (unless (ada-goto-next-non-ws orgpoint)
3395 (defun ada-search-prev-end-stmt ()
3406 (setq match-dat (ada-search-ignore-string-comment
3407 ada-end-stmt-re t)))
3410 (unless (ada-in-open-paren-p)
3416 (ada-goto-previous-word)
3422 (and (save-excursion (ada-goto-previous-word)
3423 (ada-goto-previous-word)
3427 (ada-goto-next-non-ws)
3451 (defun ada-goto-next-non-ws (&optional limit)
3461 (ada-in-string-p)))
3469 (defun ada-goto-stmt-end (&optional limit)
3473 (if (ada-search-ignore-string-comment ada-end-stmt-re nil limit)
3478 (defun ada-goto-next-word (&optional backward)
3490 (ada-search-ignore-string-comment "\\w" t nil t)
3491 (ada-search-ignore-string-comment "\\w" nil nil t)))
3508 (defun ada-check-matching-start (keyword)
3511 (ada-goto-matching-start 0)
3516 (defun ada-check-defun-name (defun-name)
3518 Assumes point to be already positioned by `ada-goto-matching-start'.
3523 (ada-goto-previous-word)
3529 (unless (looking-at ada-subprog-start-re)
3530 (ada-goto-matching-decl-start))
3561 (defun ada-goto-matching-decl-start (&optional noerror recursive)
3584 (ada-search-ignore-string-comment
3592 (ada-search-ignore-string-comment ada-matching-decl-start-re t))
3599 (ada-goto-matching-start 1 noerror)
3619 (ada-search-ignore-string-comment
3624 (ada-goto-matching-start 1 noerror t)
3625 ;; (ada-goto-matching-decl-start noerror t)
3670 (ada-goto-previous-word)
3674 (ada-goto-previous-word)
3685 (ada-goto-previous-word)
3715 (ada-search-ignore-string-comment ada-subprog-start-re t)
3722 (defun ada-goto-matching-start (&optional nest-level noerror gotothen)
3742 (ada-search-ignore-string-comment ada-matching-start-re t))
3762 (ada-goto-previous-word)
3788 (pos (ada-search-ignore-string-comment
3799 (ada-goto-next-non-ws)
3815 (ada-goto-next-non-ws)
3821 (ada-goto-next-non-ws);; skip type name
3829 (ada-search-ignore-string-comment ")" nil))
3830 (let ((tmp (ada-search-ignore-string-comment
3861 (let ((pos (ada-search-ignore-string-comment
3874 (let ((pos (ada-search-ignore-string-comment
3909 (ada-search-ignore-string-comment "then" nil nil nil
3919 (unless (ada-search-ignore-string-comment
3930 (defun ada-goto-matching-end (&optional nest-level noerror)
3961 (ada-search-ignore-string-comment regex nil))
3988 (ada-search-ignore-string-comment "is\\|;")
3991 (ada-goto-next-non-ws)
3995 (ada-goto-matching-end 0 t)))))))
4004 (ada-goto-next-non-ws)
4011 (ada-search-ignore-string-comment "is" nil nil nil
4013 (ada-goto-next-non-ws)
4037 (defun ada-search-ignore-string-comment
4061 (set-syntax-table ada-mode-symbol-syntax-table)
4078 ((ada-in-string-p parse-result)
4087 ((ada-in-comment-p parse-result)
4111 ((and (not paramlists) (ada-in-paramlist-p))
4131 (defun ada-in-decl-p ()
4134 (or (ada-in-paramlist-p)
4136 (ada-goto-matching-decl-start t))))
4139 (defun ada-looking-at-semi-or ()
4145 (ada-goto-stmt-start)
4149 (defun ada-looking-at-semi-private ()
4171 (defun ada-in-paramlist-p ()
4175 (ada-search-ignore-string-comment "(\\|)" t nil t)
4199 (not (ada-in-string-or-comment-p))
4212 (defun ada-search-ignore-complex-boolean (regexp backwardp)
4216 (while (and (setq result (ada-search-ignore-string-comment regexp backwardp))
4221 (defun ada-in-open-paren-p ()
4228 (or (car (ada-search-ignore-complex-boolean
4244 (if (or (not ada-indent-handle-comment-special)
4256 (defun ada-tab ()
4257 "Do indenting or tabbing according to `ada-tab-policy'.
4261 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-tab-hard))
4262 ((eq ada-tab-policy 'indent-auto)
4263 (if (ada-region-selected)
4264 (ada-indent-region (region-beginning) (region-end))
4265 (ada-indent-current)))
4266 ((eq ada-tab-policy 'always-tab) (error "Not implemented"))
4269 (defun ada-untab (arg)
4270 "Delete leading indenting according to `ada-tab-policy'."
4273 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-untab-hard))
4274 ((eq ada-tab-policy 'indent-auto) (error "Not implemented"))
4275 ((eq ada-tab-policy 'always-tab) (error "Not implemented"))
4278 (defun ada-indent-current-function ()
4283 (ada-tab)
4289 (defun ada-tab-hard ()
4294 (insert-char ? ada-indent))
4296 (forward-char ada-indent)))
4298 (defun ada-untab-hard ()
4303 (indent-rigidly bol eol (- 0 ada-indent))))
4314 (defun ada-remove-trailing-spaces ()
4325 (defun ada-gnat-style ()
4340 (if (not (ada-in-string-or-comment-p))
4345 (if (not (ada-in-string-or-comment-p))
4349 (if (not (ada-in-string-or-comment-p))
4353 (if (not (ada-in-string-or-comment-p))
4357 (if (not (ada-in-string-or-comment-p))
4367 (ada-in-string-or-comment-p)))
4377 (ada-in-string-or-comment-p))
4402 (defun ada-move-to-start ()
4409 (set-syntax-table ada-mode-symbol-syntax-table)
4417 (ada-in-string-or-comment-p)
4425 (ada-goto-matching-start 1)
4431 ada-move-to-declaration
4433 (ada-goto-matching-decl-start)
4444 (defun ada-move-to-end ()
4453 (set-syntax-table ada-mode-symbol-syntax-table)
4463 (ada-goto-matching-end 1)
4473 (ada-search-ignore-string-comment "is\\|;")
4477 (ada-goto-matching-end 0 t))
4481 (and (ada-goto-stmt-start)
4484 (ada-goto-next-non-ws)
4486 (ada-search-ignore-string-comment "begin" nil nil nil
4490 (and (ada-goto-stmt-start)
4492 (ada-goto-matching-end 0))
4495 (setq decl-start (and (ada-goto-matching-decl-start t) (point)))
4497 (ada-goto-matching-end 1))
4503 (ada-goto-matching-end 0 t))
4508 (ada-goto-matching-end 0 t))
4512 (ada-goto-matching-end 1)))
4522 (defun ada-next-procedure ()
4526 (if (re-search-forward ada-procedure-start-regexp nil t)
4530 (defun ada-previous-procedure ()
4534 (if (re-search-backward ada-procedure-start-regexp nil t)
4538 (defun ada-next-package ()
4542 (if (re-search-forward ada-package-start-regexp nil t)
4546 (defun ada-previous-package ()
4550 (if (re-search-backward ada-package-start-regexp nil t)
4560 (defun ada-create-keymap ()
4564 (define-key ada-mode-map "\C-j" 'ada-indent-newline-indent-conditional)
4565 (define-key ada-mode-map "\C-m" 'ada-indent-newline-indent-conditional)
4566 (define-key ada-mode-map "\t" 'ada-tab)
4567 (define-key ada-mode-map "\C-c\t" 'ada-justified-indent-current)
4568 (define-key ada-mode-map "\C-c\C-l" 'ada-indent-region)
4570 (define-key ada-mode-map '(shift tab) 'ada-untab)
4571 (define-key ada-mode-map [(shift tab)] 'ada-untab))
4572 (define-key ada-mode-map "\C-c\C-f" 'ada-format-paramlist)
4576 (define-key ada-mode-map "\M-\C-e" 'ada-next-procedure)
4577 (define-key ada-mode-map "\M-\C-a" 'ada-previous-procedure)
4578 (define-key ada-mode-map "\C-c\C-a" 'ada-move-to-start)
4579 (define-key ada-mode-map "\C-c\C-e" 'ada-move-to-end)
4582 (unless (lookup-key ada-mode-map "\C-c\C-c")
4583 (define-key ada-mode-map "\C-c\C-c" 'compile))
4586 (define-key ada-mode-map "\C-c\C-b" 'ada-adjust-case-buffer)
4587 (define-key ada-mode-map "\C-c\C-t" 'ada-case-read-exceptions)
4588 (define-key ada-mode-map "\C-c\C-y" 'ada-create-case-exception)
4589 (define-key ada-mode-map "\C-c\C-\M-y" 'ada-create-case-exception-substring)
4595 (define-key ada-mode-map [backspace] 'backward-delete-char-untabify)
4596 (define-key ada-mode-map "\177" 'backward-delete-char-untabify))
4599 (define-key ada-mode-map "\C-c\C-n" 'ada-make-subprogram-body)
4602 (define-key ada-mode-map "\C-c;" 'comment-region)
4603 (define-key ada-mode-map "\C-c:" 'ada-uncomment-region)
4605 ;; The following keys are bound to functions defined in ada-xref.el or
4606 ;; ada-prj,el., However, RMS rightly thinks that the code should be shared,
4610 (define-key ada-mode-map '(shift button3) 'ada-point-and-xref)
4611 (define-key ada-mode-map '(control tab) 'ada-complete-identifier))
4612 (define-key ada-mode-map [C-tab] 'ada-complete-identifier)
4613 (define-key ada-mode-map [S-mouse-3] 'ada-point-and-xref))
4615 (define-key ada-mode-map "\C-co" 'ff-find-other-file)
4616 (define-key ada-mode-map "\C-c5\C-d" 'ada-goto-declaration-other-frame)
4617 (define-key ada-mode-map "\C-c\C-d" 'ada-goto-declaration)
4618 (define-key ada-mode-map "\C-c\C-s" 'ada-xref-goto-previous-reference)
4619 (define-key ada-mode-map "\C-c\C-c" 'ada-compile-application)
4620 (define-key ada-mode-map "\C-cc" 'ada-change-prj)
4621 (define-key ada-mode-map "\C-cd" 'ada-set-default-project-file)
4622 (define-key ada-mode-map "\C-cg" 'ada-gdb-application)
4623 (define-key ada-mode-map "\C-c\C-m" 'ada-set-main-compile-application)
4624 (define-key ada-mode-map "\C-cr" 'ada-run-application)
4625 (define-key ada-mode-map "\C-c\C-o" 'ada-goto-parent)
4626 (define-key ada-mode-map "\C-c\C-r" 'ada-find-references)
4627 (define-key ada-mode-map "\C-cl" 'ada-find-local-references)
4628 (define-key ada-mode-map "\C-c\C-v" 'ada-check-current)
4629 (define-key ada-mode-map "\C-cf" 'ada-find-file)
4631 (define-key ada-mode-map "\C-cu" 'ada-prj-edit)
4633 ;; The templates, defined in ada-stmt.el
4636 (define-key map "h" 'ada-header)
4637 (define-key map "\C-a" 'ada-array)
4638 (define-key map "b" 'ada-exception-block)
4639 (define-key map "d" 'ada-declare-block)
4640 (define-key map "c" 'ada-case)
4641 (define-key map "\C-e" 'ada-elsif)
4642 (define-key map "e" 'ada-else)
4643 (define-key map "\C-k" 'ada-package-spec)
4644 (define-key map "k" 'ada-package-body)
4645 (define-key map "\C-p" 'ada-procedure-spec)
4646 (define-key map "p" 'ada-subprogram-body)
4647 (define-key map "\C-f" 'ada-function-spec)
4648 (define-key map "f" 'ada-for-loop)
4649 (define-key map "i" 'ada-if)
4650 (define-key map "l" 'ada-loop)
4651 (define-key map "\C-r" 'ada-record)
4652 (define-key map "\C-s" 'ada-subtype)
4653 (define-key map "S" 'ada-tabsize)
4654 (define-key map "\C-t" 'ada-task-spec)
4655 (define-key map "t" 'ada-task-body)
4656 (define-key map "\C-y" 'ada-type)
4657 (define-key map "\C-v" 'ada-private)
4658 (define-key map "u" 'ada-use)
4659 (define-key map "\C-u" 'ada-with)
4660 (define-key map "\C-w" 'ada-when)
4661 (define-key map "w" 'ada-while-loop)
4662 (define-key map "\C-x" 'ada-exception)
4663 (define-key map "x" 'ada-exit)
4664 (define-key ada-mode-map "\C-ct" map))
4668 (defun ada-create-menu ()
4672 ["Ada Mode" (info "ada-mode") t]
4674 (eq ada-which-compiler 'gnat)]
4676 (eq ada-which-compiler 'gnat)]
4678 (eq ada-which-compiler 'gnat)]
4680 (eq ada-which-compiler 'gnat)]
4682 ("Options" :included (eq major-mode 'ada-mode)
4683 ["Auto Casing" (setq ada-auto-case (not ada-auto-case))
4684 :style toggle :selected ada-auto-case]
4686 (setq ada-indent-after-return (not ada-indent-after-return))
4687 :style toggle :selected ada-indent-after-return]
4689 (setq ada-xref-create-ali (not ada-xref-create-ali))
4690 :style toggle :selected ada-xref-create-ali
4691 :included (eq ada-which-compiler 'gnat)]
4693 (setq ada-xref-confirm-compile (not ada-xref-confirm-compile))
4694 :style toggle :selected ada-xref-confirm-compile
4695 :included (eq ada-which-compiler 'gnat)]
4697 (setq ada-xref-other-buffer (not ada-xref-other-buffer))
4698 :style toggle :selected ada-xref-other-buffer
4699 :included (eq ada-which-compiler 'gnat)]
4701 (setq ada-tight-gvd-integration (not ada-tight-gvd-integration))
4702 :style toggle :selected ada-tight-gvd-integration
4703 :included (string-match "gvd" ada-prj-default-debugger)])
4704 ["Customize" (customize-group 'ada)
4706 ["Check file" ada-check-current t]
4707 ["Compile file" ada-compile-current t]
4708 ["Set main and Build" ada-set-main-compile-application t]
4709 ["Show main" ada-show-current-main t]
4710 ["Build" ada-compile-application t]
4711 ["Run" ada-run-application t]
4712 ["Debug" ada-gdb-application (eq ada-which-compiler 'gnat)]
4715 ["Show project" ada-show-current-project t]
4716 ["Load..." ada-set-default-project-file t]
4717 ["New..." ada-prj-new t]
4718 ["Edit..." ada-prj-edit t])
4719 ("Goto" :included (eq major-mode 'ada-mode)
4720 ["Goto Declaration/Body" ada-goto-declaration
4721 (eq ada-which-compiler 'gnat)]
4722 ["Goto Body" ada-goto-body
4723 (eq ada-which-compiler 'gnat)]
4725 ada-goto-declaration-other-frame
4726 (eq ada-which-compiler 'gnat)]
4727 ["Goto Previous Reference" ada-xref-goto-previous-reference
4728 (eq ada-which-compiler 'gnat)]
4729 ["List Local References" ada-find-local-references
4730 (eq ada-which-compiler 'gnat)]
4731 ["List References" ada-find-references
4732 (eq ada-which-compiler 'gnat)]
4733 ["Goto Reference To Any Entity" ada-find-any-references
4734 (eq ada-which-compiler 'gnat)]
4735 ["Goto Parent Unit" ada-goto-parent
4736 (eq ada-which-compiler 'gnat)]
4739 ["Previous Package" ada-previous-package t]
4740 ["Next Package" ada-next-package t]
4741 ["Previous Procedure" ada-previous-procedure t]
4742 ["Next Procedure" ada-next-procedure t]
4743 ["Goto Start Of Statement" ada-move-to-start t]
4744 ["Goto End Of Statement" ada-move-to-end t]
4747 ["Other File Other Window" ada-ff-other-window t])
4748 ("Edit" :included (eq major-mode 'ada-mode)
4749 ["Search File On Source Path" ada-find-file t]
4751 ["Complete Identifier" ada-complete-identifier t]
4753 ["Indent Line" ada-indent-current-function t]
4754 ["Justify Current Indentation" ada-justified-indent-current t]
4755 ["Indent Lines in Selection" ada-indent-region t]
4757 (ada-indent-region (point-min) (point-max)) t]
4758 ["Format Parameter List" ada-format-paramlist t]
4761 ["Uncomment Selection" ada-uncomment-region t]
4765 ada-fill-comment-paragraph-justify t]
4767 ada-fill-comment-paragraph-postfix t]
4769 ["Adjust Case Selection" ada-adjust-case-region t]
4770 ["Adjust Case in File" ada-adjust-case-buffer t]
4771 ["Create Case Exception" ada-create-case-exception t]
4773 ada-create-case-exception-substring t]
4774 ["Reload Case Exceptions" ada-case-read-exceptions t]
4776 ["Make body for subprogram" ada-make-subprogram-body t]
4778 ["Narrow to subprogram" ada-narrow-to-defun t])
4780 :included (eq major-mode 'ada-mode)
4781 ["Header" ada-header t]
4783 ["Package Body" ada-package-body t]
4784 ["Package Spec" ada-package-spec t]
4785 ["Function Spec" ada-function-spec t]
4786 ["Procedure Spec" ada-procedure-spec t]
4787 ["Proc/func Body" ada-subprogram-body t]
4788 ["Task Body" ada-task-body t]
4789 ["Task Spec" ada-task-spec t]
4790 ["Declare Block" ada-declare-block t]
4791 ["Exception Block" ada-exception-block t]
4793 ["Entry" ada-entry t]
4794 ["Entry family" ada-entry-family t]
4795 ["Select" ada-select t]
4796 ["Accept" ada-accept t]
4797 ["Or accept" ada-or-accep t]
4798 ["Or delay" ada-or-delay t]
4799 ["Or terminate" ada-or-terminate t]
4801 ["Type" ada-type t]
4802 ["Private" ada-private t]
4803 ["Subtype" ada-subtype t]
4804 ["Record" ada-record t]
4805 ["Array" ada-array t]
4807 ["If" ada-if t]
4808 ["Else" ada-else t]
4809 ["Elsif" ada-elsif t]
4810 ["Case" ada-case t]
4812 ["While Loop" ada-while-loop t]
4813 ["For Loop" ada-for-loop t]
4814 ["Loop" ada-loop t]
4816 ["Exception" ada-exception t]
4817 ["Exit" ada-exit t]
4818 ["When" ada-when t])
4821 (easy-menu-define ada-mode-menu ada-mode-map "Menu keymap for Ada mode" m)
4824 (define-key ada-mode-map [menu-bar] ada-mode-menu)
4825 (set 'mode-popup-menu (cons "Ada mode" ada-mode-menu))))))
4840 (defadvice comment-region (before ada-uncomment-anywhere disable)
4852 (defun ada-uncomment-region (beg end &optional arg)
4865 (ada-indent-region beg end)))
4867 (defun ada-fill-comment-paragraph-justify ()
4870 (ada-fill-comment-paragraph 'full))
4872 (defun ada-fill-comment-paragraph-postfix ()
4874 Adds `ada-fill-comment-postfix' at the end of each line."
4876 (ada-fill-comment-paragraph 'full t))
4878 (defun ada-fill-comment-paragraph (&optional justify postfix)
4881 If POSTFIX and JUSTIFY are non-nil, `ada-fill-comment-postfix' is appended
4887 (if (and (not (ada-in-comment-p))
4943 (setq fill-prefix ada-fill-comment-prefix)
4946 (setq fill-column (- fill-column (length ada-fill-comment-postfix))))
4958 (insert ada-fill-comment-postfix)
4985 ;; are also overriden in `ada-xref'.el when we know that the user is using
4990 (defun ada-make-filename-from-adaname (adaname)
4999 (defun ada-other-file-name ()
5006 (suffixes ada-spec-suffixes)
5021 (setq suffixes ada-body-suffixes)
5035 (setq suffixes ada-body-suffixes)
5036 (setq suffixes ada-spec-suffixes))
5044 (if (fboundp 'ada-find-src-file-in-dir)
5046 (ada-find-src-file-in-dir
5058 (defun ada-which-function-are-we-in ()
5064 (or (if (re-search-backward ada-procedure-start-regexp nil t)
5066 (if (re-search-backward ada-package-start-regexp nil t)
5071 (defvar ada-last-which-function-line -1
5072 "Last line on which `ada-which-function' was called.")
5073 (defvar ada-last-which-function-subprog 0
5074 "Last subprogram name returned by `ada-which-function'.")
5075 (make-variable-buffer-local 'ada-last-which-function-subprog)
5076 (make-variable-buffer-local 'ada-last-which-function-line)
5079 (defun ada-which-function ()
5092 (if (= line ada-last-which-function-line)
5093 ada-last-which-function-subprog
5123 (re-search-backward ada-imenu-subprogram-menu-re nil t))
5128 (if (and (not (ada-in-comment-p))
5135 (if (ada-search-ignore-string-comment
5143 (setq ada-last-which-function-line line
5144 ada-last-which-function-subprog found)
5147 (defun ada-ff-other-window ()
5153 (defun ada-set-point-accordingly ()
5158 (unless (ada-search-ignore-string-comment
5162 (defun ada-get-body-name (&optional spec-name)
5174 (let ((suffixes ada-spec-suffixes)
5184 (ff-get-file-name ada-search-directories-internal
5185 (ada-make-filename-from-adaname
5188 ada-body-suffixes)
5190 (concat (ada-make-filename-from-adaname
5201 ;; single quote is given punctuation syntax in `ada-mode-syntax-table'.
5209 (defconst ada-font-lock-syntactic-keywords
5214 ;; This sets the properties of the characters, so that ada-in-string-p
5220 (defvar ada-font-lock-keywords
5311 (defun ada-outline-level ()
5323 (defun ada-narrow-to-defun (&optional arg)
5334 (ada-previous-procedure)
5340 (ada-move-to-end)
5356 (defun ada-gen-treat-proc (match)
5359 for `ada-procedure-start-regexp'."
5391 (ada-indent-newline-indent)
5393 (ada-indent-newline-indent)
5397 (ada-indent-newline-indent)))
5399 (ada-indent-newline-indent)
5403 (ada-indent-newline-indent)
5405 (ada-indent-newline-indent)
5423 (ada-move-to-end))
5426 (defun ada-make-body ()
5433 (ada-mode)
5435 (let (found ada-procedure-or-package-start-regexp)
5437 (ada-search-ignore-string-comment ada-package-start-regexp nil))
5443 (setq ada-procedure-or-package-start-regexp
5444 (concat ada-procedure-start-regexp
5446 ada-package-start-regexp))
5449 (ada-search-ignore-string-comment
5450 ada-procedure-or-package-start-regexp nil))
5453 (if (looking-at ada-package-start-regexp)
5456 (ada-gen-treat-proc found))))))
5459 (defun ada-make-subprogram-body ()
5462 (let* ((found (re-search-backward ada-procedure-start-regexp nil t))
5471 (ada-search-ignore-string-comment ")" nil)
5472 (ada-search-ignore-string-comment ";" nil)))
5476 (setq body-file (ada-get-body-name))
5491 (re-search-backward ada-procedure-start-regexp nil t)
5492 (ada-gen-treat-proc (cons (match-beginning 0) (match-end 0)))
5500 ;; Create the keymap once and for all. If we do that in ada-mode,
5503 (ada-create-keymap)
5504 (ada-create-menu)
5507 (ada-create-syntax-table)
5510 (ada-add-extensions ".ads" ".adb")
5512 (if (equal ada-which-compiler 'gnat)
5513 (ada-add-extensions ".ads.dg" ".adb.dg"))
5516 (ada-case-read-exceptions)
5519 (autoload 'ada-change-prj "ada-xref" nil t)
5520 (autoload 'ada-check-current "ada-xref" nil t)
5521 (autoload 'ada-compile-application "ada-xref" nil t)
5522 (autoload 'ada-compile-current "ada-xref" nil t)
5523 (autoload 'ada-complete-identifier "ada-xref" nil t)
5524 (autoload 'ada-find-file "ada-xref" nil t)
5525 (autoload 'ada-find-any-references "ada-xref" nil t)
5526 (autoload 'ada-find-src-file-in-dir "ada-xref" nil t)
5527 (autoload 'ada-find-local-references "ada-xref" nil t)
5528 (autoload 'ada-find-references "ada-xref" nil t)
5529 (autoload 'ada-gdb-application "ada-xref" nil t)
5530 (autoload 'ada-goto-declaration "ada-xref" nil t)
5531 (autoload 'ada-goto-declaration-other-frame "ada-xref" nil t)
5532 (autoload 'ada-goto-parent "ada-xref" nil t)
5533 (autoload 'ada-make-body-gnatstub "ada-xref" nil t)
5534 (autoload 'ada-point-and-xref "ada-xref" nil t)
5535 (autoload 'ada-reread-prj-file "ada-xref" nil t)
5536 (autoload 'ada-run-application "ada-xref" nil t)
5537 (autoload 'ada-set-default-project-file "ada-xref" nil nil)
5538 (autoload 'ada-set-default-project-file "ada-xref" nil t)
5539 (autoload 'ada-xref-goto-previous-reference "ada-xref" nil t)
5540 (autoload 'ada-set-main-compile-application "ada-xref" nil t)
5541 (autoload 'ada-show-current-main "ada-xref" nil t)
5543 (autoload 'ada-customize "ada-prj" nil t)
5544 (autoload 'ada-prj-edit "ada-prj" nil t)
5545 (autoload 'ada-prj-new "ada-prj" nil t)
5546 (autoload 'ada-prj-save "ada-prj" nil t)
5548 (autoload 'ada-array "ada-stmt" nil t)
5549 (autoload 'ada-case "ada-stmt" nil t)
5550 (autoload 'ada-declare-block "ada-stmt" nil t)
5551 (autoload 'ada-else "ada-stmt" nil t)
5552 (autoload 'ada-elsif "ada-stmt" nil t)
5553 (autoload 'ada-exception "ada-stmt" nil t)
5554 (autoload 'ada-exception-block "ada-stmt" nil t)
5555 (autoload 'ada-exit "ada-stmt" nil t)
5556 (autoload 'ada-for-loop "ada-stmt" nil t)
5557 (autoload 'ada-function-spec "ada-stmt" nil t)
5558 (autoload 'ada-header "ada-stmt" nil t)
5559 (autoload 'ada-if "ada-stmt" nil t)
5560 (autoload 'ada-loop "ada-stmt" nil t)
5561 (autoload 'ada-package-body "ada-stmt" nil t)
5562 (autoload 'ada-package-spec "ada-stmt" nil t)
5563 (autoload 'ada-private "ada-stmt" nil t)
5564 (autoload 'ada-procedure-spec "ada-stmt" nil t)
5565 (autoload 'ada-record "ada-stmt" nil t)
5566 (autoload 'ada-subprogram-body "ada-stmt" nil t)
5567 (autoload 'ada-subtype "ada-stmt" nil t)
5568 (autoload 'ada-tabsize "ada-stmt" nil t)
5569 (autoload 'ada-task-body "ada-stmt" nil t)
5570 (autoload 'ada-task-spec "ada-stmt" nil t)
5571 (autoload 'ada-type "ada-stmt" nil t)
5572 (autoload 'ada-use "ada-stmt" nil t)
5573 (autoload 'ada-when "ada-stmt" nil t)
5574 (autoload 'ada-while-loop "ada-stmt" nil t)
5575 (autoload 'ada-with "ada-stmt" nil t)
5578 (provide 'ada-mode)
5581 ;;; ada-mode.el ends here