Mercurial > emacs
annotate lisp/progmodes/ada-mode.el @ 48044:57c1e1c09fde
*** empty log message ***
author | Dave Love <fx@gnu.org> |
---|---|
date | Mon, 28 Oct 2002 14:43:51 +0000 |
parents | a4c8d672ccbe |
children | 0d8b17d428b5 |
rev | line source |
---|---|
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38401
diff
changeset
|
1 ;;; ada-mode.el --- major-mode for editing Ada sources |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3 ;; Copyright (C) 1994, 95, 97, 98, 99, 2000, 2001, 2002 |
38401 | 4 ;; Free Software Foundation, Inc. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
6 ;; Author: Rolf Ebert <ebert@inf.enst.fr> |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
7 ;; Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de> |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
8 ;; Emmanuel Briot <briot@gnat.com> |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
9 ;; Maintainer: Emmanuel Briot <briot@gnat.com> |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
10 ;; Ada Core Technologies's version: Revision: 1.164.2.2 (GNAT 3.15) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
11 ;; Keywords: languages ada |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
12 |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38401
diff
changeset
|
13 ;; This file is part of GNU Emacs. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
14 |
38401 | 15 ;; GNU Emacs is free software; you can redistribute it and/or modify |
10705 | 16 ;; it under the terms of the GNU General Public License as published by |
17 ;; the Free Software Foundation; either version 2, or (at your option) | |
18 ;; any later version. | |
19 | |
38401 | 20 ;; GNU Emacs is distributed in the hope that it will be useful, |
10705 | 21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 ;; GNU General Public License for more details. | |
24 | |
25 ;; You should have received a copy of the GNU General Public License | |
38401 | 26 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
28 ;; Boston, MA 02111-1307, USA. | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
29 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
30 ;;; Commentary: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
31 ;;; This mode is a major mode for editing Ada83 and Ada95 source code. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
32 ;;; This is a major rewrite of the file packaged with Emacs-20. The |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
33 ;;; ada-mode is composed of four lisp file, ada-mode.el, ada-xref.el, |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
34 ;;; ada-prj.el and ada-stmt.el. Only this file (ada-mode.el) is |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
35 ;;; completely independent from the GNU Ada compiler Gnat, distributed |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
36 ;;; by Ada Core Technologies. All the other files rely heavily on |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
37 ;;; features provided only by Gnat. |
10705 | 38 ;;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
39 ;;; Note: this mode will not work with Emacs 19. If you are on a VMS |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
40 ;;; system, where the latest version of Emacs is 19.28, you will need |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
41 ;;; another file, called ada-vms.el, that provides some required |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
42 ;;; functions. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
43 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
44 ;;; Usage: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
45 ;;; Emacs should enter Ada mode automatically when you load an Ada file. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
46 ;;; By default, the valid extensions for Ada files are .ads, .adb or .ada |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
47 ;;; If the ada-mode does not start automatically, then simply type the |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
48 ;;; following command : |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
49 ;;; M-x ada-mode |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
50 ;;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
51 ;;; By default, ada-mode is configured to take full advantage of the GNAT |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
52 ;;; compiler (the menus will include the cross-referencing features,...). |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
53 ;;; If you are using another compiler, you might want to set the following |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
54 ;;; variable in your .emacs (Note: do not set this in the ada-mode-hook, it |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
55 ;;; won't work) : |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
56 ;;; (setq ada-which-compiler 'generic) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
57 ;;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
58 ;;; This mode requires find-file.el to be present on your system. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
59 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
60 ;;; History: |
11199 | 61 ;;; The first Ada mode for GNU Emacs was written by V. Broman in |
62 ;;; 1985. He based his work on the already existing Modula-2 mode. | |
63 ;;; This was distributed as ada.el in versions of Emacs prior to 19.29. | |
10705 | 64 ;;; |
65 ;;; Lynn Slater wrote an extensive Ada mode in 1989. It consisted of | |
66 ;;; several files with support for dired commands and other nice | |
67 ;;; things. It is currently available from the PAL | |
68 ;;; (wuarchive.wustl.edu:/languages/ada) as ada-mode-1.06a.tar.Z. | |
69 ;;; | |
70 ;;; The probably very first Ada mode (called electric-ada.el) was | |
71 ;;; written by Steven D. Litvintchouk and Steven M. Rosen for the | |
72 ;;; Gosling Emacs. L. Slater based his development on ada.el and | |
73 ;;; electric-ada.el. | |
74 ;;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
75 ;;; A complete rewrite by M. Heritsch and R. Ebert has been done. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
76 ;;; Some ideas from the Ada mode mailing list have been |
10705 | 77 ;;; added. Some of the functionality of L. Slater's mode has not |
78 ;;; (yet) been recoded in this new mode. Perhaps you prefer sticking | |
79 ;;; to his version. | |
80 ;;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
81 ;;; A complete rewrite for Emacs-20 / Gnat-3.11 has been done by Ada Core |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
82 ;;; Technologies. Please send bugs to briot@gnat.com |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
83 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
84 ;;; Credits: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
85 ;;; Many thanks to John McCabe <john@assen.demon.co.uk> for sending so |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
86 ;;; many patches included in this package. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
87 ;;; Christian Egli <Christian.Egli@hcsd.hac.com>: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
88 ;;; ada-imenu-generic-expression |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
89 ;;; Many thanks also to the following persons that have contributed one day |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
90 ;;; to the ada-mode |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
91 ;;; Philippe Waroquiers (PW) <philippe@cfmu.eurocontrol.be> in particular, |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
92 ;;; woodruff@stc.llnl.gov (John Woodruff) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
93 ;;; jj@ddci.dk (Jesper Joergensen) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
94 ;;; gse@ocsystems.com (Scott Evans) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
95 ;;; comar@gnat.com (Cyrille Comar) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
96 ;;; stephen.leake@gsfc.nasa.gov (Stephen Leake) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
97 ;;; robin-reply@reagans.org |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
98 ;;; and others for their valuable hints. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
99 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
100 ;;; Code: |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
101 ;;; Note: Every function in this package is compiler-independent. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
102 ;;; The names start with ada- |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
103 ;;; The variables that the user can edit can all be modified through |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
104 ;;; the customize mode. They are sorted in alphabetical order in this |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
105 ;;; file. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
106 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
107 ;;; Supported packages. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
108 ;;; This package supports a number of other Emacs modes. These other modes |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
109 ;;; should be loaded before the ada-mode, which will then setup some variables |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
110 ;;; to improve the support for Ada code. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
111 ;;; Here is the list of these modes: |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
112 ;;; `which-function-mode': Display the name of the subprogram the cursor is |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
113 ;;; in in the mode line. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
114 ;;; `outline-mode': Provides the capability to collapse or expand the code |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
115 ;;; for specific language constructs, for instance if you want to hide the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
116 ;;; code corresponding to a subprogram |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
117 ;;; `align': This mode is now provided with Emacs 21, but can also be |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
118 ;;; installed manually for older versions of Emacs. It provides the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
119 ;;; capability to automatically realign the selected region (for instance |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
120 ;;; all ':=', ':' and '--' will be aligned on top of each other. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
121 ;;; `imenu': Provides a menu with the list of entities defined in the current |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
122 ;;; buffer, and an easy way to jump to any of them |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
123 ;;; `speedbar': Provides a separate file browser, and the capability for each |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
124 ;;; file to see the list of entities defined in it and to jump to them |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
125 ;;; easily |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
126 ;;; `abbrev-mode': Provides the capability to define abbreviations, which |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
127 ;;; are automatically expanded when you type them. See the Emacs manual. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
128 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
129 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
130 ;; this function is needed at compile time |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
131 (eval-and-compile |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
132 (defun ada-check-emacs-version (major minor &optional is-xemacs) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
133 "Returns t if Emacs's version is greater or equal to MAJOR.MINOR. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
134 If IS-XEMACS is non-nil, check for XEmacs instead of Emacs." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
135 (let ((xemacs-running (or (string-match "Lucid" emacs-version) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
136 (string-match "XEmacs" emacs-version)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
137 (and (or (and is-xemacs xemacs-running) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
138 (not (or is-xemacs xemacs-running))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
139 (or (> emacs-major-version major) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
140 (and (= emacs-major-version major) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
141 (>= emacs-minor-version minor))))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
142 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
143 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
144 ;; We create a constant for that, for efficiency only |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
145 ;; This should be evaluated both at compile time, only a runtime |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
146 (eval-and-compile |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
147 (defconst ada-xemacs (and (boundp 'running-xemacs) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
148 (symbol-value 'running-xemacs)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
149 "Return t if we are using XEmacs.")) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
150 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
151 (unless ada-xemacs |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
152 (require 'outline)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
153 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
154 (eval-and-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
155 (condition-case nil (require 'find-file) (error nil))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
156 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
157 ;; This call should not be made in the release that is done for the |
44933 | 158 ;; official Emacs, since it does nothing useful for the latest version |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
159 ;; (if (not (ada-check-emacs-version 21 1)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
160 ;; (require 'ada-support)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
161 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
162 (defvar ada-mode-hook nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
163 "*List of functions to call when Ada mode is invoked. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
164 This hook is automatically executed after the ada-mode is |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
165 fully loaded. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
166 This is a good place to add Ada environment specific bindings.") |
18120 | 167 |
168 (defgroup ada nil | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
169 "Major mode for editing Ada source in Emacs." |
18120 | 170 :group 'languages) |
171 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
172 (defcustom ada-auto-case t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
173 "*Non-nil means automatically change case of preceding word while typing. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
174 Casing is done according to `ada-case-keyword', `ada-case-identifier' |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
175 and `ada-case-attribute'." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
176 :type 'boolean :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
177 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
178 (defcustom ada-broken-decl-indent 0 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
179 "*Number of columns to indent a broken declaration. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
180 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
181 An example is : |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
182 declare |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
183 A, |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
184 >>>>>B : Integer; -- from ada-broken-decl-indent" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
185 :type 'integer :group 'ada) |
18120 | 186 |
187 (defcustom ada-broken-indent 2 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
188 "*Number of columns to indent the continuation of a broken line. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
189 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
190 An example is : |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
191 My_Var : My_Type := (Field1 => |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
192 >>>>>>>>>Value); -- from ada-broken-indent" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
193 :type 'integer :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
194 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
195 (defcustom ada-continuation-indent ada-broken-indent |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
196 "*Number of columns to indent the continuation of broken lines in |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
197 parenthesis. |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
198 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
199 An example is : |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
200 Func (Param1, |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
201 >>>>>Param2);" |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
202 :type 'integer :group 'ada) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
203 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
204 (defcustom ada-case-attribute 'ada-capitalize-word |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
205 "*Function to call to adjust the case of Ada attributes. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
206 It may be `downcase-word', `upcase-word', `ada-loose-case-word', |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
207 `ada-capitalize-word' or `ada-no-auto-case'." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
208 :type '(choice (const downcase-word) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
209 (const upcase-word) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
210 (const ada-capitalize-word) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
211 (const ada-loose-case-word) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
212 (const ada-no-auto-case)) |
18120 | 213 :group 'ada) |
10705 | 214 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
215 (defcustom ada-case-exception-file |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
216 (list (convert-standard-filename' "~/.emacs_case_exceptions")) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
217 "*List of special casing exceptions dictionaries for identifiers. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
218 The first file is the one where new exceptions will be saved by Emacs |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
219 when you call `ada-create-case-exception'. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
220 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
221 These files should contain one word per line, that gives the casing |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
222 to be used for that word in Ada files. If the line starts with the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
223 character *, then the exception will be used for substrings that either |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
224 start at the beginning of a word or after a _ character, and end either |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
225 at the end of the word or at a _ character. Each line can be terminated by |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
226 a comment." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
227 :type '(repeat (file)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
228 :group 'ada) |
18120 | 229 |
230 (defcustom ada-case-keyword 'downcase-word | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
231 "*Function to call to adjust the case of an Ada keywords. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
232 It may be `downcase-word', `upcase-word', `ada-loose-case-word' or |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
233 `ada-capitalize-word'." |
18120 | 234 :type '(choice (const downcase-word) |
235 (const upcase-word) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
236 (const ada-capitalize-word) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
237 (const ada-loose-case-word) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
238 (const ada-no-auto-case)) |
18120 | 239 :group 'ada) |
240 | |
241 (defcustom ada-case-identifier 'ada-loose-case-word | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
242 "*Function to call to adjust the case of an Ada identifier. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
243 It may be `downcase-word', `upcase-word', `ada-loose-case-word' or |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
244 `ada-capitalize-word'." |
18120 | 245 :type '(choice (const downcase-word) |
246 (const upcase-word) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
247 (const ada-capitalize-word) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
248 (const ada-loose-case-word) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
249 (const ada-no-auto-case)) |
18120 | 250 :group 'ada) |
251 | |
252 (defcustom ada-clean-buffer-before-saving t | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
253 "*Non-nil means remove trailing spaces and untabify the buffer before saving." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
254 :type 'boolean :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
255 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
256 (defcustom ada-indent 3 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
257 "*Size of Ada indentation. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
258 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
259 An example is : |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
260 procedure Foo is |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
261 begin |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
262 >>>>>>>>>>null; -- from ada-indent" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
263 :type 'integer :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
264 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
265 (defcustom ada-indent-after-return t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
266 "*Non-nil means automatically indent after RET or LFD." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
267 :type 'boolean :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
268 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
269 (defcustom ada-indent-align-comments t |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
270 "*Non-nil means align comments on previous line comments, if any. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
271 If nil, indentation is calculated as usual. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
272 Note that indentation is calculated only if `ada-indent-comment-as-code' is t. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
273 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
274 For instance: |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
275 A := 1; -- A multi-line comment |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
276 -- aligned if ada-indent-align-comments is t" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
277 :type 'boolean :group 'ada) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
278 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
279 (defcustom ada-indent-comment-as-code t |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
280 "*Non-nil means indent comment lines as code. |
42206 | 281 nil means do not auto-indent comments." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
282 :type 'boolean :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
283 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
284 (defcustom ada-indent-handle-comment-special nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
285 "*Non-nil if comment lines should be handled specially inside |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
286 parenthesis. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
287 By default, if the line that contains the open parenthesis has some |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
288 text following it, then the following lines will be indented in the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
289 same column as this text. This will not be true if the first line is |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
290 a comment and `ada-indent-handle-comment-special' is t. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
291 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
292 type A is |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
293 ( Value_1, -- common behavior, when not a comment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
294 Value_2); |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
295 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
296 type A is |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
297 ( -- `ada-indent-handle-comment-special' is nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
298 Value_1, |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
299 Value_2); |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
300 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
301 type A is |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
302 ( -- `ada-indent-handle-comment-special' is non-nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
303 Value_1, |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
304 Value_2);" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
305 :type 'boolean :group 'ada) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
306 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
307 (defcustom ada-indent-is-separate t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
308 "*Non-nil means indent 'is separate' or 'is abstract' if on a single line." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
309 :type 'boolean :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
310 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
311 (defcustom ada-indent-record-rel-type 3 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
312 "*Indentation for 'record' relative to 'type' or 'use'. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
313 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
314 An example is: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
315 type A is |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
316 >>>>>>>>>>>record -- from ada-indent-record-rel-type" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
317 :type 'integer :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
318 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
319 (defcustom ada-indent-renames ada-broken-indent |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
320 "*Indentation for renames relative to the matching function statement. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
321 If ada-indent-return is null or negative, the indentation is done relative to |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
322 the open parenthesis (if there is no parenthesis, ada-broken-indent is used). |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
323 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
324 An example is: |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
325 function A (B : Integer) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
326 return C; -- from ada-indent-return |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
327 >>>renames Foo; -- from ada-indent-renames" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
328 :type 'integer :group 'ada) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
329 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
330 (defcustom ada-indent-return 0 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
331 "*Indentation for 'return' relative to the matching 'function' statement. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
332 If ada-indent-return is null or negative, the indentation is done relative to |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
333 the open parenthesis (if there is no parenthesis, ada-broken-indent is used). |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
334 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
335 An example is: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
336 function A (B : Integer) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
337 >>>>>return C; -- from ada-indent-return" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
338 :type 'integer :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
339 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
340 (defcustom ada-indent-to-open-paren t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
341 "*Non-nil means indent according to the innermost open parenthesis." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
342 :type 'boolean :group 'ada) |
18120 | 343 |
41012
39ee7e7e2200
(ada-fill-comment-prefix): GNAT wants 2 spaces.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38446
diff
changeset
|
344 (defcustom ada-fill-comment-prefix "-- " |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
345 "*Text inserted in the first columns when filling a comment paragraph. |
41036
aaa6f44a1b96
(ada-fill-comment-prefix): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41012
diff
changeset
|
346 Note: if you modify this variable, you will have to invoke `ada-mode' |
aaa6f44a1b96
(ada-fill-comment-prefix): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41012
diff
changeset
|
347 again to take account of the new value." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
348 :type 'string :group 'ada) |
18120 | 349 |
350 (defcustom ada-fill-comment-postfix " --" | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
351 "*Text inserted at the end of each line when filling a comment paragraph. |
18120 | 352 with `ada-fill-comment-paragraph-postfix'." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
353 :type 'string :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
354 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
355 (defcustom ada-label-indent -4 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
356 "*Number of columns to indent a label. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
357 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
358 An example is: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
359 procedure Foo is |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
360 begin |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
361 >>>>>>>>>>>>Label: -- from ada-label-indent |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
362 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
363 This is also used for <<..>> labels" |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
364 :type 'integer :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
365 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
366 (defcustom ada-language-version 'ada95 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
367 "*Do we program in `ada83' or `ada95'?" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
368 :type '(choice (const ada83) (const ada95)) :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
369 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
370 (defcustom ada-move-to-declaration nil |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
371 "*Non-nil means `ada-move-to-start' moves point to the subprogram declaration, |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
372 not to 'begin'." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
373 :type 'boolean :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
374 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
375 (defcustom ada-popup-key '[down-mouse-3] |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
376 "*Key used for binding the contextual menu. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
377 If nil, no contextual menu is available." |
35959 | 378 :type '(restricted-sexp :match-alternatives (stringp vectorp)) |
35263 | 379 :group 'ada) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
380 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
381 (defcustom ada-search-directories |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
382 '("." "$ADA_INCLUDE_PATH" "/usr/adainclude" "/usr/local/adainclude" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
383 "/opt/gnu/adainclude") |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
384 "*List of directories to search for Ada files. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
385 See the description for the `ff-search-directories' variable. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
386 Emacs will automatically add the paths defined in your project file, and if you |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
387 are using the GNAT compiler the output of the gnatls command to find where the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
388 runtime really is." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
389 :type '(repeat (choice :tag "Directory" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
390 (const :tag "default" nil) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
391 (directory :format "%v"))) |
18120 | 392 :group 'ada) |
393 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
394 (defcustom ada-stmt-end-indent 0 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
395 "*Number of columns to indent the end of a statement on a separate line. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
396 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
397 An example is: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
398 if A = B |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
399 >>>>>>>>>>>then -- from ada-stmt-end-indent" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
400 :type 'integer :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
401 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
402 (defcustom ada-tab-policy 'indent-auto |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
403 "*Control the behavior of the TAB key. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
404 Must be one of : |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
405 `indent-rigidly' : always adds ada-indent blanks at the beginning of the line. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
406 `indent-auto' : use indentation functions in this file. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
407 `always-tab' : do indent-relative." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
408 :type '(choice (const indent-auto) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
409 (const indent-rigidly) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
410 (const always-tab)) |
18120 | 411 :group 'ada) |
10705 | 412 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
413 (defcustom ada-use-indent ada-broken-indent |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
414 "*Indentation for the lines in a 'use' statement. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
415 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
416 An example is: |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
417 use Ada.Text_IO, |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
418 >>>>>Ada.Numerics; -- from ada-use-indent" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
419 :type 'integer :group 'ada) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
420 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
421 (defcustom ada-when-indent 3 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
422 "*Indentation for 'when' relative to 'exception' or 'case'. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
423 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
424 An example is: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
425 case A is |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
426 >>>>>>>>when B => -- from ada-when-indent" |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
427 :type 'integer :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
428 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
429 (defcustom ada-with-indent ada-broken-indent |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
430 "*Indentation for the lines in a 'with' statement. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
431 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
432 An example is: |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
433 with Ada.Text_IO, |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
434 >>>>>Ada.Numerics; -- from ada-with-indent" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
435 :type 'integer :group 'ada) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
436 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
437 (defcustom ada-which-compiler 'gnat |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
438 "*Name of the compiler to use. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
439 This will determine what features are made available through the ada-mode. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
440 The possible choices are : |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
441 `gnat': Use Ada Core Technologies' Gnat compiler. Add some cross-referencing |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
442 features |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
443 `generic': Use a generic compiler" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
444 :type '(choice (const gnat) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
445 (const generic)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
446 :group 'ada) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
447 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
448 |
10705 | 449 ;;; ---- end of user configurable variables |
450 | |
451 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
452 (defvar ada-body-suffixes '(".adb") |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
453 "List of possible suffixes for Ada body files. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
454 The extensions should include a `.' if needed.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
455 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
456 (defvar ada-spec-suffixes '(".ads") |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
457 "List of possible suffixes for Ada spec files. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
458 The extensions should include a `.' if needed.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
459 |
32300
5acb191f2a15
(ada-mode-menu): Add name to menu map.
Dave Love <fx@gnu.org>
parents:
30411
diff
changeset
|
460 (defvar ada-mode-menu (make-sparse-keymap "Ada") |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
461 "Menu for ada-mode.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
462 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
463 (defvar ada-mode-map (make-sparse-keymap) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
464 "Local keymap used for Ada mode.") |
10705 | 465 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
466 (defvar ada-mode-abbrev-table nil |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
467 "Local abbrev table for Ada mode.") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
468 |
10705 | 469 (defvar ada-mode-syntax-table nil |
470 "Syntax table to be used for editing Ada source code.") | |
471 | |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
472 (defvar ada-mode-symbol-syntax-table nil |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
473 "Syntax table for Ada, where `_' is a word constituent.") |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
474 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
475 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
476 (defconst ada-83-string-keywords |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
477 '("abort" "abs" "accept" "access" "all" "and" "array" "at" "begin" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
478 "body" "case" "constant" "declare" "delay" "delta" "digits" "do" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
479 "else" "elsif" "end" "entry" "exception" "exit" "for" "function" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
480 "generic" "goto" "if" "in" "is" "limited" "loop" "mod" "new" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
481 "not" "null" "of" "or" "others" "out" "package" "pragma" "private" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
482 "procedure" "raise" "range" "record" "rem" "renames" "return" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
483 "reverse" "select" "separate" "subtype" "task" "terminate" "then" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
484 "type" "use" "when" "while" "with" "xor") |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
485 "List of Ada keywords. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
486 This variable is used to define `ada-83-keywords' and `ada-95-keywords'")) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
487 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
488 (defvar ada-ret-binding nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
489 "Variable to save key binding of RET when casing is activated.") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
490 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
491 (defvar ada-case-exception '() |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
492 "Alist of words (entities) that have special casing.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
493 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
494 (defvar ada-case-exception-substring '() |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
495 "Alist of substrings (entities) that have special casing. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
496 The substrings are detected for word constituant when the word |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
497 is not itself in ada-case-exception, and only for substrings that |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
498 either are at the beginning or end of the word, or start after '_'.") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
499 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
500 (defvar ada-lfd-binding nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
501 "Variable to save key binding of LFD when casing is activated.") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
502 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
503 (defvar ada-other-file-alist nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
504 "Variable used by find-file to find the name of the other package. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
505 See `ff-other-file-alist'.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
506 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
507 (defvar ada-align-list |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
508 '(("[^:]\\(\\s-*\\):[^:]" 1 t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
509 ("[^=]\\(\\s-+\\)=[^=]" 1 t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
510 ("\\(\\s-*\\)use\\s-" 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
511 ("\\(\\s-*\\)--" 1)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
512 "Ada support for align.el <= 2.2 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
513 This variable provides regular expressions on which to align different lines. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
514 See `align-mode-alist' for more information.") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
515 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
516 (defvar ada-align-modes |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
517 '((ada-declaration |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
518 (regexp . "[^:]\\(\\s-*\\):[^:]") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
519 (valid . (lambda() (not (ada-in-comment-p)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
520 (modes . '(ada-mode))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
521 (ada-assignment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
522 (regexp . "[^=]\\(\\s-+\\)=[^=]") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
523 (valid . (lambda() (not (ada-in-comment-p)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
524 (modes . '(ada-mode))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
525 (ada-comment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
526 (regexp . "\\(\\s-*\\)--") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
527 (modes . '(ada-mode))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
528 (ada-use |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
529 (regexp . "\\(\\s-*\\)use\\s-") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
530 (valid . (lambda() (not (ada-in-comment-p)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
531 (modes . '(ada-mode))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
532 ) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
533 "Ada support for align.el >= 2.8 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
534 This variable defines several rules to use to align different lines.") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
535 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
536 (defconst ada-align-region-separate |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
537 (concat |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
538 "^\\s-*\\($\\|\\(" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
539 "begin\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
540 "declare\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
541 "else\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
542 "end\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
543 "exception\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
544 "for\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
545 "function\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
546 "generic\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
547 "if\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
548 "is\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
549 "procedure\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
550 "record\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
551 "return\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
552 "type\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
553 "when" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
554 "\\)\\>\\)") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
555 "see the variable `align-region-separate' for more information.") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
556 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
557 ;;; ---- Below are the regexp used in this package for parsing |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
558 |
10705 | 559 (defconst ada-83-keywords |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
560 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
561 (concat "\\<" (regexp-opt ada-83-string-keywords t) "\\>")) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
562 "Regular expression for looking at Ada83 keywords.") |
10705 | 563 |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
564 (defconst ada-95-keywords |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
565 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
566 (concat "\\<" (regexp-opt |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
567 (append |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
568 '("abstract" "aliased" "protected" "requeue" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
569 "tagged" "until") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
570 ada-83-string-keywords) t) "\\>")) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
571 "Regular expression for looking at Ada95 keywords.") |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
572 |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
573 (defvar ada-keywords ada-95-keywords |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
574 "Regular expression for looking at Ada keywords.") |
10705 | 575 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
576 (defconst ada-ident-re |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
577 "\\(\\sw\\|[_.]\\)+" |
12586
f8bbc7a3b87a
(ada-ident-re): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12053
diff
changeset
|
578 "Regexp matching Ada (qualified) identifiers.") |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
579 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
580 ;; "with" needs to be included in the regexp, so that we can insert new lines |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
581 ;; after the declaration of the parameter for a generic. |
10705 | 582 (defvar ada-procedure-start-regexp |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
583 (concat |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
584 "^[ \t]*\\(with[ \t]+\\)?\\(procedure\\|function\\|task\\)[ \t\n]+" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
585 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
586 ;; subprogram name: operator ("[+/=*]") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
587 "\\(" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
588 "\\(\"[^\"]+\"\\)" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
589 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
590 ;; subprogram name: name |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
591 "\\|" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
592 "\\(\\(\\sw\\|[_.]\\)+\\)" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
593 "\\)") |
10705 | 594 "Regexp used to find Ada procedures/functions.") |
595 | |
596 (defvar ada-package-start-regexp | |
597 "^[ \t]*\\(package\\)" | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
598 "Regexp used to find Ada packages.") |
10705 | 599 |
600 | |
601 ;;; ---- regexps for indentation functions | |
602 | |
603 (defvar ada-block-start-re | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
604 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
605 (concat "\\<\\(" (regexp-opt '("begin" "declare" "else" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
606 "exception" "generic" "loop" "or" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
607 "private" "select" )) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
608 "\\|\\(\\(limited\\|abstract\\|tagged\\)[ \t\n]+\\)*record\\)\\>")) |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
609 "Regexp for keywords starting Ada blocks.") |
10705 | 610 |
611 (defvar ada-end-stmt-re | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
612 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
613 (concat "\\(" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
614 ";" "\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
615 "=>[ \t]*$" "\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
616 "^[ \t]*separate[ \t]*(\\(\\sw\\|[_.]\\)+)" "\\|" |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
617 "\\<" (regexp-opt '("begin" "declare" "is" "do" "else" "generic" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
618 "loop" "private" "record" "select" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
619 "then abort" "then") t) "\\>" "\\|" |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
620 "^[ \t]*" (regexp-opt '("function" "package" "procedure") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
621 t) "\\>\\(\\sw\\|[ \t_.]\\)+\\<is\\>" "\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
622 "^[ \t]*exception\\>" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
623 "\\)") ) |
10705 | 624 "Regexp of possible ends for a non-broken statement. |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
625 A new statement starts after these.") |
10705 | 626 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
627 (defvar ada-matching-start-re |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
628 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
629 (concat "\\<" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
630 (regexp-opt |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
631 '("end" "loop" "select" "begin" "case" "do" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
632 "if" "task" "package" "record" "protected") t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
633 "\\>")) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
634 "Regexp used in ada-goto-matching-start.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
635 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
636 (defvar ada-matching-decl-start-re |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
637 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
638 (concat "\\<" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
639 (regexp-opt |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
640 '("is" "separate" "end" "declare" "if" "new" "begin" "generic" "when") t) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
641 "\\>")) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
642 "Regexp used in ada-goto-matching-decl-start.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
643 |
10705 | 644 (defvar ada-loop-start-re |
645 "\\<\\(for\\|while\\|loop\\)\\>" | |
646 "Regexp for the start of a loop.") | |
647 | |
648 (defvar ada-subprog-start-re | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
649 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
650 (concat "\\<" (regexp-opt '("accept" "entry" "function" "package" "procedure" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
651 "protected" "task") t) "\\>")) |
10705 | 652 "Regexp for the start of a subprogram.") |
653 | |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
654 (defvar ada-named-block-re |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
655 "[ \t]*\\(\\sw\\|_\\)+[ \t]*:[^=]" |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
656 "Regexp of the name of a block or loop.") |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
657 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
658 (defvar ada-contextual-menu-on-identifier nil |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
659 "Set to true when the right mouse button was clicked on an identifier.") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
660 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
661 (defvar ada-contextual-menu-last-point nil |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
662 "Position of point just before displaying the menu. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
663 This is a list (point buffer). |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
664 Since `ada-popup-menu' moves the point where the user clicked, the region |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
665 is modified. Therefore no command from the menu knows what the user selected |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
666 before displaying the contextual menu. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
667 To get the original region, restore the point to this position before |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
668 calling `region-end' and `region-beginning'. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
669 Modify this variable if you want to restore the point to another position.") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
670 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
671 (defvar ada-contextual-menu |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
672 (if ada-xemacs |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
673 '("Ada" |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
674 ["Goto Declaration/Body" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
675 (ada-call-from-contextual-menu 'ada-point-and-xref) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
676 :included (and (functionp 'ada-point-and-xref) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
677 ada-contextual-menu-on-identifier)] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
678 ["Goto Previous Reference" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
679 (ada-call-from-contextual-menu 'ada-xref-goto-previous-reference) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
680 :included (functionp 'ada-xref-goto-previous-reference)] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
681 ["List References" ada-find-references |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
682 :included ada-contextual-menu-on-identifier] |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
683 ["List Local References" ada-find-local-references |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
684 :included ada-contextual-menu-on-identifier] |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
685 ["-" nil nil] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
686 ["Other File" ff-find-other-file] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
687 ["Goto Parent Unit" ada-goto-parent] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
688 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
689 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
690 (let ((map (make-sparse-keymap "Ada"))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
691 ;; The identifier part |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
692 (if (equal ada-which-compiler 'gnat) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
693 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
694 (define-key-after map [Ref] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
695 '(menu-item "Goto Declaration/Body" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
696 (lambda()(interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
697 (ada-call-from-contextual-menu |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
698 'ada-point-and-xref)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
699 :visible |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
700 (and (functionp 'ada-point-and-xref) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
701 ada-contextual-menu-on-identifier)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
702 t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
703 (define-key-after map [Prev] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
704 '(menu-item "Goto Previous Reference" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
705 (lambda()(interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
706 (ada-call-from-contextual-menu |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
707 'ada-xref-goto-previous-reference)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
708 :visible |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
709 (functionp 'ada-xref-goto-previous-reference)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
710 t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
711 (define-key-after map [List] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
712 '(menu-item "List References" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
713 ada-find-references |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
714 :visible ada-contextual-menu-on-identifier) t) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
715 (define-key-after map [List-Local] |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
716 '(menu-item "List Local References" |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
717 ada-find-local-references |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
718 :visible ada-contextual-menu-on-identifier) t) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
719 (define-key-after map [-] '("-" nil) t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
720 )) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
721 (define-key-after map [Other] '("Other file" . ff-find-other-file) t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
722 (define-key-after map [Parent] '("Goto Parent Unit" . ada-goto-parent)t) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
723 map)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
724 "Defines the menu to use when the user presses the right mouse button. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
725 The variable `ada-contextual-menu-on-identifier' will be set to t before |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
726 displaying the menu if point was on an identifier." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
727 ) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
728 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
729 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
730 ;;------------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
731 ;; Support for imenu (see imenu.el) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
732 ;;------------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
733 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
734 (defconst ada-imenu-comment-re "\\([ \t]*--.*\\)?") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
735 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
736 (defconst ada-imenu-subprogram-menu-re |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
737 (concat "^[ \t]*\\(procedure\\|function\\)[ \t\n]+" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
738 "\\(\\(\\sw\\|_\\)+\\)[ \t\n]*\\([ \t\n]\\|([^)]+)" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
739 ada-imenu-comment-re |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
740 "\\)[ \t\n]*" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
741 "\\(return[ \t\n]+\\(\\sw\\|[_.]\\)+[ \t\n]*\\)?is[ \t\n]")) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
742 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
743 (defvar ada-imenu-generic-expression |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
744 (list |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
745 (list nil ada-imenu-subprogram-menu-re 2) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
746 (list "*Specs*" |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
747 (concat |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
748 "^[ \t]*\\(procedure\\|function\\)[ \t\n]+\\(\\(\\sw\\|_\\)+\\)" |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
749 "\\(" |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
750 "\\(" ada-imenu-comment-re "[ \t\n]+\\|[ \t\n]*([^)]+)" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
751 ada-imenu-comment-re "\\)";; parameter list or simple space |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
752 "\\([ \t\n]*return[ \t\n]+\\(\\sw\\|[_.]\\)+[ \t\n]*\\)?" |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
753 "\\)?;") 2) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
754 '("*Tasks*" "^[ \t]*task[ \t]+\\(type[ \t]+\\)?\\(\\(body[ \t]+\\)?\\(\\sw\\|_\\)+\\)" 2) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
755 '("*Type Defs*" "^[ \t]*\\(sub\\)?type[ \t]+\\(\\(\\sw\\|_\\)+\\)" 2) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
756 '("*Protected*" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
757 "^[ \t]*protected[ \t]+\\(type[ \t]+\\)?\\(\\(body[ \t]+\\)?\\(\\sw\\|_\\)+\\)" 2) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
758 '("*Packages*" "^[ \t]*package[ \t]+\\(\\(body[ \t]+\\)?\\(\\sw\\|[_.]\\)+\\)" 1)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
759 "Imenu generic expression for Ada mode. |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
760 See `imenu-generic-expression'. This variable will create several submenus for |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
761 each type of entity that can be found in an Ada file.") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
762 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
763 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
764 ;;------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
765 ;; Support for compile.el |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
766 ;;------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
767 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
768 (defun ada-compile-mouse-goto-error () |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
769 "Mouse interface for ada-compile-goto-error." |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
770 (interactive) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
771 (mouse-set-point last-input-event) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
772 (ada-compile-goto-error (point)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
773 ) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
774 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
775 (defun ada-compile-goto-error (pos) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
776 "Replaces `compile-goto-error' from compile.el. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
777 If POS is on a file and line location, go to this position. It adds to |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
778 compile.el the capacity to go to a reference in an error message. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
779 For instance, on this line: |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
780 foo.adb:61:11: [...] in call to size declared at foo.ads:11 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
781 both file locations can be clicked on and jumped to." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
782 (interactive "d") |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
783 (goto-char pos) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
784 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
785 (skip-chars-backward "-a-zA-Z0-9_:./\\") |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
786 (cond |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
787 ;; special case: looking at a filename:line not at the beginning of a line |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
788 ((and (not (bolp)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
789 (looking-at |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
790 "\\([-_.a-zA-Z0-9]+\\):\\([0-9]+\\)\\(:\\([0-9]+\\)\\)?")) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
791 (let ((line (match-string 2)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
792 (error-pos (point-marker)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
793 source) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
794 (save-excursion |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
795 (save-restriction |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
796 (widen) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
797 ;; Use funcall so as to prevent byte-compiler warnings |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
798 (set-buffer (funcall (symbol-function 'compilation-find-file) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
799 (point-marker) (match-string 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
800 "./")) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
801 (if (stringp line) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
802 (goto-line (string-to-number line))) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
803 (setq source (point-marker)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
804 (funcall (symbol-function 'compilation-goto-locus) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
805 (cons source error-pos)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
806 )) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
807 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
808 ;; otherwise, default behavior |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
809 (t |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
810 (funcall (symbol-function 'compile-goto-error))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
811 ) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
812 (recenter)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
813 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
814 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
815 ;;------------------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
816 ;; Grammar related function |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
817 ;; The functions below work with the syntax class of the characters in an Ada |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
818 ;; buffer. Two syntax tables are created, depending on whether we want '_' |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
819 ;; to be considered as part of a word or not. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
820 ;; Some characters may have multiple meanings depending on the context: |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
821 ;; - ' is either the beginning of a constant character or an attribute |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
822 ;; - # is either part of a based litteral or a gnatprep statement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
823 ;; - " starts a string, but not if inside a constant character. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
824 ;; - ( and ) should be ignored if inside a constant character. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
825 ;; Thus their syntax property is changed automatically, and we can still use |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
826 ;; the standard Emacs functions for sexp (see `ada-in-string-p') |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
827 ;; |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
828 ;; On Emacs, this is done through the `syntax-table' text property. The |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
829 ;; modification is done automatically each time the user as typed a new |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
830 ;; character. This is already done in `font-lock-mode' (in |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
831 ;; `font-lock-syntactic-keywords', so we take advantage of the existing |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
832 ;; mechanism. If font-lock-mode is not activated, we do it by hand in |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
833 ;; `ada-after-change-function', thanks to `ada-deactivate-properties' and |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
834 ;; `ada-initialize-properties'. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
835 ;; |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
836 ;; on XEmacs, the `syntax-table' property does not exist and we have to use a |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
837 ;; slow advice to `parse-partial-sexp' to do the same thing. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
838 ;; When executing parse-partial-sexp, we simply modify the strings before and |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
839 ;; after, so that the special constants '"', '(' and ')' do not interact |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
840 ;; with parse-partial-sexp. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
841 ;; Note: this code is slow and needs to be rewritten as soon as something |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
842 ;; better is available on XEmacs. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
843 ;;------------------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
844 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
845 (defun ada-create-syntax-table () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
846 "Create the two syntax tables use in the Ada mode. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
847 The standard table declares `_' as a symbol constituent, the second one |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
848 declares it as a word constituent." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
849 (interactive) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
850 (setq ada-mode-syntax-table (make-syntax-table)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
851 (set-syntax-table ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
852 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
853 ;; define string brackets (`%' is alternative string bracket, but |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
854 ;; almost never used as such and throws font-lock and indentation |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
855 ;; off the track.) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
856 (modify-syntax-entry ?% "$" ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
857 (modify-syntax-entry ?\" "\"" ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
858 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
859 (modify-syntax-entry ?: "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
860 (modify-syntax-entry ?\; "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
861 (modify-syntax-entry ?& "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
862 (modify-syntax-entry ?\| "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
863 (modify-syntax-entry ?+ "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
864 (modify-syntax-entry ?* "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
865 (modify-syntax-entry ?/ "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
866 (modify-syntax-entry ?= "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
867 (modify-syntax-entry ?< "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
868 (modify-syntax-entry ?> "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
869 (modify-syntax-entry ?$ "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
870 (modify-syntax-entry ?\[ "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
871 (modify-syntax-entry ?\] "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
872 (modify-syntax-entry ?\{ "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
873 (modify-syntax-entry ?\} "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
874 (modify-syntax-entry ?. "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
875 (modify-syntax-entry ?\\ "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
876 (modify-syntax-entry ?\' "." ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
877 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
878 ;; a single hyphen is punctuation, but a double hyphen starts a comment |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
879 (modify-syntax-entry ?- ". 12" ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
880 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
881 ;; See the comment above on grammar related function for the special |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
882 ;; setup for '#'. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
883 (if ada-xemacs |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
884 (modify-syntax-entry ?# "<" ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
885 (modify-syntax-entry ?# "$" ada-mode-syntax-table)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
886 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
887 ;; and \f and \n end a comment |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
888 (modify-syntax-entry ?\f "> " ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
889 (modify-syntax-entry ?\n "> " ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
890 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
891 ;; define what belongs in Ada symbols |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
892 (modify-syntax-entry ?_ "_" ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
893 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
894 ;; define parentheses to match |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
895 (modify-syntax-entry ?\( "()" ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
896 (modify-syntax-entry ?\) ")(" ada-mode-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
897 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
898 (setq ada-mode-symbol-syntax-table (copy-syntax-table ada-mode-syntax-table)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
899 (modify-syntax-entry ?_ "w" ada-mode-symbol-syntax-table) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
900 ) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
901 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
902 ;; Support of special characters in XEmacs (see the comments at the beginning |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
903 ;; of the section on Grammar related functions). |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
904 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
905 (if ada-xemacs |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
906 (defadvice parse-partial-sexp (around parse-partial-sexp-protect-constants) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
907 "Handles special character constants and gnatprep statements." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
908 (let (change) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
909 (if (< to from) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
910 (let ((tmp from)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
911 (setq from to to tmp))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
912 (save-excursion |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
913 (goto-char from) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
914 (while (re-search-forward "'\\([(\")#]\\)'" to t) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
915 (setq change (cons (list (match-beginning 1) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
916 1 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
917 (match-string 1)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
918 change)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
919 (replace-match "'A'")) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
920 (goto-char from) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
921 (while (re-search-forward "\\(#[0-9a-fA-F]*#\\)" to t) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
922 (setq change (cons (list (match-beginning 1) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
923 (length (match-string 1)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
924 (match-string 1)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
925 change)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
926 (replace-match (make-string (length (match-string 1)) ?@)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
927 ad-do-it |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
928 (save-excursion |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
929 (while change |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
930 (goto-char (caar change)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
931 (delete-char (cadar change)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
932 (insert (caddar change)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
933 (setq change (cdr change))))))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
934 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
935 (defun ada-deactivate-properties () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
936 "Deactivate ada-mode's properties handling. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
937 This would be a duplicate of font-lock if both are used at the same time." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
938 (remove-hook 'after-change-functions 'ada-after-change-function t)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
939 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
940 (defun ada-initialize-properties () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
941 "Initialize some special text properties in the whole buffer. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
942 In particular, character constants are said to be strings, #...# are treated |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
943 as numbers instead of gnatprep comments." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
944 (save-excursion |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
945 (save-restriction |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
946 (widen) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
947 (goto-char (point-min)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
948 (while (re-search-forward "'.'" nil t) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
949 (add-text-properties (match-beginning 0) (match-end 0) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
950 '(syntax-table ("'" . ?\")))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
951 (goto-char (point-min)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
952 (while (re-search-forward "^[ \t]*#" nil t) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
953 (add-text-properties (match-beginning 0) (match-end 0) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
954 '(syntax-table (11 . 10)))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
955 (set-buffer-modified-p nil) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
956 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
957 ;; Setting this only if font-lock is not set won't work |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
958 ;; if the user activates or deactivates font-lock-mode, |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
959 ;; but will make things faster most of the time |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
960 (make-local-hook 'after-change-functions) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
961 (add-hook 'after-change-functions 'ada-after-change-function nil t) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
962 ))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
963 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
964 (defun ada-after-change-function (beg end old-len) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
965 "Called when the region between BEG and END was changed in the buffer. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
966 OLD-LEN indicates what the length of the replaced text was." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
967 (let ((inhibit-point-motion-hooks t) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
968 (eol (point))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
969 (save-excursion |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
970 (save-match-data |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
971 (beginning-of-line) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
972 (remove-text-properties (point) eol '(syntax-table nil)) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
973 (while (re-search-forward "'.'" eol t) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
974 (add-text-properties (match-beginning 0) (match-end 0) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
975 '(syntax-table ("'" . ?\")))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
976 (beginning-of-line) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
977 (if (looking-at "^[ \t]*#") |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
978 (add-text-properties (match-beginning 0) (match-end 0) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
979 '(syntax-table (11 . 10)))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
980 )))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
981 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
982 ;;------------------------------------------------------------------ |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
983 ;; Testing the grammatical context |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
984 ;;------------------------------------------------------------------ |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
985 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
986 (defsubst ada-in-comment-p (&optional parse-result) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
987 "Returns t if inside a comment." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
988 (nth 4 (or parse-result |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
989 (parse-partial-sexp |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
990 (save-excursion (beginning-of-line) (point)) (point))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
991 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
992 (defsubst ada-in-string-p (&optional parse-result) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
993 "Returns t if point is inside a string. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
994 If parse-result is non-nil, use is instead of calling parse-partial-sexp." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
995 (nth 3 (or parse-result |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
996 (parse-partial-sexp |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
997 (save-excursion (beginning-of-line) (point)) (point))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
998 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
999 (defsubst ada-in-string-or-comment-p (&optional parse-result) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1000 "Returns t if inside a comment or string." |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1001 (setq parse-result (or parse-result |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1002 (parse-partial-sexp |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1003 (save-excursion (beginning-of-line) (point)) (point)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1004 (or (ada-in-string-p parse-result) (ada-in-comment-p parse-result))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1005 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1006 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1007 ;;------------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1008 ;; Contextual menus |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1009 ;; The Ada-mode comes with contextual menus, bound by default to the right |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1010 ;; mouse button. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1011 ;; Add items to this menu by modifying `ada-contextual-menu'. Note that the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1012 ;; variable `ada-contextual-menu-on-identifier' is set automatically to t |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1013 ;; if the mouse button was pressed on an identifier. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1014 ;;------------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1015 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1016 (defun ada-call-from-contextual-menu (function) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1017 "Execute FUNCTION when called from the contextual menu. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1018 It forces Emacs to change the cursor position." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1019 (interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1020 (funcall function) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1021 (setq ada-contextual-menu-last-point |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1022 (list (point) (current-buffer)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1023 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1024 (defun ada-popup-menu (position) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1025 "Pops up a contextual menu, depending on where the user clicked. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1026 POSITION is the location the mouse was clicked on. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1027 Sets `ada-contextual-menu-last-point' to the current position before |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1028 displaying the menu. When a function from the menu is called, the point is |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1029 where the mouse button was clicked." |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1030 (interactive "e") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1031 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1032 ;; declare this as a local variable, so that the function called |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1033 ;; in the contextual menu does not hide the region in |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1034 ;; transient-mark-mode. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1035 (let ((deactivate-mark nil)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1036 (setq ada-contextual-menu-last-point |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1037 (list (point) (current-buffer))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1038 (mouse-set-point last-input-event) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1039 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1040 (setq ada-contextual-menu-on-identifier |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1041 (and (char-after) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1042 (or (= (char-syntax (char-after)) ?w) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1043 (= (char-after) ?_)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1044 (not (ada-in-string-or-comment-p)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1045 (save-excursion (skip-syntax-forward "w") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1046 (not (ada-after-keyword-p))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1047 )) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1048 (let (choice) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1049 (if ada-xemacs |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1050 (setq choice (funcall (symbol-function 'popup-menu) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1051 ada-contextual-menu)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1052 (setq choice (x-popup-menu position ada-contextual-menu))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1053 (if choice |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1054 (funcall (lookup-key ada-contextual-menu (vector (car choice)))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1055 (set-buffer (cadr ada-contextual-menu-last-point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1056 (goto-char (car ada-contextual-menu-last-point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1057 )) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1058 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1059 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1060 ;;------------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1061 ;; Misc functions |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1062 ;;------------------------------------------------------------------ |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1063 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1064 ;;;###autoload |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1065 (defun ada-add-extensions (spec body) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1066 "Define SPEC and BODY as being valid extensions for Ada files. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1067 Going from body to spec with `ff-find-other-file' used these |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1068 extensions. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1069 SPEC and BODY are two regular expressions that must match against the file |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1070 name" |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1071 (let* ((reg (concat (regexp-quote body) "$")) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1072 (tmp (assoc reg ada-other-file-alist))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1073 (if tmp |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1074 (setcdr tmp (list (cons spec (cadr tmp)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1075 (add-to-list 'ada-other-file-alist (list reg (list spec))))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1076 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1077 (let* ((reg (concat (regexp-quote spec) "$")) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1078 (tmp (assoc reg ada-other-file-alist))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1079 (if tmp |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1080 (setcdr tmp (list (cons body (cadr tmp)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1081 (add-to-list 'ada-other-file-alist (list reg (list body))))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1082 |
41082
6204eb16d008
(ada-add-extensions): Quote regexp special
Andreas Schwab <schwab@suse.de>
parents:
41036
diff
changeset
|
1083 (add-to-list 'auto-mode-alist |
6204eb16d008
(ada-add-extensions): Quote regexp special
Andreas Schwab <schwab@suse.de>
parents:
41036
diff
changeset
|
1084 (cons (concat (regexp-quote spec) "\\'") 'ada-mode)) |
6204eb16d008
(ada-add-extensions): Quote regexp special
Andreas Schwab <schwab@suse.de>
parents:
41036
diff
changeset
|
1085 (add-to-list 'auto-mode-alist |
6204eb16d008
(ada-add-extensions): Quote regexp special
Andreas Schwab <schwab@suse.de>
parents:
41036
diff
changeset
|
1086 (cons (concat (regexp-quote body) "\\'") 'ada-mode)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1087 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1088 (add-to-list 'ada-spec-suffixes spec) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1089 (add-to-list 'ada-body-suffixes body) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1090 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1091 ;; Support for speedbar (Specifies that we want to see these files in |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1092 ;; speedbar) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1093 (condition-case nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1094 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1095 (require 'speedbar) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1096 (funcall (symbol-function 'speedbar-add-supported-extension) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1097 spec) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1098 (funcall (symbol-function 'speedbar-add-supported-extension) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1099 body))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1100 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1101 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1102 |
10707 | 1103 ;;;###autoload |
10705 | 1104 (defun ada-mode () |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
1105 "Ada mode is the major mode for editing Ada code. |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1106 This version was built on Date: 2002/05/21 11:58:02 . |
10705 | 1107 |
1108 Bindings are as follows: (Note: 'LFD' is control-j.) | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1109 \\{ada-mode-map} |
10705 | 1110 |
1111 Indent line '\\[ada-tab]' | |
1112 Indent line, insert newline and indent the new line. '\\[newline-and-indent]' | |
1113 | |
1114 Re-format the parameter-list point is in '\\[ada-format-paramlist]' | |
1115 Indent all lines in region '\\[ada-indent-region]' | |
1116 | |
1117 Adjust case of identifiers and keywords in region '\\[ada-adjust-case-region]' | |
1118 Adjust case of identifiers and keywords in buffer '\\[ada-adjust-case-buffer]' | |
1119 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1120 Fill comment paragraph, justify and append postfix '\\[fill-paragraph]' |
10705 | 1121 |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
1122 Next func/proc/task '\\[ada-next-procedure]' Previous func/proc/task '\\[ada-previous-procedure]' |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1123 Next package '\\[ada-next-package]' Previous package '\\[ada-previous-package]' |
10705 | 1124 |
1125 Goto matching start of current 'end ...;' '\\[ada-move-to-start]' | |
1126 Goto end of current block '\\[ada-move-to-end]' | |
1127 | |
1128 Comments are handled using standard GNU Emacs conventions, including: | |
1129 Start a comment '\\[indent-for-comment]' | |
1130 Comment region '\\[comment-region]' | |
1131 Uncomment region '\\[ada-uncomment-region]' | |
1132 Continue comment on next line '\\[indent-new-comment-line]' | |
1133 | |
1134 If you use imenu.el: | |
1135 Display index-menu of functions & procedures '\\[imenu]' | |
1136 | |
1137 If you use find-file.el: | |
1138 Switch to other file (Body <-> Spec) '\\[ff-find-other-file]' | |
1139 or '\\[ff-mouse-find-other-file] | |
1140 Switch to other file in other window '\\[ada-ff-other-window]' | |
1141 or '\\[ff-mouse-find-other-file-other-window] | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1142 If you use this function in a spec and no body is available, it gets created with body stubs. |
10705 | 1143 |
1144 If you use ada-xref.el: | |
1145 Goto declaration: '\\[ada-point-and-xref]' on the identifier | |
1146 or '\\[ada-goto-declaration]' with point on the identifier | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1147 Complete identifier: '\\[ada-complete-identifier]'." |
10705 | 1148 |
1149 (interactive) | |
1150 (kill-all-local-variables) | |
1151 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1152 (set (make-local-variable 'require-final-newline) t) |
10705 | 1153 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1154 ;; Set the paragraph delimiters so that one can select a whole block |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1155 ;; simply with M-h |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1156 (set (make-local-variable 'paragraph-start) "[ \t\n\f]*$") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1157 (set (make-local-variable 'paragraph-separate) "[ \t\n\f]*$") |
10705 | 1158 |
1159 ;; comment end must be set because it may hold a wrong value if | |
1160 ;; this buffer had been in another mode before. RE | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1161 (set (make-local-variable 'comment-end) "") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1162 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1163 ;; used by autofill and indent-new-comment-line |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1164 (set (make-local-variable 'comment-start-skip) "---*[ \t]*") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1165 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1166 ;; used by autofill to break a comment line and continue it on another line. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1167 ;; The reason we need this one is that the default behavior does not work |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1168 ;; correctly with the definition of paragraph-start above when the comment |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1169 ;; is right after a multi-line subprogram declaration (the comments are |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1170 ;; aligned under the latest parameter, not under the declaration start). |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1171 (set (make-local-variable 'comment-line-break-function) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1172 (lambda (&optional soft) (let ((fill-prefix nil)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1173 (indent-new-comment-line soft)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1174 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1175 (set (make-local-variable 'indent-line-function) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1176 'ada-indent-current-function) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1177 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1178 (set (make-local-variable 'comment-column) 40) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1179 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1180 ;; Emacs 20.3 defines a comment-padding to insert spaces between |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1181 ;; the comment and the text. We do not want any, this is already |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1182 ;; included in comment-start |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1183 (unless ada-xemacs |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1184 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1185 (if (ada-check-emacs-version 20 3) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1186 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1187 (set (make-local-variable 'parse-sexp-ignore-comments) t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1188 (set (make-local-variable 'comment-padding) 0))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1189 (set (make-local-variable 'parse-sexp-lookup-properties) t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1190 )) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1191 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1192 (set 'case-fold-search t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1193 (if (boundp 'imenu-case-fold-search) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1194 (set 'imenu-case-fold-search t)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1195 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1196 (set (make-local-variable 'fill-paragraph-function) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1197 'ada-fill-comment-paragraph) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1198 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1199 (set (make-local-variable 'imenu-generic-expression) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1200 ada-imenu-generic-expression) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1201 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1202 ;; Support for compile.el |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1203 ;; We just substitute our own functions to go to the error. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1204 (add-hook 'compilation-mode-hook |
28995
93c16141d107
(ada-mode, ada-create-case-exception): Don't quote lambdas.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26225
diff
changeset
|
1205 (lambda() |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
1206 (set (make-local-variable 'compile-auto-highlight) 40) |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
1207 ;; FIXME: This has global impact! -stef |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1208 (define-key compilation-minor-mode-map [mouse-2] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1209 'ada-compile-mouse-goto-error) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1210 (define-key compilation-minor-mode-map "\C-c\C-c" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1211 'ada-compile-goto-error) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1212 (define-key compilation-minor-mode-map "\C-m" |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
1213 'ada-compile-goto-error))) |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
1214 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1215 ;; font-lock support : |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1216 ;; We need to set some properties for XEmacs, and define some variables |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1217 ;; for Emacs |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1218 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1219 (if ada-xemacs |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1220 ;; XEmacs |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1221 (put 'ada-mode 'font-lock-defaults |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1222 '(ada-font-lock-keywords |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1223 nil t ((?\_ . "w") (?# . ".")) beginning-of-line)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1224 ;; Emacs |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1225 (set (make-local-variable 'font-lock-defaults) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1226 '(ada-font-lock-keywords |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1227 nil t |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1228 ((?\_ . "w") (?# . ".")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1229 beginning-of-line |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1230 (font-lock-syntactic-keywords . ada-font-lock-syntactic-keywords))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1231 ) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1232 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1233 ;; Set up support for find-file.el. |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
1234 (set (make-local-variable 'ff-other-file-alist) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1235 'ada-other-file-alist) |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
1236 (set (make-local-variable 'ff-search-directories) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1237 'ada-search-directories) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1238 (setq ff-post-load-hooks 'ada-set-point-accordingly |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1239 ff-file-created-hooks 'ada-make-body) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1240 (add-hook 'ff-pre-load-hooks 'ada-which-function-are-we-in) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1241 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1242 ;; Some special constructs for find-file.el |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1243 ;; We do not need to add the construction for 'with', which is in the |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1244 ;; standard find-file.el |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1245 (make-local-variable 'ff-special-constructs) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1246 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1247 ;; Go to the parent package : |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1248 (add-to-list 'ff-special-constructs |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1249 (cons (eval-when-compile |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1250 (concat "^\\(private[ \t]\\)?[ \t]*package[ \t]+" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1251 "\\(body[ \t]+\\)?" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1252 "\\(\\(\\sw\\|[_.]\\)+\\)\\.\\(\\sw\\|_\\)+[ \t\n]+is")) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1253 (lambda () |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1254 (set 'fname (ff-get-file |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1255 ada-search-directories |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1256 (ada-make-filename-from-adaname |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1257 (match-string 3)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1258 ada-spec-suffixes))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1259 ;; Another special construct for find-file.el : when in a separate clause, |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1260 ;; go to the correct package. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1261 (add-to-list 'ff-special-constructs |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1262 (cons "^separate[ \t\n]*(\\(\\(\\sw\\|[_.]\\)+\\))" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1263 (lambda () |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1264 (set 'fname (ff-get-file |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1265 ada-search-directories |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1266 (ada-make-filename-from-adaname |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1267 (match-string 1)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1268 ada-spec-suffixes))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1269 ;; Another special construct, that redefines the one in find-file.el. The |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1270 ;; old one can handle only one possible type of extension for Ada files |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1271 ;; remove from the list the standard "with..." that is put by find-file.el, |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1272 ;; since it uses the old ada-spec-suffix variable |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1273 ;; This one needs to replace the standard one defined in find-file.el (with |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1274 ;; Emacs <= 20.4), since that one uses the old variable ada-spec-suffix |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1275 (let ((old-construct |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1276 (assoc "^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" ff-special-constructs)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1277 (new-cdr |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1278 (lambda () |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1279 (set 'fname (ff-get-file |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1280 ada-search-directories |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1281 (ada-make-filename-from-adaname |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1282 (match-string 1)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1283 ada-spec-suffixes))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1284 (if old-construct |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1285 (setcdr old-construct new-cdr) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1286 (add-to-list 'ff-special-constructs |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1287 (cons "^with[ \t]+\\([a-zA-Z0-9_\\.]+\\)" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1288 new-cdr)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1289 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1290 ;; Support for outline-minor-mode |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1291 (set (make-local-variable 'outline-regexp) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1292 "\\([ \t]*\\(procedure\\|function\\|package\\|if\\|while\\|for\\|declare\\|case\\|end\\|begin\\|loop\\)\\|--\\)") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1293 (set (make-local-variable 'outline-level) 'ada-outline-level) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1294 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1295 ;; Support for imenu : We want a sorted index |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1296 (setq imenu-sort-function 'imenu--sort-by-name) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1297 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1298 ;; Support for ispell : Check only comments |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1299 (set (make-local-variable 'ispell-check-comments) 'exclusive) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1300 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1301 ;; Support for align.el <= 2.2, if present |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1302 ;; align.el is distributed with Emacs 21, but not with earlier versions. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1303 (if (boundp 'align-mode-alist) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1304 (add-to-list 'align-mode-alist '(ada-mode . ada-align-list))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1305 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1306 ;; Support for align.el >= 2.8, if present |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1307 (if (boundp 'align-dq-string-modes) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1308 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1309 (add-to-list 'align-dq-string-modes 'ada-mode) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1310 (add-to-list 'align-open-comment-modes 'ada-mode) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1311 (set (make-variable-buffer-local 'align-region-separate) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1312 ada-align-region-separate) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1313 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1314 ;; Exclude comments alone on line from alignment. |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1315 (add-to-list 'align-exclude-rules-list |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1316 '(ada-solo-comment |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1317 (regexp . "^\\(\\s-*\\)--") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1318 (modes . '(ada-mode)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1319 (add-to-list 'align-exclude-rules-list |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1320 '(ada-solo-use |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1321 (regexp . "^\\(\\s-*\\)\\<use\\>") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1322 (modes . '(ada-mode)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1323 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1324 (setq ada-align-modes nil) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1325 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1326 (add-to-list 'ada-align-modes |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1327 '(ada-declaration-assign |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1328 (regexp . "[^:]\\(\\s-*\\):[^:]") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1329 (valid . (lambda() (not (ada-in-comment-p)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1330 (repeat . t) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1331 (modes . '(ada-mode)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1332 (add-to-list 'ada-align-modes |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1333 '(ada-associate |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1334 (regexp . "[^=]\\(\\s-*\\)=>") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1335 (valid . (lambda() (not (ada-in-comment-p)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1336 (modes . '(ada-mode)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1337 (add-to-list 'ada-align-modes |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1338 '(ada-comment |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1339 (regexp . "\\(\\s-*\\)--") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1340 (modes . '(ada-mode)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1341 (add-to-list 'ada-align-modes |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1342 '(ada-use |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1343 (regexp . "\\(\\s-*\\)\\<use\\s-") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1344 (valid . (lambda() (not (ada-in-comment-p)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1345 (modes . '(ada-mode)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1346 (add-to-list 'ada-align-modes |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1347 '(ada-at |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1348 (regexp . "\\(\\s-+\\)at\\>") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1349 (modes . '(ada-mode)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1350 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1351 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1352 (setq align-mode-rules-list ada-align-modes) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1353 )) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1354 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1355 ;; Set up the contextual menu |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1356 (if ada-popup-key |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1357 (define-key ada-mode-map ada-popup-key 'ada-popup-menu)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1358 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1359 ;; Support for Abbreviations (the user still need to "M-x abbrev-mode" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1360 (define-abbrev-table 'ada-mode-abbrev-table ()) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1361 (setq local-abbrev-table ada-mode-abbrev-table) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1362 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1363 ;; Support for which-function mode |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1364 ;; which-function-mode does not work with nested subprograms, since it is |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1365 ;; based only on the regexps generated by imenu, and thus can only detect the |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1366 ;; beginning of subprograms, not the end. |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1367 ;; Fix is: redefine a new function ada-which-function, and call it when the |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1368 ;; major-mode is ada-mode. |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1369 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1370 (unless ada-xemacs |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1371 ;; This function do not require that we load which-func now. |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1372 ;; This can be done by the user if he decides to use which-func-mode |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1373 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1374 (defadvice which-function (around ada-which-function activate) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1375 "In Ada buffers, should work with overloaded subprograms, and does not |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1376 use imenu." |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1377 (if (equal major-mode 'ada-mode) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1378 (set 'ad-return-value (ada-which-function)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1379 ad-do-it)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1380 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1381 ;; So that we can activate which-func-modes for Ada mode |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1382 (if (and (boundp 'which-func-modes) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1383 (listp which-func-modes)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1384 (add-to-list 'which-func-modes 'ada-mode)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1385 ) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1386 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1387 ;; Support for indent-new-comment-line (Especially for XEmacs) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1388 (setq comment-multi-line nil) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1389 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1390 (setq major-mode 'ada-mode |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1391 mode-name "Ada") |
10705 | 1392 |
1393 (use-local-map ada-mode-map) | |
1394 | |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
1395 (easy-menu-add ada-mode-menu ada-mode-map) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1396 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1397 (set-syntax-table ada-mode-syntax-table) |
10705 | 1398 |
1399 (if ada-clean-buffer-before-saving | |
1400 (progn | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1401 ;; remove all spaces at the end of lines in the whole buffer. |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
1402 (add-hook 'local-write-file-hooks 'delete-trailing-whitespace) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1403 ;; convert all tabs to the correct number of spaces. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1404 (add-hook 'local-write-file-hooks |
28995
93c16141d107
(ada-mode, ada-create-case-exception): Don't quote lambdas.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26225
diff
changeset
|
1405 (lambda () (untabify (point-min) (point-max)))))) |
10705 | 1406 |
1407 (run-hooks 'ada-mode-hook) | |
1408 | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1409 ;; To be run after the hook, in case the user modified |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1410 ;; ada-fill-comment-prefix |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1411 (make-local-variable 'comment-start) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1412 (if ada-fill-comment-prefix |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1413 (set 'comment-start ada-fill-comment-prefix) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1414 (set 'comment-start "-- ")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1415 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1416 ;; Run this after the hook to give the users a chance to activate |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1417 ;; font-lock-mode |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1418 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1419 (unless ada-xemacs |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1420 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1421 (ada-initialize-properties) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1422 (make-local-hook 'font-lock-mode-hook) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1423 (add-hook 'font-lock-mode-hook 'ada-deactivate-properties nil t))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1424 |
10705 | 1425 ;; the following has to be done after running the ada-mode-hook |
1426 ;; because users might want to set the values of these variable | |
1427 ;; inside the hook (MH) | |
1428 | |
1429 (cond ((eq ada-language-version 'ada83) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1430 (setq ada-keywords ada-83-keywords)) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1431 ((eq ada-language-version 'ada95) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1432 (setq ada-keywords ada-95-keywords))) |
10705 | 1433 |
1434 (if ada-auto-case | |
1435 (ada-activate-keys-for-case))) | |
1436 | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1437 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1438 ;; transient-mark-mode and mark-active are not defined in XEmacs |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1439 (defun ada-region-selected () |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1440 "t if a region has been selected by the user and is still active." |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1441 (or (and ada-xemacs (funcall (symbol-function 'region-active-p))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1442 (and (not ada-xemacs) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1443 (symbol-value 'transient-mark-mode) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1444 (symbol-value 'mark-active)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1445 |
10705 | 1446 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1447 ;;----------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1448 ;; auto-casing |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1449 ;; Since Ada is case-insensitive, the Ada-mode provides an extensive set of |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1450 ;; functions to auto-case identifiers, keywords, ... |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1451 ;; The basic rules for autocasing are defined through the variables |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1452 ;; `ada-case-attribute', `ada-case-keyword' and `ada-case-identifier'. These |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1453 ;; are references to the functions that will do the actual casing. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1454 ;; |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1455 ;; However, in most cases, the user will want to define some exceptions to |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1456 ;; these casing rules. This is done through a list of files, that contain |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1457 ;; one word per line. These files are stored in `ada-case-exception-file'. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1458 ;; For backward compatibility, this variable can also be a string. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1459 ;;----------------------------------------------------------------- |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1460 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1461 (defun ada-save-exceptions-to-file (file-name) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1462 "Save the exception lists `ada-case-exception' and |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1463 `ada-case-exception-substring' to the file FILE-NAME." |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1464 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1465 ;; Save the list in the file |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1466 (find-file (expand-file-name file-name)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1467 (erase-buffer) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1468 (mapcar (lambda (x) (insert (car x) "\n")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1469 (sort (copy-sequence ada-case-exception) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1470 (lambda(a b) (string< (car a) (car b))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1471 (mapcar (lambda (x) (insert "*" (car x) "\n")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1472 (sort (copy-sequence ada-case-exception-substring) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1473 (lambda(a b) (string< (car a) (car b))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1474 (save-buffer) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1475 (kill-buffer nil) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1476 ) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1477 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1478 (defun ada-create-case-exception (&optional word) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1479 "Defines WORD as an exception for the casing system. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1480 If WORD is not given, then the current word in the buffer is used instead. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1481 The new words is added to the first file in `ada-case-exception-file'. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1482 The standard casing rules will no longer apply to this word." |
10705 | 1483 (interactive) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1484 (let ((previous-syntax-table (syntax-table)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1485 file-name |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1486 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1487 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1488 (cond ((stringp ada-case-exception-file) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1489 (setq file-name ada-case-exception-file)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1490 ((listp ada-case-exception-file) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1491 (setq file-name (car ada-case-exception-file))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1492 (t |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1493 (error (concat "No exception file specified. " |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1494 "See variable ada-case-exception-file.")))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1495 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1496 (set-syntax-table ada-mode-symbol-syntax-table) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1497 (unless word |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1498 (save-excursion |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1499 (skip-syntax-backward "w") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1500 (setq word (buffer-substring-no-properties |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1501 (point) (save-excursion (forward-word 1) (point)))))) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1502 (set-syntax-table previous-syntax-table) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1503 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1504 ;; Reread the exceptions file, in case it was modified by some other, |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1505 (ada-case-read-exceptions-from-file file-name) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1506 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1507 ;; If the word is already in the list, even with a different casing |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1508 ;; we simply want to replace it. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1509 (if (and (not (equal ada-case-exception '())) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1510 (assoc-ignore-case word ada-case-exception)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1511 (setcar (assoc-ignore-case word ada-case-exception) word) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1512 (add-to-list 'ada-case-exception (cons word t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1513 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1514 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1515 (ada-save-exceptions-to-file file-name) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1516 )) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1517 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1518 (defun ada-create-case-exception-substring (&optional word) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1519 "Defines the substring WORD as an exception for the casing system. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1520 If WORD is not given, then the current word in the buffer is used instead, |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1521 or the selected region if any is active. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1522 The new words is added to the first file in `ada-case-exception-file'. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1523 When auto-casing a word, this substring will be special-cased, unless the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1524 word itself has a special casing." |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1525 (interactive) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1526 (let ((file-name |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1527 (cond ((stringp ada-case-exception-file) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1528 ada-case-exception-file) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1529 ((listp ada-case-exception-file) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1530 (car ada-case-exception-file)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1531 (t |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1532 (error (concat "No exception file specified. " |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1533 "See variable ada-case-exception-file.")))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1534 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1535 ;; Find the substring to define as an exception. Order is: the parameter, |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1536 ;; if any, or the selected region, or the word under the cursor |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1537 (cond |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1538 (word nil) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1539 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1540 ((ada-region-selected) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1541 (setq word (buffer-substring-no-properties |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1542 (region-beginning) (region-end)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1543 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1544 (t |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1545 (let ((underscore-syntax (char-syntax ?_))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1546 (unwind-protect |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1547 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1548 (modify-syntax-entry ?_ "." (syntax-table)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1549 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1550 (skip-syntax-backward "w") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1551 (set 'word (buffer-substring-no-properties |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1552 (point) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1553 (save-excursion (forward-word 1) (point)))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1554 (modify-syntax-entry ?_ (make-string 1 underscore-syntax) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1555 (syntax-table)))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1556 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1557 ;; Reread the exceptions file, in case it was modified by some other, |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1558 (ada-case-read-exceptions-from-file file-name) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1559 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1560 ;; If the word is already in the list, even with a different casing |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1561 ;; we simply want to replace it. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1562 (if (and (not (equal ada-case-exception-substring '())) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1563 (assoc-ignore-case word ada-case-exception-substring)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1564 (setcar (assoc-ignore-case word ada-case-exception-substring) word) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1565 (add-to-list 'ada-case-exception-substring (cons word t)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1566 ) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1567 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1568 (ada-save-exceptions-to-file file-name) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1569 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1570 (message (concat "Defining " word " as a casing exception")))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1571 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1572 (defun ada-case-read-exceptions-from-file (file-name) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1573 "Read the content of the casing exception file FILE-NAME." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1574 (if (file-readable-p (expand-file-name file-name)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1575 (let ((buffer (current-buffer))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1576 (find-file (expand-file-name file-name)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1577 (set-syntax-table ada-mode-symbol-syntax-table) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1578 (widen) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1579 (goto-char (point-min)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1580 (while (not (eobp)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1581 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1582 ;; If the item is already in the list, even with an other casing, |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1583 ;; do not add it again. This way, the user can easily decide which |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1584 ;; priority should be applied to each casing exception |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1585 (let ((word (buffer-substring-no-properties |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1586 (point) (save-excursion (forward-word 1) (point))))) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1587 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1588 ;; Handling a substring ? |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1589 (if (char-equal (string-to-char word) ?*) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1590 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1591 (setq word (substring word 1)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1592 (unless (assoc-ignore-case word ada-case-exception-substring) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1593 (add-to-list 'ada-case-exception-substring (cons word t)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1594 (unless (assoc-ignore-case word ada-case-exception) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1595 (add-to-list 'ada-case-exception (cons word t))))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1596 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1597 (forward-line 1)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1598 (kill-buffer nil) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1599 (set-buffer buffer))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1600 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1601 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1602 (defun ada-case-read-exceptions () |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1603 "Read all the casing exception files from `ada-case-exception-file'." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1604 (interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1605 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1606 ;; Reinitialize the casing exception list |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1607 (setq ada-case-exception '() |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1608 ada-case-exception-substring '()) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1609 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1610 (cond ((stringp ada-case-exception-file) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1611 (ada-case-read-exceptions-from-file ada-case-exception-file)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1612 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1613 ((listp ada-case-exception-file) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1614 (mapcar 'ada-case-read-exceptions-from-file |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1615 ada-case-exception-file)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1616 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1617 (defun ada-adjust-case-substring () |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1618 "Adjust case of substrings in the previous word." |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1619 (interactive) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1620 (let ((substrings ada-case-exception-substring) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1621 (max (point)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1622 (case-fold-search t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1623 (underscore-syntax (char-syntax ?_)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1624 re) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1625 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1626 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1627 (forward-word -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1628 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1629 (unwind-protect |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1630 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1631 (modify-syntax-entry ?_ "." (syntax-table)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1632 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1633 (while substrings |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1634 (setq re (concat "\\b" (regexp-quote (caar substrings)) "\\b")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1635 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1636 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1637 (while (re-search-forward re max t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1638 (replace-match (caar substrings)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1639 (setq substrings (cdr substrings)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1640 ) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1641 ) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1642 (modify-syntax-entry ?_ (make-string 1 underscore-syntax) (syntax-table))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1643 ))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1644 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1645 (defun ada-adjust-case-identifier () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1646 "Adjust case of the previous identifier. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1647 The auto-casing is done according to the value of `ada-case-identifier' and |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1648 the exceptions defined in `ada-case-exception-file'." |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1649 (interactive) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1650 (if (or (equal ada-case-exception '()) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1651 (equal (char-after) ?_)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1652 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1653 (funcall ada-case-identifier -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1654 (ada-adjust-case-substring)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1655 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1656 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1657 (let ((end (point)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1658 (start (save-excursion (skip-syntax-backward "w") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1659 (point))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1660 match) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1661 ;; If we have an exception, replace the word by the correct casing |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1662 (if (setq match (assoc-ignore-case (buffer-substring start end) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1663 ada-case-exception)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1664 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1665 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1666 (delete-region start end) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1667 (insert (car match))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1668 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1669 ;; Else simply re-case the word |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1670 (funcall ada-case-identifier -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1671 (ada-adjust-case-substring)))))) |
10705 | 1672 |
1673 (defun ada-after-keyword-p () | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1674 "Returns t if cursor is after a keyword that is not an attribute." |
10705 | 1675 (save-excursion |
1676 (forward-word -1) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1677 (and (not (and (char-before) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1678 (or (= (char-before) ?_) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1679 (= (char-before) ?'))));; unless we have a _ or ' |
10705 | 1680 (looking-at (concat ada-keywords "[^_]"))))) |
1681 | |
1682 (defun ada-adjust-case (&optional force-identifier) | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
1683 "Adjust the case of the word before the just typed character. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1684 If FORCE-IDENTIFIER is non-nil then also adjust keyword as identifier." |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1685 (if (not (bobp)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1686 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1687 (forward-char -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1688 (if (and (not (bobp)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1689 ;; or if at the end of a character constant |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1690 (not (and (eq (following-char) ?') |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1691 (eq (char-before (1- (point))) ?'))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1692 ;; or if the previous character was not part of a word |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1693 (eq (char-syntax (char-before)) ?w) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1694 ;; if in a string or a comment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1695 (not (ada-in-string-or-comment-p)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1696 ) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1697 (if (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1698 (forward-word -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1699 (or (= (point) (point-min)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1700 (backward-char 1)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1701 (= (following-char) ?')) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1702 (funcall ada-case-attribute -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1703 (if (and |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1704 (not force-identifier) ; (MH) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1705 (ada-after-keyword-p)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1706 (funcall ada-case-keyword -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1707 (ada-adjust-case-identifier)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1708 (forward-char 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
1709 )) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1710 ) |
10705 | 1711 |
1712 (defun ada-adjust-case-interactive (arg) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1713 "Adjust the case of the previous word, and process the character just typed. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1714 ARG is the prefix the user entered with \C-u." |
10705 | 1715 (interactive "P") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1716 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1717 (if ada-auto-case |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1718 (let ((lastk last-command-char) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1719 (previous-syntax-table (syntax-table))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1720 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1721 (unwind-protect |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1722 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1723 (set-syntax-table ada-mode-symbol-syntax-table) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1724 (cond ((or (eq lastk ?\n) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1725 (eq lastk ?\r)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1726 ;; horrible kludge |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1727 (insert " ") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1728 (ada-adjust-case) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1729 ;; horrible dekludge |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1730 (delete-backward-char 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1731 ;; some special keys and their bindings |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1732 (cond |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1733 ((eq lastk ?\n) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1734 (funcall ada-lfd-binding)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1735 ((eq lastk ?\r) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1736 (funcall ada-ret-binding)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1737 ((eq lastk ?\C-i) (ada-tab)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1738 ;; Else just insert the character |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1739 ((self-insert-command (prefix-numeric-value arg)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1740 ;; if there is a keyword in front of the underscore |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1741 ;; then it should be part of an identifier (MH) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1742 (if (eq lastk ?_) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1743 (ada-adjust-case t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1744 (ada-adjust-case)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1745 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1746 ;; Restore the syntax table |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1747 (set-syntax-table previous-syntax-table)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1748 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1749 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1750 ;; Else, no auto-casing |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1751 (cond |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1752 ((eq last-command-char ?\n) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1753 (funcall ada-lfd-binding)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1754 ((eq last-command-char ?\r) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1755 (funcall ada-ret-binding)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1756 (t |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1757 (self-insert-command (prefix-numeric-value arg)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1758 )) |
10705 | 1759 |
1760 (defun ada-activate-keys-for-case () | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1761 "Modifies the key bindings for all the keys that should readjust the casing." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1762 (interactive) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1763 ;; Save original key-bindings to allow swapping ret/lfd |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1764 ;; when casing is activated. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1765 ;; The 'or ...' is there to be sure that the value will not |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1766 ;; be changed again when Ada mode is called more than once |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1767 (or ada-ret-binding (setq ada-ret-binding (key-binding "\C-M"))) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1768 (or ada-lfd-binding (setq ada-lfd-binding (key-binding "\C-j"))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1769 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1770 ;; Call case modifying function after certain keys. |
10705 | 1771 (mapcar (function (lambda(key) (define-key |
1772 ada-mode-map | |
1773 (char-to-string key) | |
1774 'ada-adjust-case-interactive))) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1775 '( ?` ?_ ?# ?% ?& ?* ?( ?) ?- ?= ?+ |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1776 ?| ?\; ?: ?' ?\" ?< ?, ?. ?> ?/ ?\n 32 ?\r ))) |
10705 | 1777 |
1778 (defun ada-loose-case-word (&optional arg) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1779 "Upcase first letter and letters following `_' in the following word. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1780 No other letter is modified. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1781 ARG is ignored, and is there for compatibility with `capitalize-word' only." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1782 (interactive) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1783 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1784 (let ((end (save-excursion (skip-syntax-forward "w") (point))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1785 (first t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1786 (skip-syntax-backward "w") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1787 (while (and (or first (search-forward "_" end t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1788 (< (point) end)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1789 (and first |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1790 (setq first nil)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1791 (insert-char (upcase (following-char)) 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1792 (delete-char 1))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1793 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1794 (defun ada-no-auto-case (&optional arg) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1795 "Does nothing. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1796 This function can be used for the auto-casing variables in the ada-mode, to |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1797 adapt to unusal auto-casing schemes. Since it does nothing, you can for |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1798 instance use it for `ada-case-identifier' if you don't want any special |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1799 auto-casing for identifiers, whereas keywords have to be lower-cased. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1800 See also `ada-auto-case' to disable auto casing altogether." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1801 ) |
10705 | 1802 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1803 (defun ada-capitalize-word (&optional arg) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1804 "Upcase first letter and letters following '_', lower case other letters. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1805 ARG is ignored, and is there for compatibility with `capitalize-word' only." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1806 (interactive) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1807 (let ((end (save-excursion (skip-syntax-forward "w") (point))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1808 (begin (save-excursion (skip-syntax-backward "w") (point)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1809 (modify-syntax-entry ?_ "_") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1810 (capitalize-region begin end) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1811 (modify-syntax-entry ?_ "w"))) |
10705 | 1812 |
1813 (defun ada-adjust-case-region (from to) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1814 "Adjusts the case of all words in the region between FROM and TO. |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
1815 Attention: This function might take very long for big regions !" |
10705 | 1816 (interactive "*r") |
1817 (let ((begin nil) | |
1818 (end nil) | |
1819 (keywordp nil) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1820 (attribp nil) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1821 (previous-syntax-table (syntax-table))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1822 (message "Adjusting case ...") |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1823 (unwind-protect |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1824 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1825 (set-syntax-table ada-mode-symbol-syntax-table) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1826 (goto-char to) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1827 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1828 ;; loop: look for all identifiers, keywords, and attributes |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1829 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1830 (while (re-search-backward "\\<\\(\\sw+\\)\\>" from t) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1831 (setq end (match-end 1)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1832 (setq attribp |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1833 (and (> (point) from) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1834 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1835 (forward-char -1) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1836 (setq attribp (looking-at "'.[^']"))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1837 (or |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1838 ;; do nothing if it is a string or comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1839 (ada-in-string-or-comment-p) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1840 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1841 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1842 ;; get the identifier or keyword or attribute |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1843 ;; |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1844 (setq begin (point)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1845 (setq keywordp (looking-at ada-keywords)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1846 (goto-char end) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1847 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1848 ;; casing according to user-option |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1849 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1850 (if attribp |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1851 (funcall ada-case-attribute -1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1852 (if keywordp |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1853 (funcall ada-case-keyword -1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1854 (ada-adjust-case-identifier))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1855 (goto-char begin)))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1856 (message "Adjusting case ... Done")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1857 (set-syntax-table previous-syntax-table)))) |
10705 | 1858 |
1859 (defun ada-adjust-case-buffer () | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
1860 "Adjusts the case of all words in the whole buffer. |
10705 | 1861 ATTENTION: This function might take very long for big buffers !" |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1862 (interactive "*") |
10705 | 1863 (ada-adjust-case-region (point-min) (point-max))) |
1864 | |
1865 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1866 ;;-------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1867 ;; Format Parameter Lists |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1868 ;; Some special algorithms are provided to indent the parameter lists in |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1869 ;; subprogram declarations. This is done in two steps: |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1870 ;; - First parses the parameter list. The returned list has the following |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1871 ;; format: |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1872 ;; ( (<Param_Name> in? out? access? <Type_Name> <Default_Expression>) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1873 ;; ... ) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1874 ;; This is done in `ada-scan-paramlist'. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1875 ;; - Delete and recreate the parameter list in function |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1876 ;; `ada-insert-paramlist'. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1877 ;; Both steps are called from `ada-format-paramlist'. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1878 ;; Note: Comments inside the parameter list are lost. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1879 ;; The syntax has to be correct, or the reformating will fail. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1880 ;;-------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1881 |
10705 | 1882 (defun ada-format-paramlist () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1883 "Reformats the parameter list point is in." |
10705 | 1884 (interactive) |
1885 (let ((begin nil) | |
1886 (end nil) | |
1887 (delend nil) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1888 (paramlist nil) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1889 (previous-syntax-table (syntax-table))) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1890 (unwind-protect |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1891 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1892 (set-syntax-table ada-mode-symbol-syntax-table) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1893 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1894 ;; check if really inside parameter list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1895 (or (ada-in-paramlist-p) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1896 (error "not in parameter list")) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1897 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1898 ;; find start of current parameter-list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1899 (ada-search-ignore-string-comment |
12586
f8bbc7a3b87a
(ada-ident-re): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12053
diff
changeset
|
1900 (concat ada-subprog-start-re "\\|\\<body\\>" ) t nil) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1901 (down-list 1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1902 (backward-char 1) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1903 (setq begin (point)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1904 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1905 ;; find end of parameter-list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1906 (forward-sexp 1) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1907 (setq delend (point)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1908 (delete-char -1) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1909 (insert "\n") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1910 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1911 ;; find end of last parameter-declaration |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1912 (forward-comment -1000) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1913 (setq end (point)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1914 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1915 ;; build a list of all elements of the parameter-list |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1916 (setq paramlist (ada-scan-paramlist (1+ begin) end)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1917 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1918 ;; delete the original parameter-list |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1919 (delete-region begin delend) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1920 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1921 ;; insert the new parameter-list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1922 (goto-char begin) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1923 (ada-insert-paramlist paramlist)) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1924 |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1925 ;; restore syntax-table |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1926 (set-syntax-table previous-syntax-table) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
1927 ))) |
10705 | 1928 |
1929 (defun ada-scan-paramlist (begin end) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1930 "Scan the parameter list found in between BEGIN and END. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1931 Returns the equivalent internal parameter list." |
10705 | 1932 (let ((paramlist (list)) |
1933 (param (list)) | |
1934 (notend t) | |
1935 (apos nil) | |
1936 (epos nil) | |
1937 (semipos nil) | |
1938 (match-cons nil)) | |
1939 | |
1940 (goto-char begin) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
1941 |
10705 | 1942 ;; loop until end of last parameter |
1943 (while notend | |
1944 | |
1945 ;; find first character of parameter-declaration | |
1946 (ada-goto-next-non-ws) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1947 (setq apos (point)) |
10705 | 1948 |
1949 ;; find last character of parameter-declaration | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1950 (if (setq match-cons |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1951 (ada-search-ignore-string-comment "[ \t\n]*;" nil end t)) |
10705 | 1952 (progn |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1953 (setq epos (car match-cons)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1954 (setq semipos (cdr match-cons))) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1955 (setq epos end)) |
10705 | 1956 |
1957 ;; read name(s) of parameter(s) | |
1958 (goto-char apos) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1959 (looking-at "\\(\\(\\sw\\|[_, \t\n]\\)*\\(\\sw\\|_\\)\\)[ \t\n]*:[^=]") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1960 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1961 (setq param (list (match-string 1))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1962 (ada-search-ignore-string-comment ":" nil epos t 'search-forward) |
10705 | 1963 |
1964 ;; look for 'in' | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1965 (setq apos (point)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1966 (setq param |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1967 (append param |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1968 (list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1969 (consp |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1970 (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1971 "in" nil epos t 'word-search-forward))))) |
10705 | 1972 |
1973 ;; look for 'out' | |
1974 (goto-char apos) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1975 (setq param |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1976 (append param |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1977 (list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1978 (consp |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1979 (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1980 "out" nil epos t 'word-search-forward))))) |
10705 | 1981 |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
1982 ;; look for 'access' |
10705 | 1983 (goto-char apos) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
1984 (setq param |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1985 (append param |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1986 (list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1987 (consp |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1988 (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1989 "access" nil epos t 'word-search-forward))))) |
10705 | 1990 |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
1991 ;; skip 'in'/'out'/'access' |
10705 | 1992 (goto-char apos) |
1993 (ada-goto-next-non-ws) | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
1994 (while (looking-at "\\<\\(in\\|out\\|access\\)\\>") |
10705 | 1995 (forward-word 1) |
1996 (ada-goto-next-non-ws)) | |
1997 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
1998 ;; read type of parameter |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
1999 ;; We accept spaces in the name, since some software like Rose |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2000 ;; generates something like: "A : B 'Class" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2001 (looking-at "\\<\\(\\sw\\|[_.' \t]\\)+\\>") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2002 (setq param |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2003 (append param |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2004 (list (match-string 0)))) |
10705 | 2005 |
2006 ;; read default-expression, if there is one | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2007 (goto-char (setq apos (match-end 0))) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2008 (setq param |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2009 (append param |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2010 (list |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2011 (if (setq match-cons |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2012 (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2013 ":=" nil epos t 'search-forward)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2014 (buffer-substring (car match-cons) epos) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2015 nil)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2016 |
10705 | 2017 ;; add this parameter-declaration to the list |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2018 (setq paramlist (append paramlist (list param))) |
10705 | 2019 |
2020 ;; check if it was the last parameter | |
2021 (if (eq epos end) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2022 (setq notend nil) |
10705 | 2023 (goto-char semipos)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2024 ) |
10705 | 2025 (reverse paramlist))) |
2026 | |
2027 (defun ada-insert-paramlist (paramlist) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2028 "Inserts a formatted PARAMLIST in the buffer." |
10705 | 2029 (let ((i (length paramlist)) |
2030 (parlen 0) | |
2031 (typlen 0) | |
2032 (inp nil) | |
2033 (outp nil) | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
2034 (accessp nil) |
10705 | 2035 (column nil) |
2036 (firstcol nil)) | |
2037 | |
2038 ;; loop until last parameter | |
2039 (while (not (zerop i)) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2040 (setq i (1- i)) |
10705 | 2041 |
2042 ;; get max length of parameter-name | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2043 (setq parlen (max parlen (length (nth 0 (nth i paramlist))))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2044 |
10705 | 2045 ;; get max length of type-name |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2046 (setq typlen (max typlen (length (nth 4 (nth i paramlist))))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2047 |
10705 | 2048 ;; is there any 'in' ? |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2049 (setq inp (or inp (nth 1 (nth i paramlist)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2050 |
10705 | 2051 ;; is there any 'out' ? |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2052 (setq outp (or outp (nth 2 (nth i paramlist)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2053 |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
2054 ;; is there any 'access' ? |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2055 (setq accessp (or accessp (nth 3 (nth i paramlist)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2056 ) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2057 |
10705 | 2058 ;; does paramlist already start on a separate line ? |
2059 (if (save-excursion | |
2060 (re-search-backward "^.\\|[^ \t]" nil t) | |
2061 (looking-at "^.")) | |
2062 ;; yes => re-indent it | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2063 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2064 (ada-indent-current) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2065 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2066 (if (looking-at "\\(is\\|return\\)") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2067 (replace-match " \\1")))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2068 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2069 ;; no => insert it where we are after removing any whitespace |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2070 (fixup-whitespace) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2071 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2072 (cond |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2073 ((looking-at "[ \t]*\\(\n\\|;\\)") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2074 (replace-match "\\1")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2075 ((looking-at "[ \t]*\\(is\\|return\\)") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2076 (replace-match " \\1")))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2077 (insert " ")) |
10705 | 2078 |
2079 (insert "(") | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2080 (ada-indent-current) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2081 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2082 (setq firstcol (current-column)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2083 (setq i (length paramlist)) |
10705 | 2084 |
2085 ;; loop until last parameter | |
2086 (while (not (zerop i)) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2087 (setq i (1- i)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2088 (setq column firstcol) |
10705 | 2089 |
2090 ;; insert parameter-name, space and colon | |
2091 (insert (nth 0 (nth i paramlist))) | |
2092 (indent-to (+ column parlen 1)) | |
2093 (insert ": ") | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2094 (setq column (current-column)) |
10705 | 2095 |
2096 ;; insert 'in' or space | |
2097 (if (nth 1 (nth i paramlist)) | |
2098 (insert "in ") | |
2099 (if (and | |
2100 (or inp | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
2101 accessp) |
10705 | 2102 (not (nth 3 (nth i paramlist)))) |
2103 (insert " "))) | |
2104 | |
2105 ;; insert 'out' or space | |
2106 (if (nth 2 (nth i paramlist)) | |
2107 (insert "out ") | |
2108 (if (and | |
2109 (or outp | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
2110 accessp) |
10705 | 2111 (not (nth 3 (nth i paramlist)))) |
2112 (insert " "))) | |
2113 | |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
2114 ;; insert 'access' |
10705 | 2115 (if (nth 3 (nth i paramlist)) |
13231
fb78cec8e440
All doc strings changed to comply with standard Emacs conventions.
Richard M. Stallman <rms@gnu.org>
parents:
13160
diff
changeset
|
2116 (insert "access ")) |
10705 | 2117 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2118 (setq column (current-column)) |
10705 | 2119 |
2120 ;; insert type-name and, if necessary, space and default-expression | |
2121 (insert (nth 4 (nth i paramlist))) | |
2122 (if (nth 5 (nth i paramlist)) | |
2123 (progn | |
2124 (indent-to (+ column typlen 1)) | |
2125 (insert (nth 5 (nth i paramlist))))) | |
2126 | |
2127 ;; check if it was the last parameter | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2128 (if (zerop i) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2129 (insert ")") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2130 ;; no => insert ';' and newline and indent |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2131 (insert ";") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2132 (newline) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2133 (indent-to firstcol)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2134 ) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2135 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2136 ;; if anything follows, except semicolon, newline, is or return |
10705 | 2137 ;; put it in a new line and indent it |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2138 (unless (looking-at "[ \t]*\\(;\\|\n\\|is\\|return\\)") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2139 (ada-indent-newline-indent)) |
10705 | 2140 )) |
2141 | |
2142 | |
2143 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2144 ;;;---------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2145 ;; Indentation Engine |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2146 ;; All indentations are indicated as a two-element string: |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2147 ;; - position of reference in the buffer |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2148 ;; - offset to indent from this position (can also be a symbol or a list |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2149 ;; that are evaluated) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2150 ;; Thus the total indentation for a line is the column number of the reference |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2151 ;; position plus whatever value the evaluation of the second element provides. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2152 ;; This mechanism is used so that the ada-mode can "explain" how the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2153 ;; indentation was calculated, by showing which variables were used. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2154 ;; |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2155 ;; The indentation itself is done in only one pass: first we try to guess in |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2156 ;; what context we are by looking at the following keyword or punctuation |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2157 ;; sign. If nothing remarkable is found, just try to guess the indentation |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2158 ;; based on previous lines. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2159 ;; |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2160 ;; The relevant functions for indentation are: |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2161 ;; - `ada-indent-region': Re-indent a region of text |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2162 ;; - `ada-justified-indent-current': Re-indent the current line and shows the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2163 ;; calculation that were done |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2164 ;; - `ada-indent-current': Re-indent the current line |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2165 ;; - `ada-get-current-indent': Calculate the indentation for the current line, |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2166 ;; based on the context (see above). |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2167 ;; - `ada-get-indent-*': Calculate the indentation in a specific context. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2168 ;; For efficiency, these functions do not check they are in the correct |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2169 ;; context. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2170 ;;;---------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2171 |
10705 | 2172 (defun ada-indent-region (beg end) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2173 "Indent the region between BEG end END." |
10705 | 2174 (interactive "*r") |
2175 (goto-char beg) | |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
2176 (let ((block-done 0) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2177 (lines-remaining (count-lines beg end)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2178 (msg (format "%%4d out of %4d lines remaining ..." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2179 (count-lines beg end))) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
2180 (endmark (copy-marker end))) |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
2181 ;; catch errors while indenting |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2182 (while (< (point) endmark) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2183 (if (> block-done 39) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2184 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2185 (setq lines-remaining (- lines-remaining block-done) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2186 block-done 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2187 (message msg lines-remaining))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2188 (if (= (char-after) ?\n) nil |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2189 (ada-indent-current)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2190 (forward-line 1) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2191 (setq block-done (1+ block-done))) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
2192 (message "indenting ... done"))) |
10705 | 2193 |
2194 (defun ada-indent-newline-indent () | |
2195 "Indents the current line, inserts a newline and then indents the new line." | |
2196 (interactive "*") | |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
2197 (ada-indent-current) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
2198 (newline) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
2199 (ada-indent-current)) |
10705 | 2200 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2201 (defun ada-indent-newline-indent-conditional () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2202 "Insert a newline and indent it. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2203 The original line is indented first if `ada-indent-after-return' is non-nil. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2204 This function is intended to be bound to the \C-m and \C-j keys." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2205 (interactive "*") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2206 (if ada-indent-after-return (ada-indent-current)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2207 (newline) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2208 (ada-indent-current)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2209 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2210 (defun ada-justified-indent-current () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2211 "Indent the current line and explains how the calculation was done." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2212 (interactive) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2213 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2214 (let ((cur-indent (ada-indent-current))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2215 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2216 (let ((line (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2217 (goto-char (car cur-indent)) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2218 (count-lines 1 (point))))) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2219 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2220 (if (equal (cdr cur-indent) '(0)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2221 (message (concat "same indentation as line " (number-to-string line))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2222 (message (mapconcat (lambda(x) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2223 (cond |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2224 ((symbolp x) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2225 (symbol-name x)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2226 ((numberp x) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2227 (number-to-string x)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2228 ((listp x) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2229 (concat "- " (symbol-name (cadr x)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2230 )) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2231 (cdr cur-indent) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2232 " + ")))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2233 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2234 (goto-char (car cur-indent)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2235 (sit-for 1)))) |
10705 | 2236 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2237 (defun ada-batch-reformat () |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2238 "Re-indent and re-case all the files found on the command line. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2239 This function should be used from the Unix/Windows command line, with a |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2240 command like: |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2241 emacs -batch -l ada-mode -f ada-batch-reformat file1 file2 ..." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2242 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2243 (while command-line-args-left |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2244 (let ((source (car command-line-args-left))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2245 (message (concat "formating " source)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2246 (find-file source) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2247 (ada-indent-region (point-min) (point-max)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2248 (ada-adjust-case-buffer) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2249 (write-file source)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2250 (setq command-line-args-left (cdr command-line-args-left))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2251 (message "Done") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2252 (kill-emacs 0)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2253 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2254 (defsubst ada-goto-previous-word () |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2255 "Moves point to the beginning of the previous word of Ada code. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2256 Returns the new position of point or nil if not found." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2257 (ada-goto-next-word t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2258 |
10705 | 2259 (defun ada-indent-current () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2260 "Indent current line as Ada code. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2261 Returns the calculation that was done, including the reference point and the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2262 offset." |
10705 | 2263 (interactive) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2264 (let ((previous-syntax-table (syntax-table)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2265 (orgpoint (point-marker)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2266 cur-indent tmp-indent |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2267 prev-indent) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2268 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2269 (unwind-protect |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2270 (progn |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2271 (set-syntax-table ada-mode-symbol-syntax-table) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2272 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2273 ;; This need to be done here so that the advice is not always |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2274 ;; activated (this might interact badly with other modes) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2275 (if ada-xemacs |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2276 (ad-activate 'parse-partial-sexp t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2277 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2278 (save-excursion |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2279 (setq cur-indent |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2280 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2281 ;; Not First line in the buffer ? |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2282 (if (save-excursion (zerop (forward-line -1))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2283 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2284 (back-to-indentation) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2285 (ada-get-current-indent)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2286 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2287 ;; first line in the buffer |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2288 (list (point-min) 0)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2289 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2290 ;; Evaluate the list to get the column to indent to |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2291 ;; prev-indent contains the column to indent to |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2292 (if cur-indent |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2293 (setq prev-indent (save-excursion (goto-char (car cur-indent)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2294 (current-column)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2295 tmp-indent (cdr cur-indent)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2296 (setq prev-indent 0 tmp-indent '())) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2297 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2298 (while (not (null tmp-indent)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2299 (cond |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2300 ((numberp (car tmp-indent)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2301 (setq prev-indent (+ prev-indent (car tmp-indent)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2302 (t |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2303 (setq prev-indent (+ prev-indent (eval (car tmp-indent))))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2304 ) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2305 (setq tmp-indent (cdr tmp-indent))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2306 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2307 ;; only re-indent if indentation is different then the current |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2308 (if (= (save-excursion (back-to-indentation) (current-column)) prev-indent) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2309 nil |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2310 (beginning-of-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2311 (delete-horizontal-space) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2312 (indent-to prev-indent)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2313 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2314 ;; restore position of point |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2315 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2316 (goto-char orgpoint) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2317 (if (< (current-column) (current-indentation)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2318 (back-to-indentation))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2319 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2320 ;; restore syntax-table |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2321 (set-syntax-table previous-syntax-table) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2322 (if ada-xemacs |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2323 (ad-deactivate 'parse-partial-sexp)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2324 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2325 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2326 cur-indent |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2327 )) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2328 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2329 (defun ada-get-current-indent () |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2330 "Return the indentation to use for the current line." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2331 (let (column |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2332 pos |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2333 match-cons |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2334 result |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2335 (orgpoint (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2336 (beginning-of-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2337 (forward-comment -10000) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2338 (forward-line 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2339 (point)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2340 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2341 (setq result |
10705 | 2342 (cond |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2343 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2344 ;;----------------------------- |
10705 | 2345 ;; in open parenthesis, but not in parameter-list |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2346 ;;----------------------------- |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2347 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2348 ((and ada-indent-to-open-paren |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2349 (not (ada-in-paramlist-p)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2350 (setq column (ada-in-open-paren-p))) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2351 |
10705 | 2352 ;; check if we have something like this (Table_Component_Type => |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2353 ;; Source_File_Record) |
10705 | 2354 (save-excursion |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2355 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2356 ;; Align the closing parenthesis on the opening one |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2357 (if (= (following-char) ?\)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2358 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2359 (goto-char column) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2360 (skip-chars-backward " \t") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2361 (list (1- (point)) 0)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2362 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2363 (if (and (skip-chars-backward " \t") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2364 (= (char-before) ?\n) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2365 (not (forward-comment -10000)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2366 (= (char-before) ?>)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2367 ;; ??? Could use a different variable |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2368 (list column 'ada-broken-indent) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2369 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2370 ;; We want all continuation lines to be indented the same |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2371 ;; (ada-broken-line from the opening parenthesis. However, in |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2372 ;; parameter list, each new parameter should be indented at the |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2373 ;; column as the opening parenthesis. |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2374 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2375 ;; A special case to handle nested boolean expressions, as in |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2376 ;; ((B |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2377 ;; and then C) -- indented by ada-broken-indent |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2378 ;; or else D) -- indenting this line. |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2379 ;; ??? This is really a hack, we should have a proper way to go to |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2380 ;; ??? the beginning of the statement |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2381 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2382 (if (= (char-before) ?\)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2383 (backward-sexp)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2384 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2385 (if (memq (char-before) '(?, ?\; ?\( ?\))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2386 (list column 0) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2387 (list column 'ada-continuation-indent) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2388 ))))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2389 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2390 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2391 ;; at end of buffer |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2392 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2393 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2394 ((not (char-after)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2395 (ada-indent-on-previous-lines nil orgpoint orgpoint)) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2396 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2397 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2398 ;; starting with e |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2399 ;;--------------------------- |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2400 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2401 ((= (downcase (char-after)) ?e) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2402 (cond |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2403 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2404 ;; ------- end ------ |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2405 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2406 ((looking-at "end\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2407 (let ((label 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2408 limit) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2409 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2410 (ada-goto-matching-start 1) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2411 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2412 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2413 ;; found 'loop' => skip back to 'while' or 'for' |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2414 ;; if 'loop' is not on a separate line |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2415 ;; Stop the search for 'while' and 'for' when a ';' is encountered. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2416 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2417 (if (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2418 (beginning-of-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2419 (looking-at ".+\\<loop\\>")) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2420 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2421 (save-excursion |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2422 (setq limit (car (ada-search-ignore-string-comment ";" t)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2423 (if (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2424 (and |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2425 (setq match-cons |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2426 (ada-search-ignore-string-comment ada-loop-start-re t limit)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2427 (not (looking-at "\\<loop\\>")))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2428 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2429 (goto-char (car match-cons)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2430 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2431 (beginning-of-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2432 (if (looking-at ada-named-block-re) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2433 (setq label (- ada-label-indent)))))))) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2434 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2435 ;; found 'record' => |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2436 ;; if the keyword is found at the beginning of a line (or just |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2437 ;; after limited, we indent on it, otherwise we indent on the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2438 ;; beginning of the type declaration) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2439 ;; type A is (B : Integer; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2440 ;; C : Integer) is record |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2441 ;; end record; -- This is badly indented otherwise |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2442 (if (looking-at "record") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2443 (if (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2444 (beginning-of-line) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2445 (looking-at "^[ \t]*\\(record\\|limited record\\)")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2446 (list (save-excursion (back-to-indentation) (point)) 0) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2447 (list (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2448 (car (ada-search-ignore-string-comment "\\<type\\>" t))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2449 0)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2450 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2451 ;; Else keep the same indentation as the beginning statement |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2452 (list (+ (save-excursion (back-to-indentation) (point)) label) 0))))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2453 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2454 ;; ------ exception ---- |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2455 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2456 ((looking-at "exception\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2457 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2458 (ada-goto-matching-start 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2459 (list (save-excursion (back-to-indentation) (point)) 0))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2460 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2461 ;; else |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2462 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2463 ((looking-at "else\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2464 (if (save-excursion (ada-goto-previous-word) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2465 (looking-at "\\<or\\>")) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2466 (ada-indent-on-previous-lines nil orgpoint orgpoint) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2467 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2468 (ada-goto-matching-start 1 nil t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2469 (list (progn (back-to-indentation) (point)) 0)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2470 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2471 ;; elsif |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2472 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2473 ((looking-at "elsif\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2474 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2475 (ada-goto-matching-start 1 nil t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2476 (list (progn (back-to-indentation) (point)) 0))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2477 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2478 )) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2479 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2480 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2481 ;; starting with w (when) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2482 ;;--------------------------- |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2483 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2484 ((and (= (downcase (char-after)) ?w) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2485 (looking-at "when\\>")) |
10705 | 2486 (save-excursion |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2487 (ada-goto-matching-start 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2488 (list (save-excursion (back-to-indentation) (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2489 'ada-when-indent))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2490 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2491 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2492 ;; starting with t (then) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2493 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2494 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2495 ((and (= (downcase (char-after)) ?t) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2496 (looking-at "then\\>")) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2497 (if (save-excursion (ada-goto-previous-word) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2498 (looking-at "and\\>")) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2499 (ada-indent-on-previous-lines nil orgpoint orgpoint) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2500 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2501 ;; Select has been added for the statement: "select ... then abort" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2502 (ada-search-ignore-string-comment |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2503 "\\<\\(elsif\\|if\\|select\\)\\>" t nil) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2504 (list (progn (back-to-indentation) (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2505 'ada-stmt-end-indent)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2506 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2507 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2508 ;; starting with l (loop) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2509 ;;--------------------------- |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2510 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2511 ((and (= (downcase (char-after)) ?l) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2512 (looking-at "loop\\>")) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2513 (setq pos (point)) |
10705 | 2514 (save-excursion |
2515 (goto-char (match-end 0)) | |
2516 (ada-goto-stmt-start) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2517 (if (looking-at "\\<\\(loop\\|if\\)\\>") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2518 (ada-indent-on-previous-lines nil orgpoint orgpoint) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2519 (unless (looking-at ada-loop-start-re) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2520 (ada-search-ignore-string-comment ada-loop-start-re |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2521 nil pos)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2522 (if (looking-at "\\<loop\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2523 (ada-indent-on-previous-lines nil orgpoint orgpoint) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2524 (list (progn (back-to-indentation) (point)) 'ada-stmt-end-indent))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2525 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2526 ;;---------------------------- |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2527 ;; starting with l (limited) or r (record) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2528 ;;---------------------------- |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2529 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2530 ((or (and (= (downcase (char-after)) ?l) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2531 (looking-at "limited\\>")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2532 (and (= (downcase (char-after)) ?r) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2533 (looking-at "record\\>"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2534 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2535 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2536 (ada-search-ignore-string-comment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2537 "\\<\\(type\\|use\\)\\>" t nil) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2538 (if (looking-at "\\<use\\>") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2539 (ada-search-ignore-string-comment "for" t nil nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2540 'word-search-backward)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2541 (list (progn (back-to-indentation) (point)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2542 'ada-indent-record-rel-type))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2543 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2544 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2545 ;; starting with b (begin) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2546 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2547 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2548 ((and (= (downcase (char-after)) ?b) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2549 (looking-at "begin\\>")) |
10705 | 2550 (save-excursion |
2551 (if (ada-goto-matching-decl-start t) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2552 (list (progn (back-to-indentation) (point)) 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2553 (ada-indent-on-previous-lines nil orgpoint orgpoint)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2554 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2555 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2556 ;; starting with i (is) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2557 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2558 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2559 ((and (= (downcase (char-after)) ?i) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2560 (looking-at "is\\>")) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2561 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2562 (if (and ada-indent-is-separate |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2563 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2564 (goto-char (match-end 0)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2565 (ada-goto-next-non-ws (save-excursion (end-of-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2566 (point))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2567 (looking-at "\\<abstract\\>\\|\\<separate\\>"))) |
10705 | 2568 (save-excursion |
2569 (ada-goto-stmt-start) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2570 (list (progn (back-to-indentation) (point)) 'ada-indent)) |
10705 | 2571 (save-excursion |
2572 (ada-goto-stmt-start) | |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2573 (if (looking-at "\\<package\\|procedure\\|function\\>") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2574 (list (progn (back-to-indentation) (point)) 0) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2575 (list (progn (back-to-indentation) (point)) 'ada-indent))))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2576 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2577 ;;--------------------------- |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2578 ;; starting with r (return, renames) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2579 ;;--------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2580 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2581 ((and (= (downcase (char-after)) ?r) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2582 (looking-at "re\\(turn\\|names\\)\\>")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2583 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2584 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2585 (let ((var 'ada-indent-return)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2586 ;; If looking at a renames, skip the 'return' statement too |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2587 (if (looking-at "renames") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2588 (let (pos) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2589 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2590 (set 'pos (ada-search-ignore-string-comment ";\\|return\\>" t))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2591 (if (and pos |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2592 (= (downcase (char-after (car pos))) ?r)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2593 (goto-char (car pos))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2594 (set 'var 'ada-indent-renames))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2595 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2596 (forward-comment -1000) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2597 (if (= (char-before) ?\)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2598 (forward-sexp -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2599 (forward-word -1)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2600 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2601 ;; If there is a parameter list, and we have a function declaration |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2602 ;; or a access to subprogram declaration |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2603 (let ((num-back 1)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2604 (if (and (= (following-char) ?\() |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2605 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2606 (or (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2607 (backward-word 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2608 (looking-at "\\(function\\|procedure\\)\\>")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2609 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2610 (backward-word 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2611 (set 'num-back 2) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2612 (looking-at "\\(function\\|procedure\\)\\>"))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2613 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2614 ;; The indentation depends of the value of ada-indent-return |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2615 (if (<= (eval var) 0) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2616 (list (point) (list '- var)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2617 (list (progn (backward-word num-back) (point)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2618 var)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2619 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2620 ;; Else there is no parameter list, but we have a function |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2621 ;; Only do something special if the user want to indent |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2622 ;; relative to the "function" keyword |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2623 (if (and (> (eval var) 0) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2624 (save-excursion (forward-word -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2625 (looking-at "function\\>"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2626 (list (progn (forward-word -1) (point)) var) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2627 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2628 ;; Else... |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2629 (ada-indent-on-previous-lines nil orgpoint orgpoint))))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2630 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2631 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2632 ;; starting with 'o' or 'p' |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2633 ;; 'or' as statement-start |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2634 ;; 'private' as statement-start |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2635 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2636 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2637 ((and (or (= (downcase (char-after)) ?o) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2638 (= (downcase (char-after)) ?p)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2639 (or (ada-looking-at-semi-or) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2640 (ada-looking-at-semi-private))) |
10705 | 2641 (save-excursion |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2642 ;; ??? Wasn't this done already in ada-looking-at-semi-or ? |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2643 (ada-goto-matching-start 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2644 (list (progn (back-to-indentation) (point)) 0))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2645 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2646 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2647 ;; starting with 'd' (do) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2648 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2649 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2650 ((and (= (downcase (char-after)) ?d) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2651 (looking-at "do\\>")) |
10705 | 2652 (save-excursion |
2653 (ada-goto-stmt-start) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2654 (list (progn (back-to-indentation) (point)) 'ada-stmt-end-indent))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2655 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2656 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2657 ;; starting with '-' (comment) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2658 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2659 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2660 ((= (char-after) ?-) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2661 (if ada-indent-comment-as-code |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2662 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2663 ;; Indent comments on previous line comments if required |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2664 ;; We must use a search-forward (even if the code is more complex), |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2665 ;; since we want to find the beginning of the comment. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2666 (let (pos) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2667 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2668 (if (and ada-indent-align-comments |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2669 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2670 (forward-line -1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2671 (beginning-of-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2672 (while (and (not pos) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2673 (search-forward "--" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2674 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2675 (end-of-line) (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2676 t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2677 (unless (ada-in-string-p) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2678 (setq pos (point)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2679 pos)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2680 (list (- pos 2) 0) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2681 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2682 ;; Else always on previous line |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2683 (ada-indent-on-previous-lines nil orgpoint orgpoint))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2684 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2685 ;; Else same indentation as the previous line |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2686 (list (save-excursion (back-to-indentation) (point)) 0))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2687 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2688 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2689 ;; starting with '#' (preprocessor line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2690 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2691 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2692 ((and (= (char-after) ?#) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2693 (equal ada-which-compiler 'gnat) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2694 (looking-at "#[ \t]*\\(if\\|els\\(e\\|if\\)\\|end[ \t]*if\\)")) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2695 (list (save-excursion (beginning-of-line) (point)) 0)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2696 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2697 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2698 ;; starting with ')' (end of a parameter list) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2699 ;;-------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2700 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2701 ((and (not (eobp)) (= (char-after) ?\))) |
10705 | 2702 (save-excursion |
2703 (forward-char 1) | |
2704 (backward-sexp 1) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2705 (list (point) 0))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2706 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2707 ;;--------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2708 ;; new/abstract/separate |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2709 ;;--------------------------------- |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2710 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2711 ((looking-at "\\(new\\|abstract\\|separate\\)\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2712 (ada-indent-on-previous-lines nil orgpoint orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2713 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2714 ;;--------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2715 ;; package/function/procedure |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2716 ;;--------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2717 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2718 ((and (or (= (downcase (char-after)) ?p) (= (downcase (char-after)) ?f)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2719 (looking-at "\\<\\(package\\|function\\|procedure\\)\\>")) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2720 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2721 ;; Go up until we find either a generic section, or the end of the |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2722 ;; previous subprogram/package |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2723 (let (found) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2724 (while (and (not found) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2725 (ada-search-ignore-string-comment |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2726 "\\<\\(generic\\|end\\|begin\\|package\\|procedure\\|function\\)\\>" t)) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2727 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2728 ;; avoid "with procedure"... in generic parts |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2729 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2730 (forward-word -1) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2731 (setq found (not (looking-at "with")))))) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2732 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2733 (if (looking-at "generic") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2734 (list (progn (back-to-indentation) (point)) 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2735 (ada-indent-on-previous-lines nil orgpoint orgpoint)))) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2736 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2737 ;;--------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2738 ;; label |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2739 ;;--------------------------------- |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
2740 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2741 ((looking-at "\\(\\sw\\|_\\)+[ \t\n]*:[^=]") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2742 (if (ada-in-decl-p) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2743 (ada-indent-on-previous-lines nil orgpoint orgpoint) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2744 (append (ada-indent-on-previous-lines nil orgpoint orgpoint) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2745 '(ada-label-indent)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2746 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2747 )) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2748 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2749 ;;--------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2750 ;; Other syntaxes |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2751 ;;--------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2752 (or result (ada-indent-on-previous-lines nil orgpoint orgpoint)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2753 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2754 (defun ada-indent-on-previous-lines (&optional nomove orgpoint initial-pos) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2755 "Calculate the indentation for the new line after ORGPOINT. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2756 The result list is based on the previous lines in the buffer. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2757 If NOMOVE is nil, moves point to the beginning of the current statement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2758 if INITIAL-POS is non-nil, moves point to INITIAL-POS before calculation." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2759 (if initial-pos |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2760 (goto-char initial-pos)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2761 (let ((oldpoint (point))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2762 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2763 ;; Is inside a parameter-list ? |
10705 | 2764 (if (ada-in-paramlist-p) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2765 (ada-get-indent-paramlist) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2766 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2767 ;; move to beginning of current statement |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2768 (unless nomove |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2769 (ada-goto-stmt-start)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2770 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2771 ;; no beginning found => don't change indentation |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2772 (if (and (eq oldpoint (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2773 (not nomove)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2774 (ada-get-indent-nochange) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2775 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2776 (cond |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2777 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2778 ((and |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2779 ada-indent-to-open-paren |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2780 (ada-in-open-paren-p)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2781 (ada-get-indent-open-paren)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2782 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2783 ((looking-at "end\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2784 (ada-get-indent-end orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2785 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2786 ((looking-at ada-loop-start-re) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2787 (ada-get-indent-loop orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2788 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2789 ((looking-at ada-subprog-start-re) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2790 (ada-get-indent-subprog orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2791 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2792 ((looking-at ada-block-start-re) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2793 (ada-get-indent-block-start orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2794 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2795 ((looking-at "\\(sub\\)?type\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2796 (ada-get-indent-type orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2797 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2798 ;; "then" has to be included in the case of "select...then abort" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2799 ;; statements, since (goto-stmt-start) at the beginning of |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2800 ;; the current function would leave the cursor on that position |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2801 ((looking-at "\\(\\(els\\)?if\\>\\)\\|then abort\\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2802 (ada-get-indent-if orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2803 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2804 ((looking-at "case\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2805 (ada-get-indent-case orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2806 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2807 ((looking-at "when\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2808 (ada-get-indent-when orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2809 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2810 ((looking-at "\\(\\sw\\|_\\)+[ \t\n]*:[^=]") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2811 (ada-get-indent-label orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2812 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2813 ((looking-at "separate\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2814 (ada-get-indent-nochange)) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2815 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2816 ;; A label |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2817 ((looking-at "<<") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2818 (list (+ (save-excursion (back-to-indentation) (point)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2819 (- ada-label-indent)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
2820 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2821 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2822 ((looking-at "with\\>\\|use\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2823 ;; Are we still in that statement, or are we in fact looking at |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2824 ;; the previous one ? |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2825 (if (save-excursion (search-forward ";" oldpoint t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2826 (list (progn (back-to-indentation) (point)) 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2827 (list (point) (if (looking-at "with") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2828 'ada-with-indent |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2829 'ada-use-indent)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2830 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2831 (t |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2832 (ada-get-indent-noindent orgpoint))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2833 )) |
10705 | 2834 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2835 (defun ada-get-indent-open-paren () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2836 "Calculates the indentation when point is behind an unclosed parenthesis." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2837 (list (ada-in-open-paren-p) 0)) |
10705 | 2838 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2839 (defun ada-get-indent-nochange () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2840 "Return the current indentation of the previous line." |
10705 | 2841 (save-excursion |
2842 (forward-line -1) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2843 (back-to-indentation) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2844 (list (point) 0))) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2845 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2846 (defun ada-get-indent-paramlist () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2847 "Calculates the indentation when point is inside a parameter list." |
10705 | 2848 (save-excursion |
2849 (ada-search-ignore-string-comment "[^ \t\n]" t nil t) | |
2850 (cond | |
2851 ;; in front of the first parameter | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2852 ((= (char-after) ?\() |
10705 | 2853 (goto-char (match-end 0)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2854 (list (point) 0)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2855 |
10705 | 2856 ;; in front of another parameter |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2857 ((= (char-after) ?\;) |
10705 | 2858 (goto-char (cdr (ada-search-ignore-string-comment "(\\|;" t nil t))) |
2859 (ada-goto-next-non-ws) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2860 (list (point) 0)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2861 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2862 ;; After an affectation (default parameter value in subprogram |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2863 ;; declaration) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2864 ((and (= (following-char) ?=) (= (preceding-char) ?:)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2865 (back-to-indentation) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2866 (list (point) 'ada-broken-indent)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2867 |
10705 | 2868 ;; inside a parameter declaration |
2869 (t | |
2870 (goto-char (cdr (ada-search-ignore-string-comment "(\\|;" t nil t))) | |
2871 (ada-goto-next-non-ws) | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2872 (list (point) 0))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2873 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2874 (defun ada-get-indent-end (orgpoint) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2875 "Calculates the indentation when point is just before an end_statement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2876 ORGPOINT is the limit position used in the calculation." |
10705 | 2877 (let ((defun-name nil) |
2878 (indent nil)) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2879 |
10705 | 2880 ;; is the line already terminated by ';' ? |
2881 (if (save-excursion | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2882 (ada-search-ignore-string-comment ";" nil orgpoint nil |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2883 'search-forward)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2884 |
10705 | 2885 ;; yes, look what's following 'end' |
2886 (progn | |
2887 (forward-word 1) | |
2888 (ada-goto-next-non-ws) | |
2889 (cond | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2890 ((looking-at "\\<\\(loop\\|select\\|if\\|case\\)\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2891 (save-excursion (ada-check-matching-start (match-string 0))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2892 (list (save-excursion (back-to-indentation) (point)) 0)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2893 |
10705 | 2894 ;; |
2895 ;; loop/select/if/case/record/select | |
2896 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2897 ((looking-at "\\<record\\>") |
10705 | 2898 (save-excursion |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2899 (ada-check-matching-start (match-string 0)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2900 ;; we are now looking at the matching "record" statement |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2901 (forward-word 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2902 (ada-goto-stmt-start) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2903 ;; now on the matching type declaration, or use clause |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2904 (unless (looking-at "\\(for\\|type\\)\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2905 (ada-search-ignore-string-comment "\\<type\\>" t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2906 (list (progn (back-to-indentation) (point)) 0))) |
10705 | 2907 ;; |
2908 ;; a named block end | |
2909 ;; | |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
2910 ((looking-at ada-ident-re) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2911 (setq defun-name (match-string 0)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2912 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2913 (ada-goto-matching-start 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2914 (ada-check-defun-name defun-name)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2915 (list (progn (back-to-indentation) (point)) 0)) |
10705 | 2916 ;; |
2917 ;; a block-end without name | |
2918 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2919 ((= (char-after) ?\;) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2920 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2921 (ada-goto-matching-start 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2922 (if (looking-at "\\<begin\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2923 (progn |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2924 (setq indent (list (point) 0)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2925 (if (ada-goto-matching-decl-start t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2926 (list (progn (back-to-indentation) (point)) 0) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2927 indent)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2928 (list (progn (back-to-indentation) (point)) 0) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
2929 ))) |
10705 | 2930 ;; |
2931 ;; anything else - should maybe signal an error ? | |
2932 ;; | |
2933 (t | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2934 (list (save-excursion (back-to-indentation) (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2935 'ada-broken-indent)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2936 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2937 (list (save-excursion (back-to-indentation) (point)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2938 'ada-broken-indent)))) |
10705 | 2939 |
2940 (defun ada-get-indent-case (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2941 "Calculates the indentation when point is just before a case statement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2942 ORGPOINT is the limit position used in the calculation." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2943 (let ((match-cons nil) |
10705 | 2944 (opos (point))) |
2945 (cond | |
2946 ;; | |
2947 ;; case..is..when..=> | |
2948 ;; | |
2949 ((save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2950 (setq match-cons (and |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
2951 ;; the `=>' must be after the keyword `is'. |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
2952 (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2953 "is" nil orgpoint nil 'word-search-forward) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
2954 (ada-search-ignore-string-comment |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
2955 "[ \t\n]+=>" nil orgpoint)))) |
10705 | 2956 (save-excursion |
2957 (goto-char (car match-cons)) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2958 (unless (ada-search-ignore-string-comment "when" t opos) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2959 (error "missing 'when' between 'case' and '=>'")) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2960 (list (save-excursion (back-to-indentation) (point)) 'ada-indent))) |
10705 | 2961 ;; |
2962 ;; case..is..when | |
2963 ;; | |
2964 ((save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2965 (setq match-cons (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2966 "when" nil orgpoint nil 'word-search-forward))) |
10705 | 2967 (goto-char (cdr match-cons)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2968 (list (save-excursion (back-to-indentation) (point)) 'ada-broken-indent)) |
10705 | 2969 ;; |
2970 ;; case..is | |
2971 ;; | |
2972 ((save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2973 (setq match-cons (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2974 "is" nil orgpoint nil 'word-search-forward))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2975 (list (save-excursion (back-to-indentation) (point)) 'ada-when-indent)) |
10705 | 2976 ;; |
2977 ;; incomplete case | |
2978 ;; | |
2979 (t | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2980 (list (save-excursion (back-to-indentation) (point)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2981 'ada-broken-indent))))) |
10705 | 2982 |
2983 (defun ada-get-indent-when (orgpoint) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2984 "Calculates the indentation when point is just before a when statement. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2985 ORGPOINT is the limit position used in the calculation." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2986 (let ((cur-indent (save-excursion (back-to-indentation) (point)))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2987 (if (ada-search-ignore-string-comment "[ \t\n]*=>" nil orgpoint) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
2988 (list cur-indent 'ada-indent) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2989 (list cur-indent 'ada-broken-indent)))) |
10705 | 2990 |
2991 (defun ada-get-indent-if (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2992 "Calculates the indentation when point is just before an if statement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
2993 ORGPOINT is the limit position used in the calculation." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2994 (let ((cur-indent (save-excursion (back-to-indentation) (point))) |
10705 | 2995 (match-cons nil)) |
2996 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
2997 ;; Move to the correct then (ignore all "and then") |
10705 | 2998 ;; |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
2999 (while (and (setq match-cons (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3000 "\\<\\(then\\|and[ \t]*then\\)\\>" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3001 nil orgpoint)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3002 (= (downcase (char-after (car match-cons))) ?a))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3003 ;; If "then" was found (we are looking at it) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3004 (if match-cons |
10705 | 3005 (progn |
3006 ;; | |
3007 ;; 'then' first in separate line ? | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3008 ;; => indent according to 'then', |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3009 ;; => else indent according to 'if' |
10705 | 3010 ;; |
3011 (if (save-excursion | |
3012 (back-to-indentation) | |
3013 (looking-at "\\<then\\>")) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3014 (setq cur-indent (save-excursion (back-to-indentation) (point)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3015 ;; skip 'then' |
10705 | 3016 (forward-word 1) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3017 (list cur-indent 'ada-indent)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3018 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3019 (list cur-indent 'ada-broken-indent)))) |
10705 | 3020 |
3021 (defun ada-get-indent-block-start (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3022 "Calculates the indentation when point is at the start of a block. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3023 ORGPOINT is the limit position used in the calculation." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3024 (let ((pos nil)) |
10705 | 3025 (cond |
3026 ((save-excursion | |
3027 (forward-word 1) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3028 (setq pos (ada-goto-next-non-ws orgpoint))) |
10705 | 3029 (goto-char pos) |
3030 (save-excursion | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3031 (ada-indent-on-previous-lines t orgpoint))) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3032 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3033 ;; Special case for record types, for instance for: |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3034 ;; type A is (B : Integer; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3035 ;; C : Integer) is record |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3036 ;; null; -- This is badly indented otherwise |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3037 ((looking-at "record") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3038 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3039 ;; If record is at the beginning of the line, indent from there |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3040 (if (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3041 (beginning-of-line) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3042 (looking-at "^[ \t]*\\(record\\|limited record\\)")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3043 (list (save-excursion (back-to-indentation) (point)) 'ada-indent) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3044 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3045 ;; else indent relative to the type command |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3046 (list (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3047 (car (ada-search-ignore-string-comment "\\<type\\>" t))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3048 'ada-indent))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3049 |
10705 | 3050 ;; nothing follows the block-start |
3051 (t | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3052 (list (save-excursion (back-to-indentation) (point)) 'ada-indent))))) |
10705 | 3053 |
3054 (defun ada-get-indent-subprog (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3055 "Calculates the indentation when point is just before a subprogram. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3056 ORGPOINT is the limit position used in the calculation." |
10705 | 3057 (let ((match-cons nil) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3058 (cur-indent (save-excursion (back-to-indentation) (point))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3059 (foundis nil)) |
10705 | 3060 ;; |
3061 ;; is there an 'is' in front of point ? | |
3062 ;; | |
3063 (if (save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3064 (setq match-cons |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3065 (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3066 "\\<\\(is\\|do\\)\\>" nil orgpoint))) |
10705 | 3067 ;; |
3068 ;; yes, then skip to its end | |
3069 ;; | |
3070 (progn | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3071 (setq foundis t) |
10705 | 3072 (goto-char (cdr match-cons))) |
3073 ;; | |
3074 ;; no, then goto next non-ws, if there is one in front of point | |
3075 ;; | |
3076 (progn | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3077 (unless (ada-goto-next-non-ws orgpoint) |
10705 | 3078 (goto-char orgpoint)))) |
3079 | |
3080 (cond | |
3081 ;; | |
3082 ;; nothing follows 'is' | |
3083 ;; | |
3084 ((and | |
3085 foundis | |
3086 (save-excursion | |
3087 (not (ada-search-ignore-string-comment | |
3088 "[^ \t\n]" nil orgpoint t)))) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3089 (list cur-indent 'ada-indent)) |
10705 | 3090 ;; |
3091 ;; is abstract/separate/new ... | |
3092 ;; | |
3093 ((and | |
3094 foundis | |
3095 (save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3096 (setq match-cons |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3097 (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3098 "\\<\\(separate\\|new\\|abstract\\)\\>" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3099 nil orgpoint)))) |
10705 | 3100 (goto-char (car match-cons)) |
12586
f8bbc7a3b87a
(ada-ident-re): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12053
diff
changeset
|
3101 (ada-search-ignore-string-comment ada-subprog-start-re t) |
10705 | 3102 (ada-get-indent-noindent orgpoint)) |
3103 ;; | |
3104 ;; something follows 'is' | |
3105 ;; | |
3106 ((and | |
3107 foundis | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3108 (save-excursion (setq match-cons (ada-goto-next-non-ws orgpoint))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3109 (goto-char match-cons) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3110 (ada-indent-on-previous-lines t orgpoint))) |
10705 | 3111 ;; |
3112 ;; no 'is' but ';' | |
3113 ;; | |
3114 ((save-excursion | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3115 (ada-search-ignore-string-comment ";" nil orgpoint nil 'search-forward)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3116 (list cur-indent 0)) |
10705 | 3117 ;; |
3118 ;; no 'is' or ';' | |
3119 ;; | |
3120 (t | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3121 (list cur-indent 'ada-broken-indent))))) |
10705 | 3122 |
3123 (defun ada-get-indent-noindent (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3124 "Calculates the indentation when point is just before a 'noindent stmt'. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3125 ORGPOINT is the limit position used in the calculation." |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3126 (let ((label 0)) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3127 (save-excursion |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3128 (beginning-of-line) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3129 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3130 (cond |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3131 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3132 ;; This one is called when indenting a line preceded by a multi-line |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3133 ;; subprogram declaration (in that case, we are at this point inside |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3134 ;; the parameter declaration list) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3135 ((ada-in-paramlist-p) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3136 (ada-previous-procedure) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3137 (list (save-excursion (back-to-indentation) (point)) 0)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3138 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3139 ;; This one is called when indenting the second line of a multi-line |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3140 ;; declaration section, in a declare block or a record declaration |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3141 ((looking-at "[ \t]*\\(\\sw\\|_\\)*[ \t]*,[ \t]*$") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3142 (list (save-excursion (back-to-indentation) (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3143 'ada-broken-decl-indent)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3144 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3145 ;; This one is called in every over case when indenting a line at the |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3146 ;; top level |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3147 (t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3148 (if (looking-at ada-named-block-re) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3149 (setq label (- ada-label-indent)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3150 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3151 (let (p) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3152 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3153 ;; "with private" or "null record" cases |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3154 (if (or (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3155 (and (ada-search-ignore-string-comment "\\<private\\>" nil orgpoint) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3156 (setq p (point)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3157 (save-excursion (forward-char -7);; skip back "private" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3158 (ada-goto-previous-word) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3159 (looking-at "with")))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3160 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3161 (and (ada-search-ignore-string-comment "\\<record\\>" nil orgpoint) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3162 (setq p (point)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3163 (save-excursion (forward-char -6);; skip back "record" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3164 (ada-goto-previous-word) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3165 (looking-at "null"))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3166 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3167 (goto-char p) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3168 (re-search-backward "\\<\\(type\\|subtype\\)\\>" nil t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3169 (list (save-excursion (back-to-indentation) (point)) 0))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3170 (if (save-excursion |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3171 (ada-search-ignore-string-comment ";" nil orgpoint nil |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3172 'search-forward)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3173 (list (+ (save-excursion (back-to-indentation) (point)) label) 0) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3174 (list (+ (save-excursion (back-to-indentation) (point)) label) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3175 'ada-broken-indent))))))) |
10705 | 3176 |
3177 (defun ada-get-indent-label (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3178 "Calculates the indentation when before a label or variable declaration. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3179 ORGPOINT is the limit position used in the calculation." |
10705 | 3180 (let ((match-cons nil) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3181 (cur-indent (save-excursion (back-to-indentation) (point)))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3182 (ada-search-ignore-string-comment ":" nil) |
10705 | 3183 (cond |
3184 ;; loop label | |
3185 ((save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3186 (setq match-cons (ada-search-ignore-string-comment |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3187 ada-loop-start-re nil orgpoint))) |
10705 | 3188 (goto-char (car match-cons)) |
3189 (ada-get-indent-loop orgpoint)) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3190 |
10705 | 3191 ;; declare label |
3192 ((save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3193 (setq match-cons (ada-search-ignore-string-comment |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3194 "\\<declare\\|begin\\>" nil orgpoint))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3195 (goto-char (car match-cons)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3196 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3197 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3198 ;; variable declaration |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3199 ((ada-in-decl-p) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3200 (if (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3201 (ada-search-ignore-string-comment ";" nil orgpoint)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3202 (list cur-indent 0) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3203 (list cur-indent 'ada-broken-indent))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3204 |
10705 | 3205 ;; nothing follows colon |
3206 (t | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3207 (list cur-indent '(- ada-label-indent)))))) |
10705 | 3208 |
3209 (defun ada-get-indent-loop (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3210 "Calculates the indentation when just before a loop or a for ... use. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3211 ORGPOINT is the limit position used in the calculation." |
10705 | 3212 (let ((match-cons nil) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3213 (pos (point)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3214 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3215 ;; If looking at a named block, skip the label |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3216 (label (save-excursion |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3217 (beginning-of-line) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3218 (if (looking-at ada-named-block-re) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3219 (- ada-label-indent) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3220 0)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3221 |
10705 | 3222 (cond |
3223 | |
3224 ;; | |
3225 ;; statement complete | |
3226 ;; | |
3227 ((save-excursion | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3228 (ada-search-ignore-string-comment ";" nil orgpoint nil |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3229 'search-forward)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3230 (list (+ (save-excursion (back-to-indentation) (point)) label) 0)) |
10705 | 3231 ;; |
3232 ;; simple loop | |
3233 ;; | |
3234 ((looking-at "loop\\>") | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3235 (setq pos (ada-get-indent-block-start orgpoint)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3236 (if (equal label 0) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3237 pos |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3238 (list (+ (car pos) label) (cdr pos)))) |
10705 | 3239 |
3240 ;; | |
3241 ;; 'for'- loop (or also a for ... use statement) | |
3242 ;; | |
3243 ((looking-at "for\\>") | |
3244 (cond | |
3245 ;; | |
3246 ;; for ... use | |
3247 ;; | |
3248 ((save-excursion | |
3249 (and | |
3250 (goto-char (match-end 0)) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3251 (ada-goto-next-non-ws orgpoint) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3252 (forward-word 1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3253 (if (= (char-after) ?') (forward-word 1) t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3254 (ada-goto-next-non-ws orgpoint) |
10705 | 3255 (looking-at "\\<use\\>") |
3256 ;; | |
3257 ;; check if there is a 'record' before point | |
3258 ;; | |
3259 (progn | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3260 (setq match-cons (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3261 "record" nil orgpoint nil 'word-search-forward)) |
10705 | 3262 t))) |
3263 (if match-cons | |
3264 (goto-char (car match-cons))) | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3265 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)) |
10705 | 3266 ;; |
3267 ;; for..loop | |
3268 ;; | |
3269 ((save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3270 (setq match-cons (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3271 "loop" nil orgpoint nil 'word-search-forward))) |
10705 | 3272 (goto-char (car match-cons)) |
3273 ;; | |
3274 ;; indent according to 'loop', if it's first in the line; | |
3275 ;; otherwise to 'for' | |
3276 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3277 (unless (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3278 (back-to-indentation) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3279 (looking-at "\\<loop\\>")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3280 (goto-char pos)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3281 (list (+ (save-excursion (back-to-indentation) (point)) label) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3282 'ada-indent)) |
10705 | 3283 ;; |
3284 ;; for-statement is broken | |
3285 ;; | |
3286 (t | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3287 (list (+ (save-excursion (back-to-indentation) (point)) label) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3288 'ada-broken-indent)))) |
10705 | 3289 |
3290 ;; | |
3291 ;; 'while'-loop | |
3292 ;; | |
3293 ((looking-at "while\\>") | |
3294 ;; | |
3295 ;; while..loop ? | |
3296 ;; | |
3297 (if (save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3298 (setq match-cons (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3299 "loop" nil orgpoint nil 'word-search-forward))) |
10705 | 3300 |
3301 (progn | |
3302 (goto-char (car match-cons)) | |
3303 ;; | |
3304 ;; indent according to 'loop', if it's first in the line; | |
3305 ;; otherwise to 'while'. | |
3306 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3307 (unless (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3308 (back-to-indentation) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3309 (looking-at "\\<loop\\>")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3310 (goto-char pos)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3311 (list (+ (save-excursion (back-to-indentation) (point)) label) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3312 'ada-indent)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3313 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3314 (list (+ (save-excursion (back-to-indentation) (point)) label) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3315 'ada-broken-indent)))))) |
10705 | 3316 |
3317 (defun ada-get-indent-type (orgpoint) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3318 "Calculates the indentation when before a type statement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3319 ORGPOINT is the limit position used in the calculation." |
10705 | 3320 (let ((match-dat nil)) |
3321 (cond | |
3322 ;; | |
3323 ;; complete record declaration | |
3324 ;; | |
3325 ((save-excursion | |
3326 (and | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3327 (setq match-dat (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3328 "end" nil orgpoint nil 'word-search-forward)) |
10705 | 3329 (ada-goto-next-non-ws) |
3330 (looking-at "\\<record\\>") | |
3331 (forward-word 1) | |
3332 (ada-goto-next-non-ws) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3333 (= (char-after) ?\;))) |
10705 | 3334 (goto-char (car match-dat)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3335 (list (save-excursion (back-to-indentation) (point)) 0)) |
10705 | 3336 ;; |
3337 ;; record type | |
3338 ;; | |
3339 ((save-excursion | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3340 (setq match-dat (ada-search-ignore-string-comment |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3341 "record" nil orgpoint nil 'word-search-forward))) |
10705 | 3342 (goto-char (car match-dat)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3343 (list (save-excursion (back-to-indentation) (point)) 'ada-indent)) |
10705 | 3344 ;; |
3345 ;; complete type declaration | |
3346 ;; | |
3347 ((save-excursion | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3348 (ada-search-ignore-string-comment ";" nil orgpoint nil |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3349 'search-forward)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3350 (list (save-excursion (back-to-indentation) (point)) 0)) |
10705 | 3351 ;; |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
3352 ;; "type ... is", but not "type ... is ...", which is broken |
10705 | 3353 ;; |
3354 ((save-excursion | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3355 (and |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3356 (ada-search-ignore-string-comment "is" nil orgpoint nil |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3357 'word-search-forward) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3358 (not (ada-goto-next-non-ws orgpoint)))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3359 (list (save-excursion (back-to-indentation) (point)) 'ada-broken-indent)) |
10705 | 3360 ;; |
3361 ;; broken statement | |
3362 ;; | |
3363 (t | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3364 (list (save-excursion (back-to-indentation) (point)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3365 'ada-broken-indent))))) |
10705 | 3366 |
3367 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3368 ;; ----------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3369 ;; -- searching and matching |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3370 ;; ----------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3371 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3372 (defun ada-goto-stmt-start () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3373 "Moves point to the beginning of the statement that point is in or after. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3374 Returns the new position of point. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3375 As a special case, if we are looking at a closing parenthesis, skip to the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3376 open parenthesis." |
10705 | 3377 (let ((match-dat nil) |
3378 (orgpoint (point))) | |
3379 | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3380 (setq match-dat (ada-search-prev-end-stmt)) |
10705 | 3381 (if match-dat |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
3382 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3383 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3384 ;; found a previous end-statement => check if anything follows |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3385 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3386 (unless (looking-at "declare") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3387 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3388 (unless (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3389 (goto-char (cdr match-dat)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3390 (ada-goto-next-non-ws orgpoint)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3391 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3392 ;; nothing follows => it's the end-statement directly in |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3393 ;; front of point => search again |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3394 ;; |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3395 (setq match-dat (ada-search-prev-end-stmt))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3396 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3397 ;; if found the correct end-statement => goto next non-ws |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3398 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3399 (if match-dat |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3400 (goto-char (cdr match-dat))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3401 (ada-goto-next-non-ws) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3402 )) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
3403 |
10705 | 3404 ;; |
3405 ;; no previous end-statement => we are at the beginning of the | |
3406 ;; accessible part of the buffer | |
3407 ;; | |
3408 (progn | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3409 (goto-char (point-min)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3410 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3411 ;; skip to the very first statement, if there is one |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3412 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3413 (unless (ada-goto-next-non-ws orgpoint) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3414 (goto-char orgpoint)))) |
10705 | 3415 (point))) |
3416 | |
3417 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3418 (defun ada-search-prev-end-stmt () |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3419 "Moves point to previous end-statement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3420 Returns a cons cell whose car is the beginning and whose cdr the end of the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3421 match." |
10705 | 3422 (let ((match-dat nil) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3423 (found nil)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3424 |
10705 | 3425 ;; search until found or beginning-of-buffer |
3426 (while | |
3427 (and | |
3428 (not found) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3429 (setq match-dat (ada-search-ignore-string-comment |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3430 ada-end-stmt-re t))) |
10705 | 3431 |
3432 (goto-char (car match-dat)) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3433 (unless (ada-in-open-paren-p) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3434 (cond |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3435 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3436 ((and (looking-at |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3437 "\\<\\(record\\|loop\\|select\\|else\\|then\\)\\>") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3438 (save-excursion |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3439 (ada-goto-previous-word) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3440 (looking-at "\\<\\(end\\|or\\|and\\)\\>[ \t]*[^;]"))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3441 (forward-word -1)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3442 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3443 ((looking-at "is") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3444 (setq found |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3445 (and (save-excursion (ada-goto-previous-word) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3446 (ada-goto-previous-word) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3447 (not (looking-at "subtype"))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3448 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3449 (save-excursion (goto-char (cdr match-dat)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3450 (ada-goto-next-non-ws) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3451 ;; words that can go after an 'is' |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3452 (not (looking-at |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3453 (eval-when-compile |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3454 (concat "\\<" |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3455 (regexp-opt |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3456 '("separate" "access" "array" |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3457 "abstract" "new") t) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3458 "\\>\\|(")))))))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3459 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3460 (t |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3461 (setq found t)) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3462 ))) |
10705 | 3463 |
3464 (if found | |
3465 match-dat | |
3466 nil))) | |
3467 | |
3468 | |
3469 (defun ada-goto-next-non-ws (&optional limit) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3470 "Skips white spaces, newlines and comments to next non-ws character. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3471 Stop the search at LIMIT. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3472 Do not call this function from within a string." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3473 (unless limit |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3474 (setq limit (point-max))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3475 (while (and (<= (point) limit) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3476 (progn (forward-comment 10000) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3477 (if (and (not (eobp)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3478 (save-excursion (forward-char 1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3479 (ada-in-string-p))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3480 (progn (forward-sexp 1) t))))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3481 (if (< (point) limit) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3482 (point) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3483 nil) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3484 ) |
10705 | 3485 |
3486 | |
3487 (defun ada-goto-stmt-end (&optional limit) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3488 "Moves point to the end of the statement that point is in or before. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3489 Returns the new position of point or nil if not found. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3490 Stop the search at LIMIT." |
10705 | 3491 (if (ada-search-ignore-string-comment ada-end-stmt-re nil limit) |
3492 (point) | |
3493 nil)) | |
3494 | |
3495 | |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3496 (defun ada-goto-next-word (&optional backward) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3497 "Moves point to the beginning of the next word of Ada code. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3498 If BACKWARD is non-nil, jump to the beginning of the previous word. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3499 Returns the new position of point or nil if not found." |
10705 | 3500 (let ((match-cons nil) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3501 (orgpoint (point)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3502 (old-syntax (char-to-string (char-syntax ?_)))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3503 (modify-syntax-entry ?_ "w") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3504 (unless backward |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3505 (skip-syntax-forward "w")) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3506 (if (setq match-cons |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3507 (if backward |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3508 (ada-search-ignore-string-comment "\\w" t nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3509 (ada-search-ignore-string-comment "\\w" nil nil t))) |
10705 | 3510 ;; |
3511 ;; move to the beginning of the word found | |
3512 ;; | |
3513 (progn | |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3514 (goto-char (car match-cons)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3515 (skip-syntax-backward "w") |
10705 | 3516 (point)) |
3517 ;; | |
3518 ;; if not found, restore old position of point | |
3519 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3520 (goto-char orgpoint) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3521 'nil) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3522 (modify-syntax-entry ?_ old-syntax)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3523 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3524 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3525 |
10705 | 3526 (defun ada-check-matching-start (keyword) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3527 "Signals an error if matching block start is not KEYWORD. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3528 Moves point to the matching block start." |
10705 | 3529 (ada-goto-matching-start 0) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3530 (unless (looking-at (concat "\\<" keyword "\\>")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3531 (error "matching start is not '%s'" keyword))) |
10705 | 3532 |
3533 | |
3534 (defun ada-check-defun-name (defun-name) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3535 "Checks if the name of the matching defun really is DEFUN-NAME. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3536 Assumes point to be already positioned by 'ada-goto-matching-start'. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3537 Moves point to the beginning of the declaration." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3538 |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3539 ;; named block without a `declare' |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3540 (if (save-excursion |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3541 (ada-goto-previous-word) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3542 (looking-at (concat "\\<" defun-name "\\> *:"))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3543 t ; do nothing |
10705 | 3544 ;; |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3545 ;; 'accept' or 'package' ? |
10705 | 3546 ;; |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3547 (unless (looking-at ada-subprog-start-re) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3548 (ada-goto-matching-decl-start)) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3549 ;; |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3550 ;; 'begin' of 'procedure'/'function'/'task' or 'declare' |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3551 ;; |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3552 (save-excursion |
10705 | 3553 ;; |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3554 ;; a named 'declare'-block ? |
10705 | 3555 ;; |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3556 (if (looking-at "\\<declare\\>") |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3557 (ada-goto-stmt-start) |
10705 | 3558 ;; |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3559 ;; no, => 'procedure'/'function'/'task'/'protected' |
10705 | 3560 ;; |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3561 (progn |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3562 (forward-word 2) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3563 (backward-word 1) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3564 ;; |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3565 ;; skip 'body' 'type' |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3566 ;; |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3567 (if (looking-at "\\<\\(body\\|type\\)\\>") |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3568 (forward-word 1)) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3569 (forward-sexp 1) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3570 (backward-sexp 1))) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3571 ;; |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3572 ;; should be looking-at the correct name |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3573 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3574 (unless (looking-at (concat "\\<" defun-name "\\>")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3575 (error "matching defun has different name: %s" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3576 (buffer-substring (point) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3577 (progn (forward-sexp 1) (point)))))))) |
10705 | 3578 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3579 (defun ada-goto-matching-decl-start (&optional noerror recursive) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3580 "Moves point to the matching declaration start of the current 'begin'. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3581 If NOERROR is non-nil, it only returns nil if no match was found." |
10705 | 3582 (let ((nest-count 1) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3583 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3584 ;; first should be set to t if we should stop at the first |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3585 ;; "begin" we encounter. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3586 (first (not recursive)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3587 (count-generic nil) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3588 (stop-at-when nil) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3589 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3590 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3591 ;; Ignore "when" most of the time, except if we are looking at the |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3592 ;; beginning of a block (structure: case .. is |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3593 ;; when ... => |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3594 ;; begin ... |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3595 ;; exception ... ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3596 (if (looking-at "begin") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3597 (setq stop-at-when t)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3598 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3599 (if (or |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3600 (looking-at "\\<\\(package\\|procedure\\|function\\)\\>") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3601 (save-excursion |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3602 (ada-search-ignore-string-comment |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3603 "\\<\\(package\\|procedure\\|function\\|generic\\)\\>" t) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3604 (looking-at "generic"))) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3605 (setq count-generic t)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3606 |
10705 | 3607 ;; search backward for interesting keywords |
3608 (while (and | |
3609 (not (zerop nest-count)) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3610 (ada-search-ignore-string-comment ada-matching-decl-start-re t)) |
10705 | 3611 ;; |
3612 ;; calculate nest-depth | |
3613 ;; | |
3614 (cond | |
3615 ;; | |
3616 ((looking-at "end") | |
3617 (ada-goto-matching-start 1 noerror) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3618 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3619 ;; In some case, two begin..end block can follow each other closely, |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3620 ;; which we have to detect, as in |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3621 ;; procedure P is |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3622 ;; procedure Q is |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3623 ;; begin |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3624 ;; end; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3625 ;; begin -- here we should go to procedure, not begin |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3626 ;; end |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3627 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3628 (if (looking-at "begin") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3629 (let ((loop-again t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3630 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3631 (while loop-again |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3632 ;; If begin was just there as the beginning of a block |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3633 ;; (with no declare) then do nothing, otherwise just |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3634 ;; register that we have to find the statement that |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3635 ;; required the begin |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3636 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3637 (ada-search-ignore-string-comment |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3638 "\\<\\(declare\\|begin\\|end\\|procedure\\|function\\|task\\|package\\)\\>" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3639 t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3640 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3641 (if (looking-at "end") |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3642 (ada-goto-matching-start 1 noerror t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3643 ;; (ada-goto-matching-decl-start noerror t) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3644 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3645 (setq loop-again nil) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3646 (unless (looking-at "begin") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3647 (setq nest-count (1+ nest-count)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3648 )) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3649 ))) |
10705 | 3650 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3651 ((looking-at "generic") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3652 (if count-generic |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3653 (progn |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3654 (setq first nil) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3655 (setq nest-count (1- nest-count))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3656 ;; |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3657 ((looking-at "if") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3658 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3659 (forward-word -1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3660 (unless (looking-at "\\<end[ \t\n]*if\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3661 (progn |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3662 (setq nest-count (1- nest-count)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3663 (setq first nil))))) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
3664 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3665 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3666 ((looking-at "declare\\|generic") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3667 (setq nest-count (1- nest-count)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3668 (setq first t)) |
10705 | 3669 ;; |
3670 ((looking-at "is") | |
12586
f8bbc7a3b87a
(ada-ident-re): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12053
diff
changeset
|
3671 ;; check if it is only a type definition, but not a protected |
f8bbc7a3b87a
(ada-ident-re): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12053
diff
changeset
|
3672 ;; type definition, which should be handled like a procedure. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3673 (if (or (looking-at "is[ \t]+<>") |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3674 (save-excursion |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3675 (forward-comment -10000) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3676 (forward-char -1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3677 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3678 ;; Detect if we have a closing parenthesis (Could be |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3679 ;; either the end of subprogram parameters or (<>) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3680 ;; in a type definition |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3681 (if (= (char-after) ?\)) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3682 (progn |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3683 (forward-char 1) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3684 (backward-sexp 1) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3685 (forward-comment -10000) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3686 )) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3687 (skip-chars-backward "a-zA-Z0-9_.'") |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3688 (ada-goto-previous-word) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3689 (and |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3690 (looking-at "\\<\\(sub\\)?type\\>") |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3691 (save-match-data |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3692 (ada-goto-previous-word) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
3693 (not (looking-at "\\<protected\\>")))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3694 )) ; end of `or' |
10705 | 3695 (goto-char (match-beginning 0)) |
3696 (progn | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3697 (setq nest-count (1- nest-count)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3698 (setq first nil)))) |
10705 | 3699 |
3700 ;; | |
3701 ((looking-at "new") | |
3702 (if (save-excursion | |
3703 (ada-goto-previous-word) | |
3704 (looking-at "is")) | |
3705 (goto-char (match-beginning 0)))) | |
3706 ;; | |
3707 ((and first | |
3708 (looking-at "begin")) | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3709 (setq nest-count 0)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3710 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3711 ((looking-at "when") |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3712 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3713 (forward-word -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3714 (unless (looking-at "\\<exit[ \t\n]*when\\>") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3715 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3716 (if stop-at-when |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3717 (setq nest-count (1- nest-count))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3718 (setq first nil))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3719 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3720 ((looking-at "begin") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3721 (setq first nil)) |
10705 | 3722 ;; |
3723 (t | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3724 (setq nest-count (1+ nest-count)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3725 (setq first nil))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3726 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3727 );; end of loop |
10705 | 3728 |
3729 ;; check if declaration-start is really found | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3730 (if (and |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3731 (zerop nest-count) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3732 (if (looking-at "is") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3733 (ada-search-ignore-string-comment ada-subprog-start-re t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3734 (looking-at "declare\\|generic"))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3735 t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3736 (if noerror nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3737 (error "no matching proc/func/task/declare/package/protected"))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3738 )) |
10705 | 3739 |
3740 (defun ada-goto-matching-start (&optional nest-level noerror gotothen) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3741 "Moves point to the beginning of a block-start. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3742 Which block depends on the value of NEST-LEVEL, which defaults to zero. If |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3743 NOERROR is non-nil, it only returns nil if no matching start was found. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3744 If GOTOTHEN is non-nil, point moves to the 'then' following 'if'." |
10705 | 3745 (let ((nest-count (if nest-level nest-level 0)) |
3746 (found nil) | |
3747 (pos nil)) | |
3748 | |
3749 ;; | |
3750 ;; search backward for interesting keywords | |
3751 ;; | |
3752 (while (and | |
3753 (not found) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3754 (ada-search-ignore-string-comment ada-matching-start-re t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3755 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3756 (unless (and (looking-at "\\<record\\>") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3757 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3758 (forward-word -1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3759 (looking-at "\\<null\\>"))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3760 (progn |
10705 | 3761 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3762 ;; calculate nest-depth |
10705 | 3763 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3764 (cond |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3765 ;; found block end => increase nest depth |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3766 ((looking-at "end") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3767 (setq nest-count (1+ nest-count))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3768 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3769 ;; found loop/select/record/case/if => check if it starts or |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3770 ;; ends a block |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3771 ((looking-at "loop\\|select\\|record\\|case\\|if") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3772 (setq pos (point)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3773 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3774 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3775 ;; check if keyword follows 'end' |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3776 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3777 (ada-goto-previous-word) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3778 (if (looking-at "\\<end\\>[ \t]*[^;]") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3779 ;; it ends a block => increase nest depth |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3780 (setq nest-count (1+ nest-count) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3781 pos (point)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3782 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3783 ;; it starts a block => decrease nest depth |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3784 (setq nest-count (1- nest-count)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3785 (goto-char pos)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3786 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3787 ;; found package start => check if it really is a block |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3788 ((looking-at "package") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3789 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3790 ;; ignore if this is just a renames statement |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3791 (let ((current (point)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3792 (pos (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3793 "\\<\\(is\\|renames\\|;\\)\\>" nil))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3794 (if pos |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3795 (goto-char (car pos)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3796 (error (concat |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3797 "No matching 'is' or 'renames' for 'package' at" |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3798 " line " |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3799 (number-to-string (count-lines 1 (1+ current))))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3800 (unless (looking-at "renames") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3801 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3802 (forward-word 1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3803 (ada-goto-next-non-ws) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3804 ;; ignore it if it is only a declaration with 'new' |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3805 ;; We could have package Foo is new .... |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3806 ;; or package Foo is separate; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3807 ;; or package Foo is begin null; end Foo |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3808 ;; for elaboration code (elaboration) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3809 (if (not (looking-at "\\<\\(new\\|separate\\|begin\\)\\>")) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3810 (setq nest-count (1- nest-count))))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3811 ;; found task start => check if it has a body |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3812 ((looking-at "task") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3813 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3814 (forward-word 1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3815 (ada-goto-next-non-ws) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3816 (cond |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3817 ((looking-at "\\<body\\>")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3818 ((looking-at "\\<type\\>") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3819 ;; In that case, do nothing if there is a "is" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3820 (forward-word 2);; skip "type" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3821 (ada-goto-next-non-ws);; skip type name |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3822 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3823 ;; Do nothing if we are simply looking at a simple |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3824 ;; "task type name;" statement with no block |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3825 (unless (looking-at ";") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3826 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3827 ;; Skip the parameters |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3828 (if (looking-at "(") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3829 (ada-search-ignore-string-comment ")" nil)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3830 (let ((tmp (ada-search-ignore-string-comment |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3831 "\\<\\(is\\|;\\)\\>" nil))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3832 (if tmp |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3833 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3834 (goto-char (car tmp)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3835 (if (looking-at "is") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3836 (setq nest-count (1- nest-count))))))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3837 (t |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3838 ;; Check if that task declaration had a block attached to |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3839 ;; it (i.e do nothing if we have just "task name;") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3840 (unless (progn (forward-word 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3841 (looking-at "[ \t]*;")) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3842 (setq nest-count (1- nest-count))))))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3843 ;; all the other block starts |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3844 (t |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3845 (setq nest-count (1- nest-count)))) ; end of 'cond' |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3846 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3847 ;; match is found, if nest-depth is zero |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3848 ;; |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
3849 (setq found (zerop nest-count))))) ; end of loop |
10705 | 3850 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3851 (if (bobp) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3852 (point) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3853 (if found |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3854 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3855 ;; match found => is there anything else to do ? |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3856 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3857 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3858 (cond |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3859 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3860 ;; found 'if' => skip to 'then', if it's on a separate line |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3861 ;; and GOTOTHEN is non-nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3862 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3863 ((and |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3864 gotothen |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3865 (looking-at "if") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3866 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3867 (ada-search-ignore-string-comment "then" nil nil nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3868 'word-search-forward) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3869 (back-to-indentation) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3870 (looking-at "\\<then\\>"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3871 (goto-char (match-beginning 0))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3872 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3873 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3874 ;; found 'do' => skip back to 'accept' |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3875 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3876 ((looking-at "do") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3877 (unless (ada-search-ignore-string-comment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3878 "accept" t nil nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3879 'word-search-backward) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3880 (error "missing 'accept' in front of 'do'")))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3881 (point)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3882 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3883 (if noerror |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3884 nil |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3885 (error "no matching start")))))) |
10705 | 3886 |
3887 | |
3888 (defun ada-goto-matching-end (&optional nest-level noerror) | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3889 "Moves point to the end of a block. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3890 Which block depends on the value of NEST-LEVEL, which defaults to zero. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3891 If NOERROR is non-nil, it only returns nil if found no matching start." |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3892 (let ((nest-count (or nest-level 0)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3893 (regex (eval-when-compile |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3894 (concat "\\<" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3895 (regexp-opt '("end" "loop" "select" "begin" "case" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3896 "if" "task" "package" "record" "do" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3897 "procedure" "function") t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3898 "\\>"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3899 found |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3900 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3901 ;; First is used for subprograms: they are generally handled |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3902 ;; recursively, but of course we do not want to do that the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3903 ;; first time (see comment below about subprograms) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3904 (first (not (looking-at "declare")))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3905 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3906 ;; If we are already looking at one of the keywords, this shouldn't count |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3907 ;; in the nesting loop below, so we just make sure we don't count it. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3908 ;; "declare" is a special case because we need to look after the "begin" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3909 ;; keyword |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
3910 (if (looking-at "\\<if\\|loop\\|case\\>") |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3911 (forward-char 1)) |
10705 | 3912 |
3913 ;; | |
3914 ;; search forward for interesting keywords | |
3915 ;; | |
3916 (while (and | |
3917 (not found) | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3918 (ada-search-ignore-string-comment regex nil)) |
10705 | 3919 |
3920 ;; | |
3921 ;; calculate nest-depth | |
3922 ;; | |
3923 (backward-word 1) | |
3924 (cond | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3925 ;; procedures and functions need to be processed recursively, in |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3926 ;; case they are defined in a declare/begin block, as in: |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3927 ;; declare -- NL 0 (nested level) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3928 ;; A : Boolean; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3929 ;; procedure B (C : D) is |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3930 ;; begin -- NL 1 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3931 ;; null; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3932 ;; end B; -- NL 0, and we would exit |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3933 ;; begin |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3934 ;; end; -- we should exit here |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3935 ;; processing them recursively avoids the need for any special |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3936 ;; handling. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3937 ;; Nothing should be done if we have only the specs or a |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3938 ;; generic instantion. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3939 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3940 ((and (looking-at "\\<procedure\\|function\\>")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3941 (if first |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3942 (forward-word 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3943 (ada-search-ignore-string-comment "is\\|;") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3944 (ada-goto-next-non-ws) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3945 (unless (looking-at "\\<new\\>") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3946 (ada-goto-matching-end 0 t)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3947 |
10705 | 3948 ;; found block end => decrease nest depth |
3949 ((looking-at "\\<end\\>") | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3950 (setq nest-count (1- nest-count) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3951 found (<= nest-count 0)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3952 ;; skip the following keyword |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3953 (if (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3954 (skip-chars-forward "end") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3955 (ada-goto-next-non-ws) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3956 (looking-at "\\<\\(loop\\|select\\|record\\|case\\|if\\)\\>")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3957 (forward-word 1))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3958 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3959 ;; found package start => check if it really starts a block, and is not |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3960 ;; in fact a generic instantiation for instance |
10705 | 3961 ((looking-at "\\<package\\>") |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3962 (ada-search-ignore-string-comment "is" nil nil nil |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3963 'word-search-forward) |
10705 | 3964 (ada-goto-next-non-ws) |
3965 ;; ignore and skip it if it is only a 'new' package | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3966 (if (looking-at "\\<new\\>") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3967 (goto-char (match-end 0)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3968 (setq nest-count (1+ nest-count) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3969 found (<= nest-count 0)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3970 |
10705 | 3971 ;; all the other block starts |
3972 (t | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3973 (setq nest-count (1+ nest-count) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3974 found (<= nest-count 0)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3975 (forward-word 1))) ; end of 'cond' |
10705 | 3976 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
3977 (setq first nil)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3978 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3979 (if found |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3980 t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3981 (if noerror |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3982 nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3983 (error "no matching end"))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3984 )) |
10705 | 3985 |
3986 | |
3987 (defun ada-search-ignore-string-comment | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
3988 (search-re &optional backward limit paramlists search-func) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3989 "Regexp-search for SEARCH-RE, ignoring comments, strings. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3990 If PARAMLISTS is nil, ignore parameter lists. Returns a cons cell of |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3991 begin and end of match data or nil, if not found. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3992 The search is done using SEARCH-FUNC, which should search backward if |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3993 BACKWARD is non-nil, forward otherwise. SEARCH-FUNC can be optimized in case |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3994 we are searching for a constant string. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3995 The search stops at pos LIMIT. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
3996 Point is moved at the beginning of the search-re." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3997 (let (found |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3998 begin |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
3999 end |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4000 parse-result |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4001 (previous-syntax-table (syntax-table))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4002 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4003 (unless search-func |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4004 (setq search-func (if backward 're-search-backward 're-search-forward))) |
10705 | 4005 |
4006 ;; | |
4007 ;; search until found or end-of-buffer | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4008 ;; We have to test that we do not look further than limit |
10705 | 4009 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4010 (set-syntax-table ada-mode-symbol-syntax-table) |
10705 | 4011 (while (and (not found) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4012 (or (not limit) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4013 (or (and backward (<= limit (point))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4014 (>= limit (point)))) |
10705 | 4015 (funcall search-func search-re limit 1)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4016 (setq begin (match-beginning 0)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4017 (setq end (match-end 0)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4018 |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4019 (setq parse-result (parse-partial-sexp |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4020 (save-excursion (beginning-of-line) (point)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4021 (point))) |
10705 | 4022 |
4023 (cond | |
4024 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4025 ;; If inside a string, skip it (and the following comments) |
10705 | 4026 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4027 ((ada-in-string-p parse-result) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4028 (if ada-xemacs |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4029 (search-backward "\"" nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4030 (goto-char (nth 8 parse-result))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4031 (unless backward (forward-sexp 1))) |
10705 | 4032 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4033 ;; If inside a comment, skip it (and the following comments) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4034 ;; There is a special code for comments at the end of the file |
10705 | 4035 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4036 ((ada-in-comment-p parse-result) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4037 (if ada-xemacs |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4038 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4039 (forward-line 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4040 (beginning-of-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4041 (forward-comment -1)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4042 (goto-char (nth 8 parse-result))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4043 (unless backward |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4044 ;; at the end of the file, it is not possible to skip a comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4045 ;; so we just go at the end of the line |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4046 (if (forward-comment 1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4047 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4048 (forward-comment 1000) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4049 (beginning-of-line)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4050 (end-of-line)))) |
10705 | 4051 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4052 ;; directly in front of a comment => skip it, if searching forward |
10705 | 4053 ;; |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4054 ((and (= (char-after begin) ?-) (= (char-after (1+ begin)) ?-)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4055 (unless backward (progn (forward-char -1) (forward-comment 1000)))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4056 |
10705 | 4057 ;; |
4058 ;; found a parameter-list but should ignore it => skip it | |
4059 ;; | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4060 ((and (not paramlists) (ada-in-paramlist-p)) |
10705 | 4061 (if backward |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4062 (search-backward "(" nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4063 (search-forward ")" nil t))) |
10705 | 4064 ;; |
4065 ;; found what we were looking for | |
4066 ;; | |
4067 (t | |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4068 (setq found t)))) ; end of loop |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4069 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4070 (set-syntax-table previous-syntax-table) |
10705 | 4071 |
4072 (if found | |
4073 (cons begin end) | |
4074 nil))) | |
4075 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4076 ;; ------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4077 ;; -- Testing the position of the cursor |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4078 ;; ------------------------------------------------------- |
10705 | 4079 |
4080 (defun ada-in-decl-p () | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4081 "Returns t if point is inside a declarative part. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4082 Assumes point to be at the end of a statement." |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4083 (or (ada-in-paramlist-p) |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4084 (save-excursion |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4085 (ada-goto-matching-decl-start t)))) |
10705 | 4086 |
4087 | |
4088 (defun ada-looking-at-semi-or () | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4089 "Returns t if looking-at an 'or' following a semicolon." |
10705 | 4090 (save-excursion |
4091 (and (looking-at "\\<or\\>") | |
4092 (progn | |
4093 (forward-word 1) | |
4094 (ada-goto-stmt-start) | |
4095 (looking-at "\\<or\\>"))))) | |
4096 | |
4097 | |
4098 (defun ada-looking-at-semi-private () | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4099 "Returns t if looking at the start of a private section in a package. |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4100 Returns nil if the private is part of the package name, as in |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4101 'private package A is...' (this can only happen at top level)." |
10705 | 4102 (save-excursion |
4103 (and (looking-at "\\<private\\>") | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4104 (not (looking-at "\\<private[ \t]*\\(package\\|generic\\)")) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4105 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4106 ;; Make sure this is the start of a private section (ie after |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4107 ;; a semicolon or just after the package declaration, but not |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4108 ;; after a 'type ... is private' or 'is new ... with private' |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4109 ;; |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4110 ;; Note that a 'private' statement at the beginning of the buffer |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4111 ;; does not indicate a private section, since this is instead a |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4112 ;; 'private procedure ...' |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
4113 (progn (forward-comment -1000) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4114 (and (not (bobp)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4115 (or (= (char-before) ?\;) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4116 (and (forward-word -3) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4117 (looking-at "\\<package\\>")))))))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4118 |
10705 | 4119 |
4120 (defun ada-in-paramlist-p () | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4121 "Returns t if point is inside a parameter-list." |
10705 | 4122 (save-excursion |
4123 (and | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4124 (ada-search-ignore-string-comment "(\\|)" t nil t) |
10705 | 4125 ;; inside parentheses ? |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4126 (= (char-after) ?\() |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4127 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4128 ;; We could be looking at two things here: |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4129 ;; operator definition: function "." ( |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4130 ;; subprogram definition: procedure .... ( |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4131 ;; Let's skip back over the first one |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4132 (progn |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4133 (skip-chars-backward " \t\n") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4134 (if (= (char-before) ?\") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4135 (backward-char 3) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4136 (backward-word 1)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4137 t) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4138 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4139 ;; and now over the second one |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4140 (backward-word 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4141 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4142 ;; We should ignore the case when the reserved keyword is in a |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4143 ;; comment (for instance, when we have: |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4144 ;; -- .... package |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4145 ;; Test (A) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4146 ;; we should return nil |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4147 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4148 (not (ada-in-string-or-comment-p)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4149 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4150 ;; right keyword two words before parenthesis ? |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4151 ;; Type is in this list because of discriminants |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4152 (looking-at (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4153 (concat "\\<\\(" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4154 "procedure\\|function\\|body\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4155 "task\\|entry\\|accept\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4156 "access[ \t]+procedure\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4157 "access[ \t]+function\\|" |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4158 "pragma\\|" |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4159 "type\\)\\>")))))) |
10705 | 4160 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4161 (defun ada-search-ignore-complex-boolean (regexp backwardp) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4162 "Like `ada-search-ignore-string-comment', except that it also ignores |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4163 boolean expressions 'and then' and 'or else'." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4164 (let (result) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4165 (while (and (setq result (ada-search-ignore-string-comment regexp backwardp)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4166 (save-excursion (forward-word -1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4167 (looking-at "and then\\|or else")))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4168 result)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4169 |
10705 | 4170 (defun ada-in-open-paren-p () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4171 "Returns the position of the first non-ws behind the last unclosed |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4172 parenthesis, or nil." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4173 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4174 (let ((parse (parse-partial-sexp |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4175 (point) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4176 (or (car (ada-search-ignore-complex-boolean |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4177 "\\<\\(;\\|is\\|then\\|loop\\|begin\\|else\\)\\>" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4178 t)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4179 (point-min))))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4180 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4181 (if (nth 1 parse) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4182 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4183 (goto-char (1+ (nth 1 parse))) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4184 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4185 ;; Skip blanks, if they are not followed by a comment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4186 ;; See: |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4187 ;; type A is ( Value_0, |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4188 ;; Value_1); |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4189 ;; type B is ( -- comment |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4190 ;; Value_2); |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4191 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4192 (if (or (not ada-indent-handle-comment-special) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4193 (not (looking-at "[ \t]+--"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4194 (skip-chars-forward " \t")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4195 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4196 (point)))))) |
10705 | 4197 |
4198 | |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4199 ;; ----------------------------------------------------------- |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4200 ;; -- Behavior Of TAB Key |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4201 ;; ----------------------------------------------------------- |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4202 |
10705 | 4203 (defun ada-tab () |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4204 "Do indenting or tabbing according to `ada-tab-policy'. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4205 In Transient Mark mode, if the mark is active, operate on the contents |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4206 of the region. Otherwise, operates only on the current line." |
10705 | 4207 (interactive) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4208 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-tab-hard)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4209 ((eq ada-tab-policy 'indent-auto) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4210 (if (ada-region-selected) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4211 (ada-indent-region (region-beginning) (region-end)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4212 (ada-indent-current))) |
10705 | 4213 ((eq ada-tab-policy 'always-tab) (error "not implemented")) |
4214 )) | |
4215 | |
4216 (defun ada-untab (arg) | |
4217 "Delete leading indenting according to `ada-tab-policy'." | |
4218 (interactive "P") | |
4219 (cond ((eq ada-tab-policy 'indent-rigidly) (ada-untab-hard)) | |
4220 ((eq ada-tab-policy 'indent-auto) (error "not implemented")) | |
4221 ((eq ada-tab-policy 'always-tab) (error "not implemented")) | |
4222 )) | |
4223 | |
4224 (defun ada-indent-current-function () | |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4225 "Ada mode version of the indent-line-function." |
10705 | 4226 (interactive "*") |
4227 (let ((starting-point (point-marker))) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4228 (beginning-of-line) |
10705 | 4229 (ada-tab) |
4230 (if (< (point) starting-point) | |
4231 (goto-char starting-point)) | |
4232 (set-marker starting-point nil) | |
4233 )) | |
4234 | |
4235 (defun ada-tab-hard () | |
4236 "Indent current line to next tab stop." | |
4237 (interactive) | |
4238 (save-excursion | |
4239 (beginning-of-line) | |
4240 (insert-char ? ada-indent)) | |
4241 (if (save-excursion (= (point) (progn (beginning-of-line) (point)))) | |
4242 (forward-char ada-indent))) | |
4243 | |
4244 (defun ada-untab-hard () | |
4245 "indent current line to previous tab stop." | |
4246 (interactive) | |
4247 (let ((bol (save-excursion (progn (beginning-of-line) (point)))) | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4248 (eol (save-excursion (progn (end-of-line) (point))))) |
10705 | 4249 (indent-rigidly bol eol (- 0 ada-indent)))) |
4250 | |
4251 | |
4252 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4253 ;; ------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4254 ;; -- Miscellaneous |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4255 ;; ------------------------------------------------------------ |
10705 | 4256 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4257 ;; Not needed any more for Emacs 21.2, but still needed for backward |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4258 ;; compatibility |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4259 (defun ada-remove-trailing-spaces () |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4260 "Remove trailing spaces in the whole buffer." |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4261 (interactive) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4262 (save-match-data |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4263 (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4264 (save-restriction |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4265 (widen) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4266 (goto-char (point-min)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4267 (while (re-search-forward "[ \t]+$" (point-max) t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4268 (replace-match "" nil nil)))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4269 |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4270 (defun ada-gnat-style () |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4271 "Clean up comments, `(' and `,' for GNAT style checking switch." |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4272 (interactive) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4273 (save-excursion |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4274 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4275 ;; The \n is required, or the line after an empty comment line is |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4276 ;; simply ignored. |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4277 (goto-char (point-min)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4278 (while (re-search-forward "--[ \t]*\\([^-\n]\\)" nil t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4279 (replace-match "-- \\1") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4280 (forward-line 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4281 (beginning-of-line)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4282 |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4283 (goto-char (point-min)) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4284 (while (re-search-forward "\\>(" nil t) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4285 (if (not (ada-in-string-or-comment-p)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4286 (replace-match " ("))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4287 (goto-char (point-min)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4288 (while (re-search-forward ";--" nil t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4289 (forward-char -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4290 (if (not (ada-in-string-or-comment-p)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4291 (replace-match "; --"))) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4292 (goto-char (point-min)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4293 (while (re-search-forward "([ \t]+" nil t) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4294 (if (not (ada-in-string-or-comment-p)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4295 (replace-match "("))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4296 (goto-char (point-min)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4297 (while (re-search-forward ")[ \t]+)" nil t) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4298 (if (not (ada-in-string-or-comment-p)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4299 (replace-match "))"))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4300 (goto-char (point-min)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4301 (while (re-search-forward "\\>:" nil t) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4302 (if (not (ada-in-string-or-comment-p)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4303 (replace-match " :"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4304 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4305 ;; Make sure there is a space after a ','. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4306 ;; Always go back to the beginning of the match, since otherwise |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4307 ;; a statement like ('F','D','E') is incorrectly modified. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4308 (goto-char (point-min)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4309 (while (re-search-forward ",[ \t]*\\(.\\)" nil t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4310 (if (not (save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4311 (goto-char (match-beginning 0)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4312 (ada-in-string-or-comment-p))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4313 (replace-match ", \\1"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4314 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4315 ;; Operators should be surrounded by spaces. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4316 (goto-char (point-min)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4317 (while (re-search-forward |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4318 "[ \t]*\\(/=\\|\\*\\*\\|:=\\|\\.\\.\\|[-:+*/]\\)[ \t]*" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4319 nil t) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4320 (goto-char (match-beginning 1)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4321 (if (or (looking-at "--") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4322 (ada-in-string-or-comment-p)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4323 (progn |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4324 (forward-line 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4325 (beginning-of-line)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4326 (cond |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4327 ((string= (match-string 1) "/=") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4328 (replace-match " /= ")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4329 ((string= (match-string 1) "..") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4330 (replace-match " .. ")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4331 ((string= (match-string 1) "**") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4332 (replace-match " ** ")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4333 ((string= (match-string 1) ":=") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4334 (replace-match " := ")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4335 (t |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4336 (replace-match " \\1 "))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4337 (forward-char 1))) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4338 )) |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4339 |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4340 |
10705 | 4341 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4342 ;; ------------------------------------------------------------- |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4343 ;; -- Moving To Procedures/Packages/Statements |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4344 ;; ------------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4345 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4346 (defun ada-move-to-start () |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4347 "Moves point to the matching start of the current Ada structure." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4348 (interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4349 (let ((pos (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4350 (previous-syntax-table (syntax-table))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4351 (unwind-protect |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4352 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4353 (set-syntax-table ada-mode-symbol-syntax-table) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4354 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4355 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4356 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4357 ;; do nothing if in string or comment or not on 'end ...;' |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4358 ;; or if an error occurs during processing |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4359 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4360 (or |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4361 (ada-in-string-or-comment-p) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4362 (and (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4363 (or (looking-at "[ \t]*\\<end\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4364 (backward-word 1)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4365 (or (looking-at "[ \t]*\\<end\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4366 (backward-word 1)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4367 (or (looking-at "[ \t]*\\<end\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4368 (error "not on end ...;"))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4369 (ada-goto-matching-start 1) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4370 (setq pos (point)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4371 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4372 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4373 ;; on 'begin' => go on, according to user option |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4374 ;; |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4375 ada-move-to-declaration |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4376 (looking-at "\\<begin\\>") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4377 (ada-goto-matching-decl-start) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4378 (setq pos (point)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4379 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4380 ) ; end of save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4381 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4382 ;; now really move to the found position |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4383 (goto-char pos)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4384 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4385 ;; restore syntax-table |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4386 (set-syntax-table previous-syntax-table)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4387 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4388 (defun ada-move-to-end () |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4389 "Moves point to the matching end of the block around point. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4390 Moves to 'begin' if in a declarative part." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4391 (interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4392 (let ((pos (point)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4393 decl-start |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4394 (previous-syntax-table (syntax-table))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4395 (unwind-protect |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4396 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4397 (set-syntax-table ada-mode-symbol-syntax-table) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4398 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4399 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4400 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4401 (cond |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4402 ;; Go to the beginning of the current word, and check if we are |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4403 ;; directly on 'begin' |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4404 ((save-excursion |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4405 (skip-syntax-backward "w") |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4406 (looking-at "\\<begin\\>")) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4407 (ada-goto-matching-end 1)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4408 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4409 ;; on first line of subprogram body |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4410 ;; Do nothing for specs or generic instantion, since these are |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4411 ;; handled as the general case (find the enclosing block) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4412 ;; We also need to make sure that we ignore nested subprograms |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4413 ((save-excursion |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4414 (and (skip-syntax-backward "w") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4415 (looking-at "\\<function\\>\\|\\<procedure\\>" ) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4416 (ada-search-ignore-string-comment "is\\|;") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4417 (not (= (char-before) ?\;)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4418 )) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4419 (skip-syntax-backward "w") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4420 (ada-goto-matching-end 0 t)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4421 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4422 ;; on first line of task declaration |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4423 ((save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4424 (and (ada-goto-stmt-start) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4425 (looking-at "\\<task\\>" ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4426 (forward-word 1) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4427 (ada-goto-next-non-ws) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4428 (looking-at "\\<body\\>"))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4429 (ada-search-ignore-string-comment "begin" nil nil nil |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4430 'word-search-forward)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4431 ;; accept block start |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4432 ((save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4433 (and (ada-goto-stmt-start) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4434 (looking-at "\\<accept\\>" ))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4435 (ada-goto-matching-end 0)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4436 ;; package start |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4437 ((save-excursion |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4438 (setq decl-start (and (ada-goto-matching-decl-start t) (point))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4439 (and decl-start (looking-at "\\<package\\>"))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4440 (ada-goto-matching-end 1)) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4441 |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4442 ;; On a "declare" keyword |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4443 ((save-excursion |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4444 (skip-syntax-backward "w") |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4445 (looking-at "\\<declare\\>")) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4446 (ada-goto-matching-end 0 t)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4447 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4448 ;; inside a 'begin' ... 'end' block |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4449 (decl-start |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4450 (goto-char decl-start) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4451 (ada-goto-matching-end 0 t)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4452 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4453 ;; (hopefully ;-) everything else |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4454 (t |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4455 (ada-goto-matching-end 1))) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4456 (setq pos (point)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4457 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4458 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4459 ;; now really move to the position found |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4460 (goto-char pos)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4461 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4462 ;; restore syntax-table |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4463 (set-syntax-table previous-syntax-table)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4464 |
10705 | 4465 (defun ada-next-procedure () |
4466 "Moves point to next procedure." | |
4467 (interactive) | |
4468 (end-of-line) | |
4469 (if (re-search-forward ada-procedure-start-regexp nil t) | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4470 (goto-char (match-beginning 2)) |
10705 | 4471 (error "No more functions/procedures/tasks"))) |
4472 | |
4473 (defun ada-previous-procedure () | |
4474 "Moves point to previous procedure." | |
4475 (interactive) | |
4476 (beginning-of-line) | |
4477 (if (re-search-backward ada-procedure-start-regexp nil t) | |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4478 (goto-char (match-beginning 2)) |
10705 | 4479 (error "No more functions/procedures/tasks"))) |
4480 | |
4481 (defun ada-next-package () | |
4482 "Moves point to next package." | |
4483 (interactive) | |
4484 (end-of-line) | |
4485 (if (re-search-forward ada-package-start-regexp nil t) | |
4486 (goto-char (match-beginning 1)) | |
4487 (error "No more packages"))) | |
4488 | |
4489 (defun ada-previous-package () | |
4490 "Moves point to previous package." | |
4491 (interactive) | |
4492 (beginning-of-line) | |
4493 (if (re-search-backward ada-package-start-regexp nil t) | |
4494 (goto-char (match-beginning 1)) | |
4495 (error "No more packages"))) | |
4496 | |
4497 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4498 ;; ------------------------------------------------------------ |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4499 ;; -- Define keymap and menus for Ada |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4500 ;; ------------------------------------------------------------- |
10705 | 4501 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4502 (defun ada-create-keymap () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4503 "Create the keymap associated with the Ada mode." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4504 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4505 ;; Indentation and Formatting |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4506 (define-key ada-mode-map "\C-j" 'ada-indent-newline-indent-conditional) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4507 (define-key ada-mode-map "\C-m" 'ada-indent-newline-indent-conditional) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4508 (define-key ada-mode-map "\t" 'ada-tab) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4509 (define-key ada-mode-map "\C-c\t" 'ada-justified-indent-current) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4510 (define-key ada-mode-map "\C-c\C-l" 'ada-indent-region) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4511 (if ada-xemacs |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4512 (define-key ada-mode-map '(shift tab) 'ada-untab) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4513 (define-key ada-mode-map [(shift tab)] 'ada-untab)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4514 (define-key ada-mode-map "\C-c\C-f" 'ada-format-paramlist) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4515 ;; We don't want to make meta-characters case-specific. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4516 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4517 ;; Movement |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4518 (define-key ada-mode-map "\M-\C-e" 'ada-next-procedure) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4519 (define-key ada-mode-map "\M-\C-a" 'ada-previous-procedure) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4520 (define-key ada-mode-map "\C-c\C-a" 'ada-move-to-start) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4521 (define-key ada-mode-map "\C-c\C-e" 'ada-move-to-end) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4522 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4523 ;; Compilation |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4524 (unless (lookup-key ada-mode-map "\C-c\C-c") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4525 (define-key ada-mode-map "\C-c\C-c" 'compile)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4526 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4527 ;; Casing |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4528 (define-key ada-mode-map "\C-c\C-b" 'ada-adjust-case-buffer) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4529 (define-key ada-mode-map "\C-c\C-t" 'ada-case-read-exceptions) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4530 (define-key ada-mode-map "\C-c\C-y" 'ada-create-case-exception) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4531 (define-key ada-mode-map "\C-c\C-\M-y" 'ada-create-case-exception-substring) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4532 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4533 ;; On XEmacs, you can easily specify whether DEL should deletes |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4534 ;; one character forward or one character backward. Take this into |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4535 ;; account |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4536 (if (boundp 'delete-key-deletes-forward) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4537 (define-key ada-mode-map [backspace] 'backward-delete-char-untabify) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4538 (define-key ada-mode-map "\177" 'backward-delete-char-untabify)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4539 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4540 ;; Make body |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4541 (define-key ada-mode-map "\C-c\C-n" 'ada-make-subprogram-body) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4542 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4543 ;; Use predefined function of Emacs19 for comments (RE) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4544 (define-key ada-mode-map "\C-c;" 'comment-region) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4545 (define-key ada-mode-map "\C-c:" 'ada-uncomment-region) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4546 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4547 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4548 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4549 (defun ada-create-menu () |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4550 "Create the ada menu as shown in the menu bar. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4551 This function is designed to be extensible, so that each compiler-specific file |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4552 can add its own items." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4553 ;; Note that the separators must have different length in the submenus |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4554 (autoload 'easy-menu-define "easymenu") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4555 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4556 (let ((m '("Ada" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4557 ("Help" ["Ada Mode" (info "ada-mode") t]))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4558 (option '(["Auto Casing" (setq ada-auto-case (not ada-auto-case)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4559 :style toggle :selected ada-auto-case] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4560 ["Auto Indent After Return" |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4561 (setq ada-indent-after-return (not ada-indent-after-return)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4562 :style toggle :selected ada-indent-after-return])) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4563 (goto '(["Next compilation error" next-error t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4564 ["Previous Package" ada-previous-package t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4565 ["Next Package" ada-next-package t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4566 ["Previous Procedure" ada-previous-procedure t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4567 ["Next Procedure" ada-next-procedure t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4568 ["Goto Start Of Statement" ada-move-to-start t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4569 ["Goto End Of Statement" ada-move-to-end t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4570 ["-" nil nil] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4571 ["Other File" ff-find-other-file t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4572 ["Other File Other Window" ada-ff-other-window t])) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4573 (edit '(["Indent Line" ada-indent-current-function t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4574 ["Justify Current Indentation" ada-justified-indent-current t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4575 ["Indent Lines in Selection" ada-indent-region t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4576 ["Indent Lines in File" (ada-indent-region (point-min) (point-max)) t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4577 ["Format Parameter List" ada-format-paramlist t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4578 ["-" nil nil] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4579 ["Comment Selection" comment-region t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4580 ["Uncomment Selection" ada-uncomment-region t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4581 ["--" nil nil] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4582 ["Fill Comment Paragraph" fill-paragraph t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4583 ["Fill Comment Paragraph Justify" ada-fill-comment-paragraph-justify t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4584 ["Fill Comment Paragraph Postfix" ada-fill-comment-paragraph-postfix t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4585 ["---" nil nil] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4586 ["Adjust Case Selection" ada-adjust-case-region t] |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4587 ["Adjust Case in File" ada-adjust-case-buffer t] |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4588 ["Create Case Exception" ada-create-case-exception t] |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4589 ["Create Case Exception Substring" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4590 ada-create-case-exception-substring t] |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4591 ["Reload Case Exceptions" ada-case-read-exceptions t] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4592 ["----" nil nil] |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4593 ["Make body for subprogram" ada-make-subprogram-body t])) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4594 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4595 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4596 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4597 ;; Option menu present only if in Ada mode |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4598 (setq m (append m (list (append '("Options" |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4599 :included '(eq major-mode 'ada-mode)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4600 option)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4601 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4602 ;; Customize menu always present |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4603 (when (fboundp 'customize-group) |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4604 (setq m (append m '(["Customize" (customize-group 'ada)])))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4605 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4606 ;; Goto and Edit menus present only if in Ada mode |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4607 (setq m (append m (list (append '("Goto" |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4608 :included (eq major-mode 'ada-mode)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4609 goto) |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4610 (append '("Edit" |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4611 :included (eq major-mode 'ada-mode)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4612 edit)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4613 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4614 (easy-menu-define ada-mode-menu ada-mode-map "Menu keymap for Ada mode" m) |
38446
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4615 (easy-menu-add ada-mode-menu ada-mode-map) |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4616 (when ada-xemacs |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4617 ;; This looks bogus to me! -stef |
f63fbebe03fb
(ada-mode): Avoid unneeded version checks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
4618 (define-key ada-mode-map [menu-bar] ada-mode-menu) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4619 (set 'mode-popup-menu (cons "Ada mode" ada-mode-menu))))) |
10705 | 4620 |
4621 | |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4622 ;; ------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4623 ;; Commenting/Uncommenting code |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4624 ;; The following two calls are provided to enhance the standard |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4625 ;; comment-region function, which only allows uncommenting if the |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4626 ;; comment is at the beginning of a line. If the line have been re-indented, |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4627 ;; we are unable to use comment-region, which makes no sense. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4628 ;; |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4629 ;; In addition, we provide an interface to the standard comment handling |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4630 ;; function for justifying the comments. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4631 ;; ------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4632 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4633 (defadvice comment-region (before ada-uncomment-anywhere disable) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4634 (if (and arg |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4635 (listp arg) ;; a prefix with \C-u is of the form '(4), whereas |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4636 ;; \C-u 2 sets arg to '2' (fixed by S.Leake) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4637 (string= mode-name "Ada")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4638 (save-excursion |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4639 (let ((cs (concat "^[ \t]*" (regexp-quote comment-start)))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4640 (goto-char beg) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4641 (while (re-search-forward cs end t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4642 (replace-match comment-start)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4643 )))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4644 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4645 (defun ada-uncomment-region (beg end &optional arg) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4646 "Delete `comment-start' at the beginning of a line in the region." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4647 (interactive "r\nP") |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4648 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4649 ;; This advice is not needed anymore with Emacs21. However, for older |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4650 ;; versions, as well as for XEmacs, we still need to enable it. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4651 (if (or (<= emacs-major-version 20) (boundp 'running-xemacs)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4652 (progn |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4653 (ad-activate 'comment-region) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4654 (comment-region beg end (- (or arg 2))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4655 (ad-deactivate 'comment-region)) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4656 (comment-region beg end (list (- (or arg 2)))) |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4657 (ada-indent-region beg end))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4658 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4659 (defun ada-fill-comment-paragraph-justify () |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4660 "Fills current comment paragraph and justifies each line as well." |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4661 (interactive) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4662 (ada-fill-comment-paragraph 'full)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4663 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4664 (defun ada-fill-comment-paragraph-postfix () |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4665 "Fills current comment paragraph and justifies each line as well. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4666 Adds `ada-fill-comment-postfix' at the end of each line." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4667 (interactive) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4668 (ada-fill-comment-paragraph 'full t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4669 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4670 (defun ada-fill-comment-paragraph (&optional justify postfix) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4671 "Fills the current comment paragraph. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4672 If JUSTIFY is non-nil, each line is justified as well. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4673 If POSTFIX and JUSTIFY are non-nil, `ada-fill-comment-postfix' is appended |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4674 to each filled and justified line. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4675 The paragraph is indented on the first line." |
10705 | 4676 (interactive "P") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4677 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4678 ;; check if inside comment or just in front a comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4679 (if (and (not (ada-in-comment-p)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4680 (not (looking-at "[ \t]*--"))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4681 (error "not inside comment")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4682 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4683 (let* (indent from to |
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4684 (opos (point-marker)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4685 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4686 ;; Sets this variable to nil, otherwise it prevents |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4687 ;; fill-region-as-paragraph to work on Emacs <= 20.2 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4688 (parse-sexp-lookup-properties nil) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4689 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4690 fill-prefix |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4691 (fill-column (current-fill-column))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4692 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4693 ;; Find end of paragraph |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4694 (back-to-indentation) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4695 (while (and (not (eobp)) (looking-at ".*--[ \t]*[^ \t\n]")) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4696 (forward-line 1) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4697 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4698 ;; If we were at the last line in the buffer, create a dummy empty |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4699 ;; line at the end of the buffer. |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4700 (if (eobp) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4701 (insert "\n") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4702 (back-to-indentation))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4703 (beginning-of-line) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4704 (setq to (point-marker)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4705 (goto-char opos) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4706 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4707 ;; Find beginning of paragraph |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4708 (back-to-indentation) |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4709 (while (and (not (bobp)) (looking-at ".*--[ \t]*[^ \t\n]")) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4710 (forward-line -1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4711 (back-to-indentation)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4712 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4713 ;; We want one line above the first one, unless we are at the beginning |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4714 ;; of the buffer |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4715 (unless (bobp) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4716 (forward-line 1)) |
41036
aaa6f44a1b96
(ada-fill-comment-prefix): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
41012
diff
changeset
|
4717 (beginning-of-line) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4718 (setq from (point-marker)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4719 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4720 ;; Calculate the indentation we will need for the paragraph |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4721 (back-to-indentation) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4722 (setq indent (current-column)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4723 ;; unindent the first line of the paragraph |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4724 (delete-region from (point)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4725 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4726 ;; Remove the old postfixes |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4727 (goto-char from) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4728 (while (re-search-forward "--\n" to t) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4729 (replace-match "\n")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4730 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4731 (goto-char (1- to)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4732 (setq to (point-marker)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4733 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4734 ;; Indent and justify the paragraph |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4735 (setq fill-prefix ada-fill-comment-prefix) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4736 (set-left-margin from to indent) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4737 (if postfix |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4738 (setq fill-column (- fill-column (length ada-fill-comment-postfix)))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4739 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4740 (fill-region-as-paragraph from to justify) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4741 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4742 ;; Add the postfixes if required |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4743 (if postfix |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4744 (save-restriction |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4745 (goto-char from) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4746 (narrow-to-region from to) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4747 (while (not (eobp)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4748 (end-of-line) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4749 (insert-char ? (- fill-column (current-column))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4750 (insert ada-fill-comment-postfix) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4751 (forward-line)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4752 )) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4753 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4754 ;; In Emacs <= 20.2 and XEmacs <=20.4, there is a bug, and a newline is |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4755 ;; inserted at the end. Delete it |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4756 (if (or ada-xemacs |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4757 (<= emacs-major-version 19) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4758 (and (= emacs-major-version 20) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4759 (<= emacs-minor-version 2))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4760 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4761 (goto-char to) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4762 (end-of-line) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4763 (delete-char 1))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4764 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4765 (goto-char opos))) |
10705 | 4766 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4767 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4768 ;; --------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4769 ;; support for find-file.el |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4770 ;; These functions are used by find-file to guess the file names from |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4771 ;; unit names, and to find the other file (spec or body) from the current |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4772 ;; file (body or spec). |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4773 ;; It is also used to find in which function we are, so as to put the |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4774 ;; cursor at the correct position. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4775 ;; Standard Ada does not force any relation between unit names and file names, |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4776 ;; so some of these functions can only be a good approximation. However, they |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4777 ;; are also overriden in `ada-xref'.el when we know that the user is using |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4778 ;; GNAT. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4779 ;; --------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4780 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4781 ;; Overriden when we work with GNAT, to use gnatkrunch |
10705 | 4782 (defun ada-make-filename-from-adaname (adaname) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4783 "Determine the filename in which ADANAME is found. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4784 This is a generic function, independent from any compiler." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4785 (while (string-match "\\." adaname) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4786 (setq adaname (replace-match "-" t t adaname))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4787 (downcase adaname) |
10705 | 4788 ) |
4789 | |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4790 (defun ada-other-file-name () |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4791 "Return the name of the other file. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4792 The name returned is the body if current-buffer is the spec, or the spec |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4793 otherwise." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4794 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4795 (let ((is-spec nil) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4796 (is-body nil) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4797 (suffixes ada-spec-suffixes) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4798 (name (buffer-file-name))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4799 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4800 ;; Guess whether we have a spec or a body, and get the basename of the |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4801 ;; file. Since the extension may not start with '.', we can not use |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4802 ;; file-name-extension |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4803 (while (and (not is-spec) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4804 suffixes) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4805 (if (string-match (concat "\\(.*\\)" (car suffixes) "$") name) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4806 (setq is-spec t |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4807 name (match-string 1 name))) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4808 (setq suffixes (cdr suffixes))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4809 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4810 (if (not is-spec) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4811 (progn |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4812 (setq suffixes ada-body-suffixes) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4813 (while (and (not is-body) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4814 suffixes) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4815 (if (string-match (concat "\\(.*\\)" (car suffixes) "$") name) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4816 (setq is-body t |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4817 name (match-string 1 name))) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4818 (setq suffixes (cdr suffixes))))) |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
4819 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4820 ;; If this wasn't in either list, return name itself |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4821 (if (not (or is-spec is-body)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4822 name |
33786
9f63b158eb6b
* simple.el (delete-trailing-whitespace): New interactive function.
Sam Steingold <sds@gnu.org>
parents:
33716
diff
changeset
|
4823 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4824 ;; Else find the other possible names |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4825 (if is-spec |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4826 (setq suffixes ada-body-suffixes) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4827 (setq suffixes ada-spec-suffixes)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4828 (setq is-spec name) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4829 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4830 (while suffixes |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4831 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4832 ;; If we are using project file, search for the other file in all |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4833 ;; the possible src directories. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4834 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4835 (if (functionp 'ada-find-src-file-in-dir) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4836 (let ((other |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4837 (ada-find-src-file-in-dir |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4838 (file-name-nondirectory (concat name (car suffixes)))))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4839 (if other |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4840 (set 'is-spec other))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4841 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4842 ;; Else search in the current directory |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4843 (if (file-exists-p (concat name (car suffixes))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4844 (setq is-spec (concat name (car suffixes))))) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4845 (setq suffixes (cdr suffixes))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4846 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4847 is-spec))) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
4848 |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
4849 (defun ada-which-function-are-we-in () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4850 "Return the name of the function whose definition/declaration point is in. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4851 Redefines the function `ff-which-function-are-we-in'." |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4852 (setq ff-function-name nil) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
4853 (save-excursion |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4854 (end-of-line);; make sure we get the complete name |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4855 (if (or (re-search-backward ada-procedure-start-regexp nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4856 (re-search-backward ada-package-start-regexp nil t)) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4857 (setq ff-function-name (match-string 0))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4858 )) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4859 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4860 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4861 (defvar ada-last-which-function-line -1 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4862 "Last on which ada-which-function was called") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4863 (defvar ada-last-which-function-subprog 0 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4864 "Last subprogram name returned by ada-which-function") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4865 (make-variable-buffer-local 'ada-last-which-function-subprog) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4866 (make-variable-buffer-local 'ada-last-which-function-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4867 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4868 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4869 (defun ada-which-function () |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4870 "Returns the name of the function whose body the point is in. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4871 This function works even in the case of nested subprograms, whereas the |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4872 standard Emacs function `which-function' does not. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4873 Since the search can be long, the results are cached." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4874 |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4875 (let ((line (count-lines 1 (point))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4876 (pos (point)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4877 end-pos |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4878 func-name indent |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4879 found) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4880 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4881 ;; If this is the same line as before, simply return the same result |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4882 (if (= line ada-last-which-function-line) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4883 ada-last-which-function-subprog |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4884 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4885 (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4886 ;; In case the current line is also the beginning of the body |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4887 (end-of-line) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4888 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4889 ;; Are we looking at "function Foo\n (paramlist)" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4890 (skip-chars-forward " \t\n(") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4891 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4892 (condition-case nil |
45931
a4c8d672ccbe
* progmodes/ada-mode.el: Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44933
diff
changeset
|
4893 (up-list 1) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4894 (error nil)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4895 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4896 (skip-chars-forward " \t\n") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4897 (if (looking-at "return") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4898 (progn |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4899 (forward-word 1) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4900 (skip-chars-forward " \t\n") |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4901 (skip-chars-forward "a-zA-Z0-9_'"))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4902 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4903 ;; Can't simply do forward-word, in case the "is" is not on the |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4904 ;; same line as the closing parenthesis |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4905 (skip-chars-forward "is \t\n") |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4906 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4907 ;; No look for the closest subprogram body that has not ended yet. |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4908 ;; Not that we expect all the bodies to be finished by "end <name>", |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4909 ;; or a simple "end;" indented in the same column as the start of |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4910 ;; the subprogram. The goal is to be as efficient as possible. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4911 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4912 (while (and (not found) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4913 (re-search-backward ada-imenu-subprogram-menu-re nil t)) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4914 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4915 ;; Get the function name, but not the properties, or this changes |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4916 ;; the face in the modeline on Emacs 21 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4917 (setq func-name (match-string-no-properties 2)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4918 (if (and (not (ada-in-comment-p)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4919 (not (save-excursion |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4920 (goto-char (match-end 0)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4921 (looking-at "[ \t\n]*new")))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4922 (save-excursion |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4923 (back-to-indentation) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4924 (setq indent (current-column)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4925 (if (ada-search-ignore-string-comment |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4926 (concat "end[ \t]+" func-name "[ \t]*;\\|^" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4927 (make-string indent ? ) "end;")) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4928 (setq end-pos (point)) |
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4929 (setq end-pos (point-max))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4930 (if (>= end-pos pos) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4931 (setq found func-name)))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4932 ) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4933 (setq ada-last-which-function-line line |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4934 ada-last-which-function-subprog found) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4935 found)))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4936 |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4937 (defun ada-ff-other-window () |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4938 "Find other file in other window using `ff-find-other-file'." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4939 (interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4940 (and (fboundp 'ff-find-other-file) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4941 (ff-find-other-file t))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4942 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4943 (defun ada-set-point-accordingly () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4944 "Move to the function declaration that was set by |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4945 `ff-which-function-are-we-in'." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4946 (if ff-function-name |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4947 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4948 (goto-char (point-min)) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4949 (unless (ada-search-ignore-string-comment |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4950 (concat ff-function-name "\\b") nil) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
4951 (goto-char (point-min)))))) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
4952 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4953 (defun ada-get-body-name (&optional spec-name) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4954 "Returns the file name for the body of SPEC-NAME. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4955 If SPEC-NAME is nil, returns the body for the current package. |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4956 Returns nil if no body was found." |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4957 (interactive) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4958 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
4959 (unless spec-name (setq spec-name (buffer-file-name))) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4960 |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4961 ;; Remove the spec extension. We can not simply remove the file extension, |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4962 ;; but we need to take into account the specific non-GNAT extensions that the |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4963 ;; user might have specified. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4964 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4965 (let ((suffixes ada-spec-suffixes) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4966 end) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4967 (while suffixes |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4968 (setq end (- (length spec-name) (length (car suffixes)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4969 (if (string-equal (car suffixes) (substring spec-name end)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4970 (setq spec-name (substring spec-name 0 end))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4971 (setq suffixes (cdr suffixes)))) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
4972 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4973 ;; If find-file.el was available, use its functions |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4974 (if (functionp 'ff-get-file) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4975 (ff-get-file-name ada-search-directories |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4976 (ada-make-filename-from-adaname |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4977 (file-name-nondirectory |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4978 (file-name-sans-extension spec-name))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4979 ada-body-suffixes) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4980 ;; Else emulate it very simply |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4981 (concat (ada-make-filename-from-adaname |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4982 (file-name-nondirectory |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4983 (file-name-sans-extension spec-name))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4984 ".adb"))) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
4985 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4986 |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4987 ;; --------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4988 ;; support for font-lock.el |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4989 ;; Strings are a real pain in Ada because a single quote character is |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4990 ;; overloaded as a string quote and type/instance delimiter. By default, a |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4991 ;; single quote is given punctuation syntax in `ada-mode-syntax-table'. |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4992 ;; So, for Font Lock mode purposes, we mark single quotes as having string |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4993 ;; syntax when the gods that created Ada determine them to be. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4994 ;; |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4995 ;; This only works in Emacs. See the comments before the grammar functions |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4996 ;; at the beginning of this file for how this is done with XEmacs. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
4997 ;; ---------------------------------------------------- |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4998 |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
4999 (defconst ada-font-lock-syntactic-keywords |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
5000 ;; Mark single quotes as having string quote syntax in 'c' instances. |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5001 ;; As a special case, ''' will not be highlighted, but if we do not |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5002 ;; set this special case, then the rest of the buffer is highlighted as |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5003 ;; a string |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5004 ;; This sets the properties of the characters, so that ada-in-string-p |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5005 ;; correctly handles '"' too... |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5006 '(("[^a-zA-Z0-9)]\\('\\)[^'\n]\\('\\)" (1 (7 . ?')) (2 (7 . ?'))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5007 ("^[ \t]*\\(#\\(if\\|else\\|elsif\\|end\\)\\)" (1 (11 . ?\n))) |
10705 | 5008 )) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5009 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5010 (defvar ada-font-lock-keywords |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5011 (eval-when-compile |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5012 (list |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5013 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5014 ;; handle "type T is access function return S;" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5015 (list "\\<\\(function[ \t]+return\\)\\>" '(1 font-lock-keyword-face) ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5016 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5017 ;; preprocessor line |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5018 (list "^[ \t]*\\(#.*\n\\)" '(1 font-lock-type-face t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5019 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5020 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5021 ;; accept, entry, function, package (body), protected (body|type), |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5022 ;; pragma, procedure, task (body) plus name. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5023 (list (concat |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5024 "\\<\\(" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5025 "accept\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5026 "entry\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5027 "function\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5028 "package[ \t]+body\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5029 "package\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5030 "pragma\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5031 "procedure\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5032 "protected[ \t]+body\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5033 "protected[ \t]+type\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5034 "protected\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5035 "task[ \t]+body\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5036 "task[ \t]+type\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5037 "task" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5038 "\\)\\>[ \t]*" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5039 "\\(\\sw+\\(\\.\\sw*\\)*\\)?") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5040 '(1 font-lock-keyword-face) '(2 font-lock-function-name-face nil t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5041 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5042 ;; Optional keywords followed by a type name. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5043 (list (concat ; ":[ \t]*" |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5044 "\\<\\(access[ \t]+all\\|access[ \t]+constant\\|access\\|constant\\|in[ \t]+reverse\\|\\|in[ \t]+out\\|in\\|out\\)\\>" |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5045 "[ \t]*" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5046 "\\(\\sw+\\(\\.\\sw*\\)*\\)?") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5047 '(1 font-lock-keyword-face nil t) '(2 font-lock-type-face nil t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5048 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5049 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5050 ;; Main keywords, except those treated specially below. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5051 (concat "\\<" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5052 (regexp-opt |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5053 '("abort" "abs" "abstract" "accept" "access" "aliased" "all" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5054 "and" "array" "at" "begin" "case" "declare" "delay" "delta" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5055 "digits" "do" "else" "elsif" "entry" "exception" "exit" "for" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5056 "generic" "if" "in" "is" "limited" "loop" "mod" "not" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5057 "null" "or" "others" "private" "protected" "raise" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5058 "range" "record" "rem" "renames" "requeue" "return" "reverse" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5059 "select" "separate" "tagged" "task" "terminate" "then" "until" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5060 "when" "while" "xor") t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5061 "\\>") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5062 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5063 ;; Anything following end and not already fontified is a body name. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5064 '("\\<\\(end\\)\\>\\([ \t]+\\)?\\(\\(\\sw\\|[_.]\\)+\\)?" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5065 (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5066 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5067 ;; Keywords followed by a type or function name. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5068 (list (concat "\\<\\(" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5069 "new\\|of\\|subtype\\|type" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5070 "\\)\\>[ \t]*\\(\\sw+\\(\\.\\sw*\\)*\\)?[ \t]*\\((\\)?") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5071 '(1 font-lock-keyword-face) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5072 '(2 (if (match-beginning 4) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5073 font-lock-function-name-face |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5074 font-lock-type-face) nil t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5075 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5076 ;; Keywords followed by a (comma separated list of) reference. |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5077 ;; Note that font-lock only works on single lines, thus we can not |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5078 ;; correctly highlight a with_clause that spans multiple lines. |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5079 (list (concat "\\<\\(goto\\|raise\\|use\\|with\\)" |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5080 "[ \t]+\\([a-zA-Z0-9_., \t]+\\)\\W") |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5081 '(1 font-lock-keyword-face) '(2 font-lock-reference-face nil t)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5082 ;; |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5083 ;; Goto tags. |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5084 '("<<\\(\\sw+\\)>>" 1 font-lock-reference-face) |
44465
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5085 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5086 ;; Highlight based-numbers (R. Reagan <robin-reply@reagans.org>) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5087 (list "\\([0-9]+#[0-9a-fA-F_]+#\\)" '(1 font-lock-constant-face t)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5088 |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5089 ;; Ada unnamed numerical constants |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5090 (list "\\W\\([-+]?[0-9._]+\\)\\>" '(1 font-lock-constant-face)) |
0a0f75d152df
(ada-case-exception-file, ada-indent-handle-comment-special): New variables.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
42619
diff
changeset
|
5091 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5092 )) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
5093 "Default expressions to highlight in Ada mode.") |
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
5094 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5095 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5096 ;; --------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5097 ;; Support for outline.el |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5098 ;; --------------------------------------------------------- |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5099 |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
5100 (defun ada-outline-level () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5101 "This is so that `current-column` DTRT in otherwise-hidden text" |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5102 ;; patch from Dave Love <fx@gnu.org> |
24446
25556de3fe49
(ada-outline-level): Bind buffer-invisibility-spec.
Dave Love <fx@gnu.org>
parents:
24325
diff
changeset
|
5103 (let (buffer-invisibility-spec) |
25556de3fe49
(ada-outline-level): Bind buffer-invisibility-spec.
Dave Love <fx@gnu.org>
parents:
24325
diff
changeset
|
5104 (save-excursion |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5105 (back-to-indentation) |
24446
25556de3fe49
(ada-outline-level): Bind buffer-invisibility-spec.
Dave Love <fx@gnu.org>
parents:
24325
diff
changeset
|
5106 (current-column)))) |
17914
e5e2ef0dd5ab
(ada-krunch-args): Use gnatkr instead of gnatk8.
Richard M. Stallman <rms@gnu.org>
parents:
14415
diff
changeset
|
5107 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5108 ;; --------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5109 ;; Automatic generation of code |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5110 ;; The Ada-mode has a set of function to automatically generate a subprogram |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5111 ;; or package body from its spec. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5112 ;; These function only use a primary and basic algorithm, this could use a |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5113 ;; lot of improvement. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5114 ;; When the user is using GNAT, we rather use gnatstub to generate an accurate |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5115 ;; body. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5116 ;; ---------------------------------------------------------- |
10705 | 5117 |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5118 (defun ada-gen-treat-proc (match) |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5119 "Make dummy body of a procedure/function specification. |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5120 MATCH is a cons cell containing the start and end location of the last search |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5121 for ada-procedure-start-regexp." |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5122 (goto-char (car match)) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5123 (let (func-found procname functype) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5124 (cond |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5125 ((or (looking-at "^[ \t]*procedure") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5126 (setq func-found (looking-at "^[ \t]*function"))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5127 ;; treat it as a proc/func |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5128 (forward-word 2) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5129 (forward-word -1) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5130 (setq procname (buffer-substring (point) (cdr match))) ; store proc name |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5131 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5132 ;; goto end of procname |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5133 (goto-char (cdr match)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5134 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5135 ;; skip over parameterlist |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5136 (unless (looking-at "[ \t\n]*\\(;\\|return\\)") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5137 (forward-sexp)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5138 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5139 ;; if function, skip over 'return' and result type. |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5140 (if func-found |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5141 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5142 (forward-word 1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5143 (skip-chars-forward " \t\n") |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5144 (setq functype (buffer-substring (point) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5145 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5146 (skip-chars-forward |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5147 "a-zA-Z0-9_\.") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5148 (point)))))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5149 ;; look for next non WS |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5150 (cond |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5151 ((looking-at "[ \t]*;") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5152 (delete-region (match-beginning 0) (match-end 0));; delete the ';' |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5153 (ada-indent-newline-indent) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5154 (insert "is") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5155 (ada-indent-newline-indent) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5156 (if func-found |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5157 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5158 (insert "Result : " functype ";") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5159 (ada-indent-newline-indent))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5160 (insert "begin") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5161 (ada-indent-newline-indent) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5162 (if func-found |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5163 (insert "return Result;") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5164 (insert "null;")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5165 (ada-indent-newline-indent) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5166 (insert "end " procname ";") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5167 (ada-indent-newline-indent) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5168 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5169 ;; else |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5170 ((looking-at "[ \t\n]*is") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5171 ;; do nothing |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5172 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5173 ((looking-at "[ \t\n]*rename") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5174 ;; do nothing |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5175 ) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5176 (t |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5177 (message "unknown syntax")))) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5178 (t |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5179 (if (looking-at "^[ \t]*task") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5180 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5181 (message "Task conversion is not yet implemented") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5182 (forward-word 2) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5183 (if (looking-at "[ \t]*;") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5184 (forward-line) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5185 (ada-move-to-end)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5186 )))))) |
12039
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5187 |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5188 (defun ada-make-body () |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5189 "Create an Ada package body in the current buffer. |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5190 The potential old buffer contents is deleted first, then we copy the |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5191 spec buffer in here and modify it to make it a body. |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5192 This function typically is to be hooked into `ff-file-created-hooks'." |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5193 (interactive) |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5194 (delete-region (point-min) (point-max)) |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5195 (insert-buffer (car (cdr (buffer-list)))) |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5196 (ada-mode) |
a75524689022
(initial comments): Copyright 1995; don't speak
Karl Heuer <kwzh@gnu.org>
parents:
11869
diff
changeset
|
5197 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5198 (let (found ada-procedure-or-package-start-regexp) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5199 (if (setq found |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5200 (ada-search-ignore-string-comment ada-package-start-regexp nil)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5201 (progn (goto-char (cdr found)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5202 (insert " body") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5203 ) |
10705 | 5204 (error "No package")) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5205 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5206 (setq ada-procedure-or-package-start-regexp |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5207 (concat ada-procedure-start-regexp |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5208 "\\|" |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5209 ada-package-start-regexp)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5210 |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5211 (while (setq found |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5212 (ada-search-ignore-string-comment |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5213 ada-procedure-or-package-start-regexp nil)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5214 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5215 (goto-char (car found)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5216 (if (looking-at ada-package-start-regexp) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5217 (progn (goto-char (cdr found)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5218 (insert " body")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5219 (ada-gen-treat-proc found)))))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5220 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5221 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5222 (defun ada-make-subprogram-body () |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5223 "Make one dummy subprogram body from spec surrounding point." |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5224 (interactive) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5225 (let* ((found (re-search-backward ada-procedure-start-regexp nil t)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5226 (spec (match-beginning 0)) |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5227 body-file) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5228 (if found |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5229 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5230 (goto-char spec) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5231 (if (and (re-search-forward "(\\|;" nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5232 (= (char-before) ?\()) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5233 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5234 (ada-search-ignore-string-comment ")" nil) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5235 (ada-search-ignore-string-comment ";" nil))) |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5236 (setq spec (buffer-substring spec (point))) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5237 |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5238 ;; If find-file.el was available, use its functions |
33716
c55ff055c68a
(ada-mode): `set '' -> `setq'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
32300
diff
changeset
|
5239 (setq body-file (ada-get-body-name)) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5240 (if body-file |
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5241 (find-file body-file) |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38401
diff
changeset
|
5242 (error "No body found for the package. Create it first")) |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5243 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5244 (save-restriction |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5245 (widen) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5246 (goto-char (point-max)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5247 (forward-comment -10000) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5248 (re-search-backward "\\<end\\>" nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5249 ;; Move to the beginning of the elaboration part, if any |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5250 (re-search-backward "^begin" nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5251 (newline) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5252 (forward-char -1) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5253 (insert spec) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5254 (re-search-backward ada-procedure-start-regexp nil t) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5255 (ada-gen-treat-proc (cons (match-beginning 0) (match-end 0))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5256 )) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5257 (error "Not in subprogram spec")))) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5258 |
26225
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5259 ;; -------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5260 ;; Global initializations |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5261 ;; -------------------------------------------------------- |
91cb7b3bae3c
Changed format of years in copyright notice.
Gerd Moellmann <gerd@gnu.org>
parents:
25903
diff
changeset
|
5262 |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5263 ;; Create the keymap once and for all. If we do that in ada-mode, |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5264 ;; the keys changed in the user's .emacs have to be modified |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5265 ;; every time |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5266 (ada-create-keymap) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5267 (ada-create-menu) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5268 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5269 ;; Create the syntax tables, but do not activate them |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5270 (ada-create-syntax-table) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5271 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5272 ;; Add the default extensions (and set up speedbar) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5273 (ada-add-extensions ".ads" ".adb") |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5274 ;; This two files are generated by GNAT when running with -gnatD |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5275 (if (equal ada-which-compiler 'gnat) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5276 (ada-add-extensions ".ads.dg" ".adb.dg")) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5277 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5278 ;; Read the special cases for exceptions |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5279 (ada-case-read-exceptions) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5280 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5281 ;; include the other ada-mode files |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5282 (if (equal ada-which-compiler 'gnat) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5283 (progn |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5284 ;; The order here is important: ada-xref defines the Project |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5285 ;; submenu, and ada-prj adds to it. |
30411
41f228350eca
Got rid of all byte-compiler warnings on Emacs Load
Gerd Moellmann <gerd@gnu.org>
parents:
28995
diff
changeset
|
5286 (require 'ada-xref) |
25903
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5287 (condition-case nil (require 'ada-prj) (error nil)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5288 )) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5289 (condition-case nil (require 'ada-stmt) (error nil)) |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5290 |
812005e9c20e
(ada-get-indent-*, ada-indent-current, ada-goto-*,
Gerd Moellmann <gerd@gnu.org>
parents:
25420
diff
changeset
|
5291 ;;; provide ourselves |
10705 | 5292 (provide 'ada-mode) |
5293 | |
10707 | 5294 ;;; ada-mode.el ends here |