Mercurial > emacs
annotate lisp/progmodes/ada-xref.el @ 78633:128c8e0c565e
Fix up comment style.
(sha1-F0, sha1-F1, sha1-F2, sha1-F3, sha1-S1, sha1-S5, sha1-S30)
(sha1-OP, sha1-add-to-H): Use new-style backquotes.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 23 Aug 2007 18:25:48 +0000 |
parents | 4e51ba479b3c |
children | a1342e6e097a e1af3a725ca4 aaccdab0ee26 |
rev | line source |
---|---|
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1 ;; ada-xref.el --- for lookup and completion in Ada mode |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2 |
64699
629afbe74e61
Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
75347 | 4 ;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
5 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
6 ;; Author: Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de> |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
7 ;; Rolf Ebert <ebert@inf.enst.fr> |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
8 ;; Emmanuel Briot <briot@gnat.com> |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
9 ;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org> |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
10 ;; Keywords: languages ada xref |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
11 |
38361
d42c9135a92d
Say that the file _is_ part of Emacs.
Eli Zaretskii <eliz@gnu.org>
parents:
32301
diff
changeset
|
12 ;; This file is part of GNU Emacs. |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
13 |
38401 | 14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
15 ;; it under the terms of the GNU General Public License as published by |
78234
c1ec1c8a8d2e
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
16 ;; the Free Software Foundation; either version 3, or (at your option) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
17 ;; any later version. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
18 |
38401 | 19 ;; GNU Emacs is distributed in the hope that it will be useful, |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
22 ;; GNU General Public License for more details. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
23 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
24 ;; You should have received a copy of the GNU General Public License |
38401 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
28 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
29 ;;; Commentary: |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
30 ;;; This Package provides a set of functions to use the output of the |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
31 ;;; cross reference capabilities of the GNAT Ada compiler |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
32 ;;; for lookup and completion in Ada mode. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
33 ;;; |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
34 ;;; If a file *.`adp' exists in the ada-file directory, then it is |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
35 ;;; read for configuration informations. It is read only the first |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
36 ;;; time a cross-reference is asked for, and is not read later. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
37 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
38 ;;; You need Emacs >= 20.2 to run this package |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
39 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
40 |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
41 ;;; History: |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
42 ;; |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
43 |
38422
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38401
diff
changeset
|
44 ;;; Code: |
7a94f1c588c4
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38401
diff
changeset
|
45 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
46 ;; ----- Requirements ----------------------------------------------------- |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
47 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
48 (require 'compile) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
49 (require 'comint) |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
50 (require 'find-file) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
51 (require 'ada-mode) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
52 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
53 ;; ------ User variables |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
54 (defcustom ada-xref-other-buffer t |
26227 | 55 "*If nil, always display the cross-references in the same buffer. |
56 Otherwise create either a new buffer or a new frame." | |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
57 :type 'boolean :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
58 |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
59 (defcustom ada-xref-create-ali nil |
26227 | 60 "*If non-nil, run gcc whenever the cross-references are not up-to-date. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
61 If nil, the cross-reference mode never runs gcc." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
62 :type 'boolean :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
63 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
64 (defcustom ada-xref-confirm-compile nil |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
65 "*Non-nil means ask for confirmation before compiling or running the application." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
66 :type 'boolean :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
67 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
68 (defcustom ada-krunch-args "0" |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
69 "*Maximum number of characters for filenames created by `gnatkr'. |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
70 Set to 0, if you don't use crunched filenames. This should be a string." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
71 :type 'string :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
72 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
73 (defcustom ada-gnatls-args '("-v") |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
74 "*Arguments to pass to `gnatls' to find location of the runtime. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
75 Typical use is to pass `--RTS=soft-floats' on some systems that support it. |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
76 |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
77 You can also add `-I-' if you do not want the current directory to be included. |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
78 Otherwise, going from specs to bodies and back will first look for files in the |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
79 current directory. This only has an impact if you are not using project files, |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
80 but only ADA_INCLUDE_PATH." |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
81 :type '(repeat string) :group 'ada) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
82 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
83 (defcustom ada-prj-default-comp-opt "-gnatq -gnatQ" |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
84 "Default compilation options." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
85 :type 'string :group 'ada) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
86 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
87 (defcustom ada-prj-default-bind-opt "" |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
88 "Default binder options." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
89 :type 'string :group 'ada) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
90 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
91 (defcustom ada-prj-default-link-opt "" |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
92 "Default linker options." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
93 :type 'string :group 'ada) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
94 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
95 (defcustom ada-prj-default-gnatmake-opt "-g" |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
96 "Default options for `gnatmake'." |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
97 :type 'string :group 'ada) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
98 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
99 (defcustom ada-prj-gnatfind-switches "-rf" |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
100 "Default switches to use for `gnatfind'. |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
101 You should modify this variable, for instance to add `-a', if you are working |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
102 in an environment where most ALI files are write-protected. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
103 The command `gnatfind' is used every time you choose the menu |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
104 \"Show all references\"." |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
105 :type 'string :group 'ada) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
106 |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
107 (defcustom ada-prj-default-check-cmd |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
108 (concat "${cross_prefix}gnatmake -u -c -gnatc ${gnatmake_opt} ${full_current}" |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
109 " -cargs ${comp_opt}") |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
110 "*Default command to be used to compile a single file. |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
111 Emacs will substitute the current filename for ${full_current}, or add |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
112 the filename at the end. This is the same syntax as in the project file." |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
113 :type 'string :group 'ada) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
114 |
26227 | 115 (defcustom ada-prj-default-comp-cmd |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
116 (concat "${cross_prefix}gnatmake -u -c ${gnatmake_opt} ${full_current} -cargs" |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
117 " ${comp_opt}") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
118 "*Default command to be used to compile a single file. |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
119 Emacs will substitute the current filename for ${full_current}, or add |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
120 the filename at the end. This is the same syntax as in the project file." |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
121 :type 'string :group 'ada) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
122 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
123 (defcustom ada-prj-default-debugger "${cross_prefix}gdb" |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
124 "*Default name of the debugger." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
125 :type 'string :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
126 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
127 (defcustom ada-prj-default-make-cmd |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
128 (concat "${cross_prefix}gnatmake -o ${main} ${main_unit} ${gnatmake_opt} " |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
129 "-cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
130 "*Default command to be used to compile the application. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
131 This is the same syntax as in the project file." |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
132 :type 'string :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
133 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
134 (defcustom ada-prj-default-project-file "" |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
135 "*Name of the current project file. |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
136 Emacs will not try to use the search algorithm to find the project file if |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
137 this string is not empty. It is set whenever a project file is found." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
138 :type '(file :must-match t) :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
139 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
140 (defcustom ada-gnatstub-opts "-q -I${src_dir}" |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
141 "*List of the options to pass to `gnatsub' to generate the body of a package. |
26227 | 142 This has the same syntax as in the project file (with variable substitution)." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
143 :type 'string :group 'ada) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
144 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
145 (defcustom ada-always-ask-project nil |
26227 | 146 "*If nil, use default values when no project file was found. |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
147 Otherwise, ask the user for the name of the project file to use." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
148 :type 'boolean :group 'ada) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
149 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
150 (defconst is-windows (memq system-type (quote (windows-nt))) |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
151 "True if we are running on Windows.") |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
152 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
153 (defcustom ada-tight-gvd-integration nil |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
154 "*If non-nil, a new Emacs frame will be swallowed in GVD when debugging. |
56284
dc1d86b8bbbe
(ada-tight-gvd-integration): Add :group 'ada.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
155 If GVD is not the debugger used, nothing happens." |
dc1d86b8bbbe
(ada-tight-gvd-integration): Add :group 'ada.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
156 :type 'boolean :group 'ada) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
157 |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
158 (defcustom ada-xref-search-with-egrep t |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
159 "*If non-nil, use egrep to find the possible declarations for an entity. |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
160 This alternate method is used when the exact location was not found in the |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
161 information provided by GNAT. However, it might be expensive if you have a lot |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
162 of sources, since it will search in all the files in your project." |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
163 :type 'boolean :group 'ada) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
164 |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
165 (defvar ada-load-project-hook nil |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
166 "Hook that is run when loading a project file. |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
167 Each function in this hook takes one argument FILENAME, that is the name of |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
168 the project file to load. |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
169 This hook should be used to support new formats for the project files. |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
170 |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
171 If the function can load the file with the given filename, it should create a |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
172 buffer that contains a conversion of the file to the standard format of the |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
173 project files, and return that buffer. (The usual \"src_dir=\" or \"obj_dir=\" |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
174 lines.) It should return nil if it doesn't know how to convert that project |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
175 file.") |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
176 |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
177 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
178 ;; ------- Nothing to be modified by the user below this |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
179 (defvar ada-last-prj-file "" |
26227 | 180 "Name of the last project file entered by the user.") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
181 |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
182 (defconst ada-prj-file-extension ".adp" |
26227 | 183 "The extension used for project files.") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
184 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
185 (defvar ada-xref-runtime-library-specs-path '() |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
186 "Directories where the specs for the standard library is found. |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
187 This is used for cross-references.") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
188 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
189 (defvar ada-xref-runtime-library-ali-path '() |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
190 "Directories where the ali for the standard library is found. |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
191 This is used for cross-references.") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
192 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
193 (defvar ada-xref-pos-ring '() |
26227 | 194 "List of positions selected by the cross-references functions. |
195 Used to go back to these positions.") | |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
196 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
197 (defvar ada-cd-command |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
198 (if (string-match "cmdproxy.exe" shell-file-name) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
199 "cd /d" |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
200 "cd") |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
201 "Command to use to change to a specific directory. |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
202 On Windows systems using `cmdproxy.exe' as the shell, |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
203 we need to use `/d' or the drive is never changed.") |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
204 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
205 (defvar ada-command-separator (if is-windows " && " "\n") |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
206 "Separator to use between multiple commands to `compile' or `start-process'. |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
207 `cmdproxy.exe' doesn't recognize multiple-line commands, so we have to use |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
208 \"&&\" for now.") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
209 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
210 (defconst ada-xref-pos-ring-max 16 |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
211 "Number of positions kept in the list `ada-xref-pos-ring'.") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
212 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
213 (defvar ada-operator-re |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
214 "\\+\\|-\\|/\\|\\*\\*\\|\\*\\|=\\|&\\|abs\\|mod\\|rem\\|and\\|not\\|or\\|xor\\|<=\\|<\\|>=\\|>" |
26227 | 215 "Regexp to match for operators.") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
216 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
217 (defvar ada-xref-project-files '() |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
218 "Associative list of project files with properties. |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
219 It has the format: (project project ...) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
220 A project has the format: (project-file . project-plist) |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
221 \(See 'apropos plist' for operations on property lists). |
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
222 See `ada-xref-set-default-prj-values' for the list of valid properties. |
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
223 The current project is retrieved with `ada-xref-current-project'. |
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
224 Properties are retrieved with `ada-xref-get-project-field', set with |
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
225 `ada-xref-set-project-field'. If project properties are accessed with no |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
226 project file, a (nil . default-properties) entry is created.") |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
227 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
228 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
229 ;; ----- Identlist manipulation ------------------------------------------- |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
230 ;; An identlist is a vector that is used internally to reference an identifier |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
231 ;; To facilitate its use, we provide the following macros |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
232 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
233 (defmacro ada-make-identlist () (make-vector 8 nil)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
234 (defmacro ada-name-of (identlist) (list 'aref identlist 0)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
235 (defmacro ada-line-of (identlist) (list 'aref identlist 1)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
236 (defmacro ada-column-of (identlist) (list 'aref identlist 2)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
237 (defmacro ada-file-of (identlist) (list 'aref identlist 3)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
238 (defmacro ada-ali-index-of (identlist) (list 'aref identlist 4)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
239 (defmacro ada-declare-file-of (identlist) (list 'aref identlist 5)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
240 (defmacro ada-references-of (identlist) (list 'aref identlist 6)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
241 (defmacro ada-on-declaration (identlist) (list 'aref identlist 7)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
242 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
243 (defmacro ada-set-name (identlist name) (list 'aset identlist 0 name)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
244 (defmacro ada-set-line (identlist line) (list 'aset identlist 1 line)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
245 (defmacro ada-set-column (identlist col) (list 'aset identlist 2 col)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
246 (defmacro ada-set-file (identlist file) (list 'aset identlist 3 file)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
247 (defmacro ada-set-ali-index (identlist index) (list 'aset identlist 4 index)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
248 (defmacro ada-set-declare-file (identlist file) (list 'aset identlist 5 file)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
249 (defmacro ada-set-references (identlist ref) (list 'aset identlist 6 ref)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
250 (defmacro ada-set-on-declaration (ident value) (list 'aset ident 7 value)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
251 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
252 (defsubst ada-get-ali-buffer (file) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
253 "Read the ali file FILE into a new buffer, and return the buffer's name." |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
254 (find-file-noselect (ada-get-ali-file-name file))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
255 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
256 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
257 ;; ----------------------------------------------------------------------- |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
258 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
259 (defun ada-quote-cmd (cmd) |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
260 "Duplicate all `\\' characters in CMD so that it can be passed to `compile'." |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
261 (mapconcat 'identity (split-string cmd "\\\\") "\\\\")) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
262 |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
263 (defun ada-find-executable (exec-name) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
264 "Find the full path to the executable file EXEC-NAME. |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
265 On Windows systems, this will properly handle .exe extension as well" |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
266 (or (ada-find-file-in-dir exec-name exec-path) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
267 (ada-find-file-in-dir (concat exec-name ".exe") exec-path) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
268 exec-name)) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
269 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
270 (defun ada-initialize-runtime-library (cross-prefix) |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
271 "Initialize the variables for the runtime library location. |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
272 CROSS-PREFIX is the prefix to use for the `gnatls' command." |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
273 (save-excursion |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
274 (setq ada-xref-runtime-library-specs-path '() |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
275 ada-xref-runtime-library-ali-path '()) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
276 (set-buffer (get-buffer-create "*gnatls*")) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
277 (widen) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
278 (erase-buffer) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
279 ;; Catch any error in the following form (i.e gnatls was not found) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
280 (condition-case nil |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
281 ;; Even if we get an error, delete the *gnatls* buffer |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
282 (unwind-protect |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
283 (progn |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
284 (let ((gnatls |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
285 (ada-find-executable (concat cross-prefix "gnatls")))) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
286 (apply 'call-process gnatls (append '(nil t nil) ada-gnatls-args))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
287 (goto-char (point-min)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
288 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
289 ;; Source path |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
290 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
291 (search-forward "Source Search Path:") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
292 (forward-line 1) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
293 (while (not (looking-at "^$")) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
294 (back-to-indentation) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
295 (if (looking-at "<Current_Directory>") |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
296 (add-to-list 'ada-xref-runtime-library-specs-path ".") |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
297 (add-to-list 'ada-xref-runtime-library-specs-path |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
298 (buffer-substring-no-properties |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
299 (point) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
300 (save-excursion (end-of-line) (point))))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
301 (forward-line 1)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
302 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
303 ;; Object path |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
304 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
305 (search-forward "Object Search Path:") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
306 (forward-line 1) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
307 (while (not (looking-at "^$")) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
308 (back-to-indentation) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
309 (if (looking-at "<Current_Directory>") |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
310 (add-to-list 'ada-xref-runtime-library-ali-path ".") |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
311 (add-to-list 'ada-xref-runtime-library-ali-path |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
312 (buffer-substring-no-properties |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
313 (point) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
314 (save-excursion (end-of-line) (point))))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
315 (forward-line 1)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
316 ) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
317 (kill-buffer nil)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
318 (error nil)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
319 (set 'ada-xref-runtime-library-specs-path |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
320 (reverse ada-xref-runtime-library-specs-path)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
321 (set 'ada-xref-runtime-library-ali-path |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
322 (reverse ada-xref-runtime-library-ali-path)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
323 )) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
324 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
325 (defun ada-treat-cmd-string (cmd-string) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
326 "Replace meta-sequences like ${...} in CMD-STRING with the appropriate value. |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
327 Assumes project exists. |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
328 As a special case, ${current} is replaced with the name of the current |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
329 file, minus extension but with directory, and ${full_current} is |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
330 replaced by the name including the extension." |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
331 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
332 (while (string-match "\\(-[^-\$IO]*[IO]\\)?\${\\([^}]+\\)}" cmd-string) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
333 (let (value |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
334 (name (match-string 2 cmd-string))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
335 (cond |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
336 ((string= name "current") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
337 (setq value (file-name-sans-extension (buffer-file-name)))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
338 ((string= name "full_current") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
339 (setq value (buffer-file-name))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
340 (t |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
341 (save-match-data |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
342 (setq value (ada-xref-get-project-field (intern name)))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
343 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
344 ;; Check if there is an environment variable with the same name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
345 (if (null value) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
346 (if (not (setq value (getenv name))) |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
347 (message "%s" (concat "No project or environment variable " name " found")))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
348 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
349 (cond |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
350 ((null value) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
351 (setq cmd-string (replace-match "" t t cmd-string))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
352 ((stringp value) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
353 (setq cmd-string (replace-match value t t cmd-string))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
354 ((listp value) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
355 (let ((prefix (match-string 1 cmd-string))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
356 (setq cmd-string (replace-match |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
357 (mapconcat (lambda(x) (concat prefix x)) value " ") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
358 t t cmd-string))))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
359 )) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
360 cmd-string) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
361 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
362 (defun ada-xref-set-default-prj-values (symbol ada-buffer) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
363 "Reset the properties in SYMBOL to the default values for ADA-BUFFER." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
364 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
365 (let ((file (buffer-file-name ada-buffer)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
366 plist) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
367 (save-excursion |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
368 (set-buffer ada-buffer) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
369 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
370 (set 'plist |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
371 ;; Try hard to find a project file, even if the current |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
372 ;; buffer is not an Ada file or not associated with a file |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
373 (list 'filename (expand-file-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
374 (cond |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
375 (ada-prj-default-project-file |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
376 ada-prj-default-project-file) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
377 (file (ada-prj-find-prj-file file t)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
378 (t |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
379 (message (concat "Not editing an Ada file," |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
380 "and no default project " |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
381 "file specified!")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
382 ""))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
383 'build_dir (file-name-as-directory (expand-file-name ".")) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
384 'src_dir (list ".") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
385 'obj_dir (list ".") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
386 'casing (if (listp ada-case-exception-file) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
387 ada-case-exception-file |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
388 (list ada-case-exception-file)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
389 'comp_opt ada-prj-default-comp-opt |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
390 'bind_opt ada-prj-default-bind-opt |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
391 'link_opt ada-prj-default-link-opt |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
392 'gnatmake_opt ada-prj-default-gnatmake-opt |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
393 'gnatfind_opt ada-prj-gnatfind-switches |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
394 'main (if file |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
395 (file-name-nondirectory |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
396 (file-name-sans-extension file)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
397 "") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
398 'main_unit (if file |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
399 (file-name-nondirectory |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
400 (file-name-sans-extension file)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
401 "") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
402 'cross_prefix "" |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
403 'remote_machine "" |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
404 'comp_cmd (list ada-prj-default-comp-cmd) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
405 'check_cmd (list ada-prj-default-check-cmd) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
406 'make_cmd (list ada-prj-default-make-cmd) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
407 'run_cmd (list (concat "./${main}" (if is-windows ".exe"))) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
408 'debug_pre_cmd (list (concat ada-cd-command " ${build_dir}")) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
409 'debug_cmd (concat ada-prj-default-debugger |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
410 " ${main}" (if is-windows ".exe")) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
411 'debug_post_cmd (list nil))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
412 ) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
413 (set symbol plist))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
414 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
415 (defun ada-xref-get-project-field (field) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
416 "Extract the value of FIELD from the current project file. |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
417 Project variables are substituted. |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
418 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
419 Note that for src_dir and obj_dir, you should rather use |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
420 `ada-xref-get-src-dir-field' or `ada-xref-get-obj-dir-field' |
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
421 which will in addition return the default paths." |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
422 |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
423 (let* ((project-plist (cdr (ada-xref-current-project))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
424 value) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
425 |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
426 (set 'value (plist-get project-plist field)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
427 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
428 ;; Substitute the ${...} constructs in all the strings, including |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
429 ;; inside lists |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
430 (cond |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
431 ((stringp value) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
432 (ada-treat-cmd-string value)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
433 ((null value) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
434 nil) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
435 ((listp value) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
436 (mapcar (lambda(x) (if x (ada-treat-cmd-string x) x)) value)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
437 (t |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
438 value) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
439 ) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
440 )) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
441 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
442 (defun ada-xref-get-src-dir-field () |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
443 "Return the full value for src_dir, including the default directories. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
444 All the directories are returned as absolute directories." |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
445 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
446 (let ((build-dir (ada-xref-get-project-field 'build_dir))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
447 (append |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
448 ;; Add ${build_dir} in front of the path |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
449 (list build-dir) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
450 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
451 (ada-get-absolute-dir-list (ada-xref-get-project-field 'src_dir) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
452 build-dir) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
453 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
454 ;; Add the standard runtime at the end |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
455 ada-xref-runtime-library-specs-path))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
456 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
457 (defun ada-xref-get-obj-dir-field () |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
458 "Return the full value for obj_dir, including the default directories. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
459 All the directories are returned as absolute directories." |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
460 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
461 (let ((build-dir (ada-xref-get-project-field 'build_dir))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
462 (append |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
463 ;; Add ${build_dir} in front of the path |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
464 (list build-dir) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
465 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
466 (ada-get-absolute-dir-list (ada-xref-get-project-field 'obj_dir) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
467 build-dir) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
468 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
469 ;; Add the standard runtime at the end |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
470 ada-xref-runtime-library-ali-path))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
471 |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
472 (defun ada-xref-set-project-field (field value) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
473 "Set FIELD to VALUE in current project. Assumes project exists." |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
474 ;; same algorithm to find project-plist as ada-xref-current-project |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
475 (let* ((file-name (ada-xref-current-project-file)) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
476 (project-plist (cdr (assoc file-name ada-xref-project-files)))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
477 |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
478 (setq project-plist (plist-put project-plist field value)) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
479 (setcdr (assoc file-name ada-xref-project-files) project-plist))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
480 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
481 (defun ada-xref-update-project-menu () |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
482 "Update the menu Ada->Project, with the list of available project files." |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
483 ;; Create the standard items. |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
484 (let ((submenu |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
485 `("Project" |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
486 ["Load..." ada-set-default-project-file t] |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
487 ["New..." ada-prj-new t] |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
488 ["Edit..." ada-prj-edit t] |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
489 "---" |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
490 ;; Add the new items |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
491 ,@(mapcar |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
492 (lambda (x) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
493 (let ((name (or (car x) "<default>")) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
494 (command `(lambda () |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
495 "Change the active project file." |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
496 (interactive) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
497 (ada-parse-prj-file ,(car x)) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
498 (set 'ada-prj-default-project-file ,(car x)) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
499 (ada-xref-update-project-menu)))) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
500 (vector |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
501 (if (string= (file-name-extension name) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
502 ada-prj-file-extension) |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
503 (file-name-sans-extension |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
504 (file-name-nondirectory name)) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
505 (file-name-nondirectory name)) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
506 command |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
507 :button (cons |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
508 :toggle |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
509 (equal ada-prj-default-project-file |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
510 (car x)) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
511 )))) |
56284
dc1d86b8bbbe
(ada-tight-gvd-integration): Add :group 'ada.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
512 |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
513 ;; Parses all the known project files, and insert at |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
514 ;; least the default one (in case |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
515 ;; ada-xref-project-files is nil) |
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
516 (or ada-xref-project-files '(nil)))))) |
56284
dc1d86b8bbbe
(ada-tight-gvd-integration): Add :group 'ada.
Kim F. Storm <storm@cua.dk>
parents:
52401
diff
changeset
|
517 |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
518 (easy-menu-add-item ada-mode-menu '() submenu))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
519 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
520 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
521 ;;------------------------------------------------------------- |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
522 ;;-- Searching a file anywhere on the source path. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
523 ;;-- |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
524 ;;-- The following functions provide support for finding a file anywhere |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
525 ;;-- on the source path, without providing an explicit directory. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
526 ;;-- They also provide file name completion in the minibuffer. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
527 ;;-- |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
528 ;;-- Public subprograms: ada-find-file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
529 ;;-- |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
530 ;;------------------------------------------------------------- |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
531 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
532 (defun ada-do-file-completion (string predicate flag) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
533 "Completion function when reading a file from the minibuffer. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
534 Completion is attempted in all the directories in the source path, as |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
535 defined in the project file." |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
536 ;; FIXME: doc arguments |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
537 |
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
538 ;; This function is not itself interactive, but it is called as part |
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
539 ;; of the prompt of interactive functions, so we require a project |
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
540 ;; file. |
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
541 (ada-require-project-file) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
542 (let (list |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
543 (dirs (ada-xref-get-src-dir-field))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
544 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
545 (while dirs |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
546 (if (file-directory-p (car dirs)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
547 (set 'list (append list (file-name-all-completions string (car dirs))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
548 (set 'dirs (cdr dirs))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
549 (cond ((equal flag 'lambda) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
550 (assoc string list)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
551 (flag |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
552 list) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
553 (t |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
554 (try-completion string |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
555 (mapcar (lambda (x) (cons x 1)) list) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
556 predicate))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
557 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
558 ;;;###autoload |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
559 (defun ada-find-file (filename) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
560 "Open FILENAME, from anywhere in the source path. |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
561 Completion is available." |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
562 (interactive |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
563 (list (completing-read "File: " 'ada-do-file-completion))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
564 (let ((file (ada-find-src-file-in-dir filename))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
565 (if file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
566 (find-file file) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
567 (error (concat filename " not found in src_dir"))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
568 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
569 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
570 ;; ----- Utilities ------------------------------------------------- |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
571 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
572 (defun ada-require-project-file () |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
573 "If the current project does not exist, load or create a default one. |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
574 Should only be called from interactive functions." |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
575 (if (not (ada-xref-current-project t)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
576 (ada-reread-prj-file))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
577 |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
578 (defun ada-xref-current-project-file (&optional no-user-question) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
579 "Return the current project file name; never nil unless NO-USER-QUESTION. |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
580 If NO-USER-QUESTION, don't prompt user for file. Call |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
581 `ada-require-project-file' first if a project must exist." |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
582 (if (not (string= "" ada-prj-default-project-file)) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
583 ada-prj-default-project-file |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
584 (ada-prj-find-prj-file nil no-user-question))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
585 |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
586 (defun ada-xref-current-project (&optional no-user-question) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
587 "Return the current project; nil if none. |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
588 If NO-USER-QUESTION, don't prompt user for file. Call |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
589 `ada-require-project-file' first if a project must exist." |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
590 (let* ((file-name (ada-xref-current-project-file no-user-question))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
591 (assoc file-name ada-xref-project-files))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
592 |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
593 (defun ada-show-current-project () |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
594 "Display current project file name in message buffer." |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
595 (interactive) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
596 (message (ada-xref-current-project-file))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
597 |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
598 (defun ada-show-current-main () |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
599 "Display current main unit name in message buffer." |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
600 (interactive) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
601 (message "ada-mode main_unit: %s" (ada-xref-get-project-field 'main_unit))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
602 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
603 (defun ada-xref-push-pos (filename position) |
26227 | 604 "Push (FILENAME, POSITION) on the position ring for cross-references." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
605 (setq ada-xref-pos-ring (cons (list position filename) ada-xref-pos-ring)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
606 (if (> (length ada-xref-pos-ring) ada-xref-pos-ring-max) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
607 (setcdr (nthcdr (1- ada-xref-pos-ring-max) ada-xref-pos-ring) nil))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
608 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
609 (defun ada-xref-goto-previous-reference () |
26227 | 610 "Go to the previous cross-reference we were on." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
611 (interactive) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
612 (if ada-xref-pos-ring |
26227 | 613 (let ((pos (car ada-xref-pos-ring))) |
614 (setq ada-xref-pos-ring (cdr ada-xref-pos-ring)) | |
615 (find-file (car (cdr pos))) | |
616 (goto-char (car pos))))) | |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
617 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
618 (defun ada-convert-file-name (name) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
619 "Convert from NAME to a name that can be used by the compilation commands. |
26227 | 620 This is overriden on VMS to convert from VMS filenames to Unix filenames." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
621 name) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
622 ;; FIXME: use convert-standard-filename instead |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
623 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
624 (defun ada-set-default-project-file (name &optional keep-existing) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
625 "Set the file whose name is NAME as the default project file. |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
626 If KEEP-EXISTING is true and a project file has already been loaded, nothing |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
627 is done. This is meant to be used from `ada-mode-hook', for instance, to force |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
628 a project file unless the user has already loaded one." |
26227 | 629 (interactive "fProject file:") |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
630 (if (or (not keep-existing) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
631 (not ada-prj-default-project-file) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
632 (equal ada-prj-default-project-file "")) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
633 (progn |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
634 (setq ada-prj-default-project-file name) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
635 (ada-reread-prj-file name)))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
636 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
637 ;; ------ Handling the project file ----------------------------- |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
638 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
639 (defun ada-prj-find-prj-file (&optional file no-user-question) |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
640 "Find the project file associated with FILE (or the current buffer if nil). |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
641 If the buffer is not in Ada mode, or not associated with a file, |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
642 return `ada-prj-default-project-file'. Otherwise, search for a file with |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
643 the same base name as the Ada file, but extension given by |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
644 `ada-prj-file-extension' (default .adp). If not found, search for *.adp |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
645 in the current directory; if several are found, and NO-USER-QUESTION |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
646 is non-nil, prompt the user to select one. If none are found, return |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
647 'default.adp'." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
648 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
649 (let (selected) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
650 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
651 (if (or (not (string= mode-name "Ada")) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
652 (not (buffer-file-name))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
653 |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
654 ;; Not in an Ada buffer, or current buffer not associated |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
655 ;; with a file (for instance an emerge buffer) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
656 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
657 (if (and ada-prj-default-project-file |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
658 (not (string= ada-prj-default-project-file ""))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
659 (setq selected ada-prj-default-project-file) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
660 (setq selected nil)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
661 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
662 ;; other cases: use a more complex algorithm |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
663 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
664 (let* ((current-file (or file (buffer-file-name))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
665 (first-choice (concat |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
666 (file-name-sans-extension current-file) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
667 ada-prj-file-extension)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
668 (dir (file-name-directory current-file)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
669 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
670 (prj-files (directory-files |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
671 dir t |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
672 (concat ".*" (regexp-quote |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
673 ada-prj-file-extension) "$"))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
674 (choice nil)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
675 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
676 (cond |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
677 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
678 ((file-exists-p first-choice) |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
679 ;; filename.adp |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
680 (set 'selected first-choice)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
681 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
682 ((= (length prj-files) 1) |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
683 ;; Exactly one project file was found in the current directory |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
684 (set 'selected (car prj-files))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
685 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
686 ((and (> (length prj-files) 1) (not no-user-question)) |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
687 ;; multiple project files in current directory, ask the user |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
688 (save-window-excursion |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
689 (with-output-to-temp-buffer "*choice list*" |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
690 (princ "There are more than one possible project file.\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
691 (princ "Which one should we use ?\n\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
692 (princ " no. file name \n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
693 (princ " --- ------------------------\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
694 (let ((counter 1)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
695 (while (<= counter (length prj-files)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
696 (princ (format " %2d) %s\n" |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
697 counter |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
698 (nth (1- counter) prj-files))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
699 (setq counter (1+ counter)) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
700 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
701 ))) ; end of with-output-to ... |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
702 (setq choice nil) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
703 (while (or |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
704 (not choice) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
705 (not (integerp choice)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
706 (< choice 1) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
707 (> choice (length prj-files))) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
58004
diff
changeset
|
708 (setq choice (string-to-number |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
709 (read-from-minibuffer "Enter No. of your choice: ")))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
710 (set 'selected (nth (1- choice) prj-files)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
711 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
712 ((= (length prj-files) 0) |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
713 ;; No project file in the current directory; ask user |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
714 (unless (or no-user-question (not ada-always-ask-project)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
715 (setq ada-last-prj-file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
716 (read-file-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
717 (concat "project file [" ada-last-prj-file "]:") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
718 nil ada-last-prj-file)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
719 (unless (string= ada-last-prj-file "") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
720 (set 'selected ada-last-prj-file)))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
721 ))) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
722 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
723 (or selected "default.adp") |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
724 )) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
725 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
726 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
727 (defun ada-parse-prj-file (prj-file) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
728 "Read PRJ-FILE, set it as the active project." |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
729 ;; FIXME: doc nil, search, etc. |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
730 (if prj-file |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
731 (let (project src_dir obj_dir make_cmd comp_cmd check_cmd casing |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
732 run_cmd debug_pre_cmd debug_post_cmd |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
733 (ada-buffer (current-buffer))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
734 (setq prj-file (expand-file-name prj-file)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
735 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
736 ;; Set the project file as the active one. |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
737 (setq ada-prj-default-project-file prj-file) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
738 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
739 ;; Initialize the project with the default values |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
740 (ada-xref-set-default-prj-values 'project (current-buffer)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
741 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
742 ;; Do not use find-file below, since we don't want to show this |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
743 ;; buffer. If the file is open through speedbar, we can't use |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
744 ;; find-file anyway, since the speedbar frame is special and does not |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
745 ;; allow the selection of a file in it. |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
746 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
747 (if (file-exists-p prj-file) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
748 (progn |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
749 (let* ((buffer (run-hook-with-args-until-success |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
750 'ada-load-project-hook prj-file))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
751 (unless buffer |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
752 (setq buffer (find-file-noselect prj-file nil))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
753 (set-buffer buffer)) |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
754 |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
755 (widen) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
756 (goto-char (point-min)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
757 |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
758 ;; Now overrides these values with the project file |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
759 (while (not (eobp)) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
760 (if (looking-at "^\\([^=]+\\)=\\(.*\\)") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
761 (cond |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
762 ;; fields that are lists or paths require special processing |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
763 ;; FIXME: strip trailing spaces |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
764 ((string= (match-string 1) "src_dir") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
765 (add-to-list 'src_dir |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
766 (file-name-as-directory (match-string 2)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
767 ((string= (match-string 1) "obj_dir") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
768 (add-to-list 'obj_dir |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
769 (file-name-as-directory (match-string 2)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
770 ((string= (match-string 1) "casing") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
771 (set 'casing (cons (match-string 2) casing))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
772 ((string= (match-string 1) "build_dir") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
773 (set 'project |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
774 (plist-put project 'build_dir |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
775 (file-name-as-directory (match-string 2))))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
776 ((string= (match-string 1) "make_cmd") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
777 (add-to-list 'make_cmd (match-string 2))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
778 ((string= (match-string 1) "comp_cmd") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
779 (add-to-list 'comp_cmd (match-string 2))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
780 ((string= (match-string 1) "check_cmd") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
781 (add-to-list 'check_cmd (match-string 2))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
782 ((string= (match-string 1) "run_cmd") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
783 (add-to-list 'run_cmd (match-string 2))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
784 ((string= (match-string 1) "debug_pre_cmd") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
785 (add-to-list 'debug_pre_cmd (match-string 2))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
786 ((string= (match-string 1) "debug_post_cmd") |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
787 (add-to-list 'debug_post_cmd (match-string 2))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
788 (t |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
789 ;; any other field in the file is just copied |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
790 (set 'project (plist-put project (intern (match-string 1)) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
791 (match-string 2)))))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
792 (forward-line 1)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
793 |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
794 (if src_dir (set 'project (plist-put project 'src_dir |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
795 (reverse src_dir)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
796 (if obj_dir (set 'project (plist-put project 'obj_dir |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
797 (reverse obj_dir)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
798 (if casing (set 'project (plist-put project 'casing |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
799 (reverse casing)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
800 (if make_cmd (set 'project (plist-put project 'make_cmd |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
801 (reverse make_cmd)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
802 (if comp_cmd (set 'project (plist-put project 'comp_cmd |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
803 (reverse comp_cmd)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
804 (if check_cmd (set 'project (plist-put project 'check_cmd |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
805 (reverse check_cmd)))) |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
806 (if run_cmd (set 'project (plist-put project 'run_cmd |
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
807 (reverse run_cmd)))) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
808 (if debug_post_cmd (set 'project (plist-put project 'debug_post_cmd |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
809 (reverse debug_post_cmd)))) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
810 (if debug_pre_cmd (set 'project (plist-put project 'debug_pre_cmd |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
811 (reverse debug_pre_cmd)))) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
812 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
813 (set-buffer ada-buffer) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
814 ) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
815 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
816 ;; Else the file wasn't readable (probably the default project). |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
817 ;; We initialize it with the current environment variables. |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
818 ;; We need to add the startup directory in front so that |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
819 ;; files locally redefined are properly found. We cannot |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
820 ;; add ".", which varies too much depending on what the |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
821 ;; current buffer is. |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
822 (set 'project |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
823 (plist-put project 'src_dir |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
824 (append |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
825 (list command-line-default-directory) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
826 (split-string (or (getenv "ADA_INCLUDE_PATH") "") ":") |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
827 (list "." default-directory)))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
828 (set 'project |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
829 (plist-put project 'obj_dir |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
830 (append |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
831 (list command-line-default-directory) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
832 (split-string (or (getenv "ADA_OBJECTS_PATH") "") ":") |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
833 (list "." default-directory)))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
834 ) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
835 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
836 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
837 ;; Delete the default project file from the list, if it is there. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
838 ;; Note that in that case, this default project is the only one in |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
839 ;; the list |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
840 (if (assoc nil ada-xref-project-files) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
841 (setq ada-xref-project-files nil)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
842 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
843 ;; Memorize the newly read project file |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
844 (if (assoc prj-file ada-xref-project-files) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
845 (setcdr (assoc prj-file ada-xref-project-files) project) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
846 (add-to-list 'ada-xref-project-files (cons prj-file project))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
847 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
848 ;; Sets up the compilation-search-path so that Emacs is able to |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
849 ;; go to the source of the errors in a compilation buffer |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
850 (setq compilation-search-path (ada-xref-get-src-dir-field)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
851 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
852 ;; Set the casing exceptions file list |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
853 (if casing |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
854 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
855 (setq ada-case-exception-file (reverse casing)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
856 (ada-case-read-exceptions))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
857 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
858 ;; Add the directories to the search path for ff-find-other-file |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
859 ;; Do not add the '/' or '\' at the end |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
860 (setq ada-search-directories-internal |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
861 (append (mapcar 'directory-file-name compilation-search-path) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
862 ada-search-directories)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
863 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
864 (ada-xref-update-project-menu) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
865 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
866 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
867 ;; No prj file ? => Setup default values |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
868 ;; Note that nil means that all compilation modes will first look in the |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
869 ;; current directory, and only then in the current file's directory. This |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
870 ;; current file is assumed at this point to be in the common source |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
871 ;; directory. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
872 (setq compilation-search-path (list nil default-directory)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
873 )) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
874 |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
875 |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
876 (defun ada-find-references (&optional pos arg local-only) |
26227 | 877 "Find all references to the entity under POS. |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
878 Calls gnatfind to find the references. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
879 If ARG is t, the contents of the old *gnatfind* buffer is preserved. |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
880 If LOCAL-ONLY is t, only the declarations in the current file are returned." |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
881 (interactive "d\nP") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
882 (ada-require-project-file) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
883 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
884 (let* ((identlist (ada-read-identifier pos)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
885 (alifile (ada-get-ali-file-name (ada-file-of identlist))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
886 (process-environment (ada-set-environment))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
887 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
888 (set-buffer (get-file-buffer (ada-file-of identlist))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
889 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
890 ;; if the file is more recent than the executable |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
891 (if (or (buffer-modified-p (current-buffer)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
892 (file-newer-than-file-p (ada-file-of identlist) alifile)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
893 (ada-find-any-references (ada-name-of identlist) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
894 (ada-file-of identlist) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
895 nil nil local-only arg) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
896 (ada-find-any-references (ada-name-of identlist) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
897 (ada-file-of identlist) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
898 (ada-line-of identlist) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
899 (ada-column-of identlist) local-only arg))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
900 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
901 |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
902 (defun ada-find-local-references (&optional pos arg) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
903 "Find all references to the entity under POS. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
904 Calls `gnatfind' to find the references. |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
905 If ARG is t, the contents of the old *gnatfind* buffer is preserved." |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
906 (interactive "d\nP") |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
907 (ada-find-references pos arg t)) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
908 |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
909 (defconst ada-gnatfind-buffer-name "*gnatfind*") |
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
910 |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
911 (defun ada-find-any-references |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
912 (entity &optional file line column local-only append) |
26227 | 913 "Search for references to any entity whose name is ENTITY. |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
914 ENTITY was first found the location given by FILE, LINE and COLUMN. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
915 If LOCAL-ONLY is t, then list only the references in FILE, which |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
916 is much faster. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
917 If APPEND is t, then append the output of the command to the existing |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
918 buffer `*gnatfind*', if there is one." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
919 (interactive "sEntity name: ") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
920 (ada-require-project-file) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
921 |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
922 ;; Prepare the gnatfind command. Note that we must protect the quotes |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
923 ;; around operators, so that they are correctly handled and can be |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
924 ;; processed (gnatfind \"+\":...). |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
925 (let* ((quote-entity |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
926 (if (= (aref entity 0) ?\") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
927 (if is-windows |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
928 (concat "\\\"" (substring entity 1 -1) "\\\"") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
929 (concat "'\"" (substring entity 1 -1) "\"'")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
930 entity)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
931 (switches (ada-xref-get-project-field 'gnatfind_opt)) |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
932 (command (concat "gnat find " switches " " |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
933 quote-entity |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
934 (if file (concat ":" (file-name-nondirectory file))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
935 (if line (concat ":" line)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
936 (if column (concat ":" column)) |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
937 (if local-only (concat " " (file-name-nondirectory file))) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
938 )) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
939 old-contents) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
940 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
941 ;; If a project file is defined, use it |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
942 (if (and ada-prj-default-project-file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
943 (not (string= ada-prj-default-project-file ""))) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
944 (if (string-equal (file-name-extension ada-prj-default-project-file) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
945 "gpr") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
946 (setq command (concat command " -P" ada-prj-default-project-file)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
947 (setq command (concat command " -p" ada-prj-default-project-file)))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
948 |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
949 (if (and append (get-buffer ada-gnatfind-buffer-name)) |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
950 (save-excursion |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
951 (set-buffer "*gnatfind*") |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
952 (setq old-contents (buffer-string)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
953 |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
954 (let ((compilation-error "reference")) |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
955 (compilation-start command 'compilation-mode (lambda (mode) ada-gnatfind-buffer-name))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
956 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
957 ;; Hide the "Compilation" menu |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
958 (save-excursion |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
959 (set-buffer ada-gnatfind-buffer-name) |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
960 (local-unset-key [menu-bar compilation-menu]) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
961 |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
962 (if old-contents |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
963 (progn |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
964 (goto-char 1) |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
965 (set 'buffer-read-only nil) |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
966 (insert old-contents) |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
967 (set 'buffer-read-only t) |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
968 (goto-char (point-max))))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
969 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
970 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
971 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
972 (defalias 'ada-change-prj (symbol-function 'ada-set-default-project-file)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
973 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
974 ;; ----- Identifier Completion -------------------------------------------- |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
975 (defun ada-complete-identifier (pos) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
976 "Try to complete the identifier around POS, using compiler cross-reference information." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
977 (interactive "d") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
978 (ada-require-project-file) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
979 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
980 ;; Initialize function-local variables and jump to the .ali buffer |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
981 ;; Note that for regexp search is case insensitive too |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
982 (let* ((curbuf (current-buffer)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
983 (identlist (ada-read-identifier pos)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
984 (sofar (concat "^[0-9]+[a-zA-Z][0-9]+[ *]\\(" |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
985 (regexp-quote (ada-name-of identlist)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
986 "[a-zA-Z0-9_]*\\)")) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
987 (completed nil) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
988 (symalist nil)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
989 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
990 ;; Open the .ali file |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
991 (set-buffer (ada-get-ali-buffer (buffer-file-name))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
992 (goto-char (point-max)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
993 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
994 ;; build an alist of possible completions |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
995 (while (re-search-backward sofar nil t) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
996 (setq symalist (cons (cons (match-string 1) nil) symalist))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
997 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
998 (setq completed (try-completion "" symalist)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
999 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1000 ;; kills .ali buffer |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1001 (kill-buffer nil) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1002 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1003 ;; deletes the incomplete identifier in the buffer |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1004 (set-buffer curbuf) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1005 (looking-at "[a-zA-Z0-9_]+") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1006 (replace-match "") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1007 ;; inserts the completed symbol |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1008 (insert completed) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1009 )) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1010 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1011 ;; ----- Cross-referencing ---------------------------------------- |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1012 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1013 (defun ada-point-and-xref () |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1014 "Jump to the declaration of the entity below the cursor." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1015 (interactive) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1016 (mouse-set-point last-input-event) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1017 (ada-goto-declaration (point))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1018 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1019 (defun ada-point-and-xref-body () |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1020 "Jump to the body of the entity under the cursor." |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1021 (interactive) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1022 (mouse-set-point last-input-event) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1023 (ada-goto-body (point))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1024 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1025 (defun ada-goto-body (pos &optional other-frame) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1026 "Display the body of the entity around POS. |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1027 OTHER-FRAME non-nil means display in another frame. |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1028 If the entity doesn't have a body, display its declaration. |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1029 As a side effect, the buffer for the declaration is also open." |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1030 (interactive "d") |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1031 (ada-goto-declaration pos other-frame) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1032 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1033 ;; Temporarily force the display in the same buffer, since we |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1034 ;; already changed previously |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1035 (let ((ada-xref-other-buffer nil)) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1036 (ada-goto-declaration (point) nil))) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1037 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1038 (defun ada-goto-declaration (pos &optional other-frame) |
26227 | 1039 "Display the declaration of the identifier around POS. |
1040 The declaration is shown in another buffer if `ada-xref-other-buffer' is | |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1041 non-nil. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1042 If OTHER-FRAME is non-nil, display the cross-reference in another frame." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1043 (interactive "d") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1044 (ada-require-project-file) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1045 (push-mark pos) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1046 (ada-xref-push-pos (buffer-file-name) pos) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1047 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1048 ;; First try the standard algorithm by looking into the .ali file, but if |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1049 ;; that file was too old or even did not exist, try to look in the whole |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1050 ;; object path for a possible location. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1051 (let ((identlist (ada-read-identifier pos))) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1052 (condition-case err |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1053 (ada-find-in-ali identlist other-frame) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1054 ;; File not found: print explicit error message |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1055 (error-file-not-found |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1056 (message (concat (error-message-string err) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1057 (nthcdr 1 err)))) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1058 |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1059 (error |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1060 (let ((ali-file (ada-get-ali-file-name (ada-file-of identlist)))) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1061 |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1062 ;; If the ALI file was up-to-date, then we probably have a predefined |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1063 ;; entity, whose references are not given by GNAT |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1064 (if (and (file-exists-p ali-file) |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1065 (file-newer-than-file-p ali-file (ada-file-of identlist))) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1066 (message "No cross-reference found -- may be a predefined entity.") |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1067 |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1068 ;; Else, look in every ALI file, except if the user doesn't want that |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1069 (if ada-xref-search-with-egrep |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1070 (ada-find-in-src-path identlist other-frame) |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1071 (message "Cross-referencing information is not up-to-date; please recompile.") |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1072 ))))))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1073 |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
1074 (defun ada-goto-declaration-other-frame (pos) |
26227 | 1075 "Display the declaration of the identifier around POS. |
1076 The declation is shown in another frame if `ada-xref-other-buffer' is non-nil." | |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1077 (interactive "d") |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1078 (ada-goto-declaration pos t)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1079 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1080 (defun ada-remote (command) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1081 "Return the remote version of COMMAND, or COMMAND if remote_machine is nil." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1082 (let ((machine (ada-xref-get-project-field 'remote_machine))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1083 (if (or (not machine) (string= machine "")) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1084 command |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1085 (format "%s %s '(%s)'" |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1086 remote-shell-program |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1087 machine |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1088 command)))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1089 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1090 (defun ada-get-absolute-dir-list (dir-list root-dir) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1091 "Return the list of absolute directories found in DIR-LIST. |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1092 If a directory is a relative directory, ROOT-DIR is prepended." |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1093 (mapcar (lambda (x) (expand-file-name x root-dir)) dir-list)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1094 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1095 (defun ada-set-environment () |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1096 "Prepare an environment for Ada compilation. |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1097 This returns a new value to use for `process-environment', |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1098 but does not actually put it into use. |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1099 It modifies the source path and object path with the values found in the |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1100 project file." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1101 (let ((include (getenv "ADA_INCLUDE_PATH")) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1102 (objects (getenv "ADA_OBJECTS_PATH")) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1103 (build-dir (ada-xref-get-project-field 'build_dir))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1104 (if include |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1105 (set 'include (concat path-separator include))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1106 (if objects |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1107 (set 'objects (concat path-separator objects))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1108 (cons |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1109 (concat "ADA_INCLUDE_PATH=" |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1110 (mapconcat (lambda(x) (expand-file-name x build-dir)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1111 (ada-xref-get-project-field 'src_dir) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1112 path-separator) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1113 include) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1114 (cons |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1115 (concat "ADA_OBJECTS_PATH=" |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1116 (mapconcat (lambda(x) (expand-file-name x build-dir)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1117 (ada-xref-get-project-field 'obj_dir) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1118 path-separator) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1119 objects) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1120 process-environment)))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1121 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1122 (defun ada-compile-application (&optional arg) |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1123 "Compile the application, using the command found in the project file. |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1124 If ARG is not nil, ask for user confirmation." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1125 (interactive "P") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1126 (ada-require-project-file) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1127 (let ((cmd (ada-xref-get-project-field 'make_cmd)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1128 (process-environment (ada-set-environment)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1129 (compilation-scroll-output t)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1130 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1131 (setq compilation-search-path (ada-xref-get-src-dir-field)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1132 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1133 ;; If no project file was found, ask the user |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1134 (unless cmd |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1135 (setq cmd '("") arg t)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1136 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1137 ;; Make a single command from the list of commands, including the |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1138 ;; commands to run it on a remote machine. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1139 (setq cmd (ada-remote (mapconcat 'identity cmd ada-command-separator))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1140 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1141 (if (or ada-xref-confirm-compile arg) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1142 (setq cmd (read-from-minibuffer "enter command to compile: " cmd))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1143 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1144 ;; Insert newlines so as to separate the name of the commands to run |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1145 ;; and the output of the commands. This doesn't work with cmdproxy.exe, |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1146 ;; which gets confused by newline characters. |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1147 (if (not (string-match ".exe" shell-file-name)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1148 (setq cmd (concat cmd "\n\n"))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1149 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1150 (compile (ada-quote-cmd cmd)))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1151 |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1152 (defun ada-set-main-compile-application () |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1153 "Set main_unit and main project variables to current buffer, build main." |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1154 (interactive) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1155 (ada-require-project-file) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1156 (let* ((file (buffer-file-name (current-buffer))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1157 main) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1158 (if (not file) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1159 (error "No file for current buffer") |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1160 |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1161 (setq main |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1162 (if file |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1163 (file-name-nondirectory |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1164 (file-name-sans-extension file)) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1165 "")) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1166 (ada-xref-set-project-field 'main main) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1167 (ada-xref-set-project-field 'main_unit main) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1168 (ada-compile-application)))) |
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1169 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1170 (defun ada-compile-current (&optional arg prj-field) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1171 "Recompile the current file. |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1172 If ARG is not nil, ask for user confirmation of the command. |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1173 PRJ-FIELD is the name of the field to use in the project file to get the |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
1174 command, and should be either `comp_cmd' (default) or `check_cmd'." |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1175 (interactive "P") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1176 (ada-require-project-file) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1177 (let* ((field (if prj-field prj-field 'comp_cmd)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1178 (cmd (ada-xref-get-project-field field)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1179 (process-environment (ada-set-environment)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1180 (compilation-scroll-output t)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1181 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1182 (setq compilation-search-path (ada-xref-get-src-dir-field)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1183 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1184 (unless cmd |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1185 (setq cmd '("") arg t)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1186 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1187 ;; Make a single command from the list of commands, including the |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1188 ;; commands to run it on a remote machine. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1189 (setq cmd (ada-remote (mapconcat 'identity cmd ada-command-separator))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1190 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1191 ;; If no project file was found, ask the user |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1192 (if (or ada-xref-confirm-compile arg) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1193 (setq cmd (read-from-minibuffer "enter command to compile: " cmd))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1194 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1195 (compile (ada-quote-cmd cmd)))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1196 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1197 (defun ada-check-current (&optional arg) |
74411
f76dd5acc4b2
(ada-check-current): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
74378
diff
changeset
|
1198 "Check the current file for syntax errors. |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1199 If ARG is not nil, ask for user confirmation of the command." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1200 (interactive "P") |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1201 (ada-compile-current arg 'check_cmd)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1202 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1203 (defun ada-run-application (&optional arg) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1204 "Run the application. |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1205 if ARG is not-nil, ask for user confirmation." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1206 (interactive) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1207 (ada-require-project-file) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1208 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1209 (let ((machine (ada-xref-get-project-field 'cross_prefix))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1210 (if (and machine (not (string= machine ""))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1211 (error "This feature is not supported yet for cross environments"))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1212 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1213 (let ((command (ada-xref-get-project-field 'run_cmd))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1214 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1215 ;; Guess the command if it wasn't specified |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1216 (if (not command) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1217 (set 'command (list (file-name-sans-extension (buffer-name))))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1218 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1219 ;; Modify the command to run remotely |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1220 (setq command (ada-remote (mapconcat 'identity command |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1221 ada-command-separator))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1222 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1223 ;; Ask for the arguments to the command if required |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1224 (if (or ada-xref-confirm-compile arg) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1225 (setq command (read-from-minibuffer "Enter command to execute: " |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1226 command))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1227 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1228 ;; Run the command |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1229 (save-excursion |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1230 (set-buffer (get-buffer-create "*run*")) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1231 (set 'buffer-read-only nil) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1232 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1233 (erase-buffer) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1234 (start-process "run" (current-buffer) shell-file-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1235 "-c" command) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1236 (comint-mode) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1237 ;; Set these two variables to their default values, since otherwise |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1238 ;; the output buffer is scrolled so that only the last output line |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1239 ;; is visible at the top of the buffer. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1240 (set (make-local-variable 'scroll-step) 0) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1241 (set (make-local-variable 'scroll-conservatively) 0) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1242 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1243 (display-buffer "*run*") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1244 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1245 ;; change to buffer *run* for interactive programs |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1246 (other-window 1) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1247 (switch-to-buffer "*run*") |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1248 )) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1249 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1250 (defun ada-gdb-application (&optional arg executable-name) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1251 "Start the debugger on the application. |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1252 If ARG is non-nil, ask the user to confirm the command. |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1253 EXECUTABLE-NAME, if non-nil, is debugged instead of the file specified in the |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1254 project file." |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1255 (interactive "P") |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1256 (ada-require-project-file) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1257 (let ((buffer (current-buffer)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1258 cmd pre-cmd post-cmd) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1259 (setq cmd (if executable-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1260 (concat ada-prj-default-debugger " " executable-name) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1261 (ada-xref-get-project-field 'debug_cmd)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1262 pre-cmd (ada-xref-get-project-field 'debug_pre_cmd) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1263 post-cmd (ada-xref-get-project-field 'debug_post_cmd)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1264 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1265 ;; If the command was not given in the project file, start a bare gdb |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1266 (if (not cmd) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1267 (set 'cmd (concat ada-prj-default-debugger |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1268 " " |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1269 (or executable-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1270 (file-name-sans-extension (buffer-file-name)))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1271 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1272 ;; For gvd, add an extra switch so that the Emacs window is completly |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1273 ;; swallowed inside the Gvd one |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1274 (if (and ada-tight-gvd-integration |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1275 (string-match "^[^ \t]*gvd" cmd)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1276 ;; Start a new frame, so that when gvd exists we do not kill Emacs |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1277 ;; We make sure that gvd swallows the new frame, not the one the |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1278 ;; user has been using until now |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1279 ;; The frame is made invisible initially, so that GtkPlug gets a |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1280 ;; chance to fully manage it. Then it works fine with Enlightenment |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1281 ;; as well |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1282 (let ((frame (make-frame '((visibility . nil))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1283 (set 'cmd (concat |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1284 cmd " --editor-window=" |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1285 (cdr (assoc 'outer-window-id (frame-parameters frame))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1286 (select-frame frame))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1287 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1288 ;; Add a -fullname switch |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1289 ;; Use the remote machine |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1290 (set 'cmd (ada-remote (concat cmd " -fullname "))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1291 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1292 ;; Ask for confirmation if required |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1293 (if (or arg ada-xref-confirm-compile) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1294 (set 'cmd (read-from-minibuffer "enter command to debug: " cmd))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1295 |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
1296 (let ((old-comint-exec (symbol-function 'comint-exec))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1297 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1298 ;; Do not add -fullname, since we can have a 'rsh' command in front. |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
1299 ;; FIXME: This is evil but luckily a nop under Emacs-21.3.50 ! -stef |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1300 (fset 'gud-gdb-massage-args (lambda (file args) args)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1301 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1302 (set 'pre-cmd (mapconcat 'identity pre-cmd ada-command-separator)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1303 (if (not (equal pre-cmd "")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1304 (setq pre-cmd (concat pre-cmd ada-command-separator))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1305 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1306 (set 'post-cmd (mapconcat 'identity post-cmd "\n")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1307 (if post-cmd |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
1308 (set 'post-cmd (concat post-cmd "\n"))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1309 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1310 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1311 ;; Temporarily replaces the definition of `comint-exec' so that we |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1312 ;; can execute commands before running gdb. |
50984
7e8592bdc9a1
(ada-xref-update-project-menu): Use easymenu.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50811
diff
changeset
|
1313 ;; FIXME: This is evil and not temporary !!! -stef |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1314 (fset 'comint-exec |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1315 `(lambda (buffer name command startfile switches) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1316 (let (compilation-buffer-name-function) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1317 (save-excursion |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1318 (set 'compilation-buffer-name-function |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1319 (lambda(x) (buffer-name buffer))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1320 (compile (ada-quote-cmd |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1321 (concat ,pre-cmd |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1322 command " " |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1323 (mapconcat 'identity switches " ")))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1324 )) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1325 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1326 ;; Tight integration should force the tty mode |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1327 (if (and (string-match "gvd" (comint-arguments cmd 0 0)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1328 ada-tight-gvd-integration |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1329 (not (string-match "--tty" cmd))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1330 (setq cmd (concat cmd "--tty"))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1331 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1332 (if (and (string-match "jdb" (comint-arguments cmd 0 0)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1333 (boundp 'jdb)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1334 (funcall (symbol-function 'jdb) cmd) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1335 (gdb cmd)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1336 |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1337 ;; Restore the standard fset command (or for instance C-U M-x shell |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1338 ;; wouldn't work anymore |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1339 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1340 (fset 'comint-exec old-comint-exec) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1341 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1342 ;; Send post-commands to the debugger |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1343 (process-send-string (get-buffer-process (current-buffer)) post-cmd) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1344 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1345 ;; Move to the end of the debugger buffer, so that it is automatically |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1346 ;; scrolled from then on. |
58004
ae799359b66c
(ada-gdb-application): Use goto-char instead of beginning-of-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
57824
diff
changeset
|
1347 (goto-char (point-max)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1348 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1349 ;; Display both the source window and the debugger window (the former |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1350 ;; above the latter). No need to show the debugger window unless it |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1351 ;; is going to have some relevant information. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1352 (if (or (not (string-match "gvd" (comint-arguments cmd 0 0))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1353 (string-match "--tty" cmd)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1354 (split-window-vertically)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1355 (switch-to-buffer buffer) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1356 ))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1357 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1358 (defun ada-reread-prj-file (&optional filename) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1359 "Reread either the current project, or FILENAME if non-nil." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1360 (interactive "P") |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1361 (if filename |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1362 (ada-parse-prj-file filename) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1363 (ada-parse-prj-file (ada-prj-find-prj-file))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1364 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1365 ;; Reread the location of the standard runtime library |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1366 (ada-initialize-runtime-library |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1367 (or (ada-xref-get-project-field 'cross_prefix) "")) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1368 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1369 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1370 ;; ------ Private routines |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1371 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1372 (defun ada-xref-current (file &optional ali-file-name) |
26227 | 1373 "Update the cross-references for FILE. |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1374 This in fact recompiles FILE to create ALI-FILE-NAME. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1375 This function returns the name of the file that was recompiled to generate |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
1376 the cross-reference information. Note that the ali file can then be deduced |
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
1377 by replacing the file extension with `.ali'." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1378 ;; kill old buffer |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1379 (if (and ali-file-name |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1380 (get-file-buffer ali-file-name)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1381 (kill-buffer (get-file-buffer ali-file-name))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1382 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1383 (let* ((name (ada-convert-file-name file)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1384 (body-name (or (ada-get-body-name name) name))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1385 |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1386 ;; Always recompile the body when we can. We thus temporarily switch to a |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1387 ;; buffer than contains the body of the unit |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1388 (save-excursion |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1389 (let ((body-visible (find-buffer-visiting body-name)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1390 process) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1391 (if body-visible |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1392 (set-buffer body-visible) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1393 (find-file body-name)) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1394 |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1395 ;; Execute the compilation. Note that we must wait for the end of the |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1396 ;; process, or the ALI file would still not be available. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1397 ;; Unfortunately, the underlying `compile' command that we use is |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1398 ;; asynchronous. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1399 (ada-compile-current) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1400 (setq process (get-buffer-process "*compilation*")) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1401 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1402 (while (and process |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1403 (not (equal (process-status process) 'exit))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1404 (sit-for 1)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1405 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1406 ;; remove the buffer for the body if it wasn't there before |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1407 (unless body-visible |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1408 (kill-buffer (find-buffer-visiting body-name))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1409 )) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1410 body-name)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1411 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1412 (defun ada-find-file-in-dir (file dir-list) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1413 "Search for FILE in DIR-LIST." |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1414 (let (found) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1415 (while (and (not found) dir-list) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1416 (set 'found (concat (file-name-as-directory (car dir-list)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1417 (file-name-nondirectory file))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1418 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1419 (unless (file-exists-p found) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1420 (set 'found nil)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1421 (set 'dir-list (cdr dir-list))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1422 found)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1423 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1424 (defun ada-find-ali-file-in-dir (file) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1425 "Find the ali file FILE, searching obj_dir for the current project. |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1426 Adds build_dir in front of the search path to conform to gnatmake's behavior, |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1427 and the standard runtime location at the end." |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1428 (ada-find-file-in-dir file (ada-xref-get-obj-dir-field))) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1429 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1430 (defun ada-find-src-file-in-dir (file) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1431 "Find the source file FILE, searching src_dir for the current project. |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1432 Adds the standard runtime location at the end of the search path to conform |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1433 to gnatmake's behavior." |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1434 (ada-find-file-in-dir file (ada-xref-get-src-dir-field))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1435 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1436 (defun ada-get-ali-file-name (file) |
26227 | 1437 "Create the ali file name for the ada-file FILE. |
1438 The file is searched for in every directory shown in the obj_dir lines of | |
1439 the project file." | |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1440 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1441 ;; This function has to handle the special case of non-standard |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1442 ;; file names (i.e. not .adb or .ads) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1443 ;; The trick is the following: |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1444 ;; 1- replace the extension of the current file with .ali, |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1445 ;; and look for this file |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1446 ;; 2- If this file is found: |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1447 ;; grep the "^U" lines, and make sure we are not reading the |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1448 ;; .ali file for a spec file. If we are, go to step 3. |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1449 ;; 3- If the file is not found or step 2 failed: |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1450 ;; find the name of the "other file", ie the body, and look |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1451 ;; for its associated .ali file by subtituing the extension |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1452 ;; |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1453 ;; We must also handle the case of separate packages and subprograms: |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1454 ;; 4- If no ali file was found, we try to modify the file name by removing |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1455 ;; everything after the last '-' or '.' character, so as to get the |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1456 ;; ali file for the parent unit. If we found an ali file, we check that |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1457 ;; it indeed contains the definition for the separate entity by checking |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1458 ;; the 'D' lines. This is done repeatedly, in case the direct parent is |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1459 ;; also a separate. |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1460 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1461 (save-excursion |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1462 (set-buffer (get-file-buffer file)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1463 (let ((short-ali-file-name |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1464 (concat (file-name-sans-extension (file-name-nondirectory file)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1465 ".ali")) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1466 ali-file-name |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1467 is-spec) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1468 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1469 ;; If we have a non-standard file name, and this is a spec, we first |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1470 ;; look for the .ali file of the body, since this is the one that |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1471 ;; contains the most complete information. If not found, we will do what |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1472 ;; we can with the .ali file for the spec... |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1473 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1474 (if (not (string= (file-name-extension file) "ads")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1475 (let ((specs ada-spec-suffixes)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1476 (while specs |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1477 (if (string-match (concat (regexp-quote (car specs)) "$") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1478 file) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1479 (set 'is-spec t)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1480 (set 'specs (cdr specs))))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1481 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1482 (if is-spec |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1483 (set 'ali-file-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1484 (ada-find-ali-file-in-dir |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1485 (concat (file-name-sans-extension |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1486 (file-name-nondirectory |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1487 (ada-other-file-name))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1488 ".ali")))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1489 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1490 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1491 (setq ali-file-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1492 (or ali-file-name |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1493 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1494 ;; Else we take the .ali file associated with the unit |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1495 (ada-find-ali-file-in-dir short-ali-file-name) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1496 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1497 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1498 ;; else we did not find the .ali file Second chance: in case |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1499 ;; the files do not have standard names (such as for instance |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1500 ;; file_s.ada and file_b.ada), try to go to the other file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1501 ;; and look for its ali file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1502 (ada-find-ali-file-in-dir |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1503 (concat (file-name-sans-extension |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1504 (file-name-nondirectory (ada-other-file-name))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1505 ".ali")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1506 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1507 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1508 ;; If we still don't have an ali file, try to get the one |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1509 ;; from the parent unit, in case we have a separate entity. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1510 (let ((parent-name (file-name-sans-extension |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1511 (file-name-nondirectory file)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1512 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1513 (while (and (not ali-file-name) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1514 (string-match "^\\(.*\\)[.-][^.-]*" parent-name)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1515 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1516 (set 'parent-name (match-string 1 parent-name)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1517 (set 'ali-file-name (ada-find-ali-file-in-dir |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1518 (concat parent-name ".ali"))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1519 ) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1520 ali-file-name))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1521 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1522 ;; If still not found, try to recompile the file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1523 (if (not ali-file-name) |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1524 ;; Recompile only if the user asked for this, and search the ali |
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1525 ;; filename again. We avoid a possible infinite recursion by |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1526 ;; temporarily disabling the automatic compilation. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1527 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1528 (if ada-xref-create-ali |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1529 (setq ali-file-name |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1530 (concat (file-name-sans-extension (ada-xref-current file)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1531 ".ali")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1532 |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1533 (error "`.ali' file not found; recompile your source file")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1534 |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1535 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1536 ;; same if the .ali file is too old and we must recompile it |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1537 (if (and (file-newer-than-file-p file ali-file-name) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1538 ada-xref-create-ali) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1539 (ada-xref-current file ali-file-name))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1540 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1541 ;; Always return the correct absolute file name |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1542 (expand-file-name ali-file-name)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1543 )) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1544 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1545 (defun ada-get-ada-file-name (file original-file) |
26227 | 1546 "Create the complete file name (+directory) for FILE. |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
1547 The original file (where the user was) is ORIGINAL-FILE. |
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
1548 Search in project file for possible paths." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1549 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1550 (save-excursion |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1551 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1552 ;; If the buffer for original-file, use it to get the values from the |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1553 ;; project file, otherwise load the file and its project file |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1554 (let ((buffer (get-file-buffer original-file))) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1555 (if buffer |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1556 (set-buffer buffer) |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
1557 (find-file original-file))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1558 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1559 ;; we choose the first possible completion and we |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1560 ;; return the absolute file name |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1561 (let ((filename (ada-find-src-file-in-dir file))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1562 (if filename |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1563 (expand-file-name filename) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1564 (signal 'error-file-not-found (file-name-nondirectory file))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1565 ))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1566 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1567 (defun ada-find-file-number-in-ali (file) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1568 "Return the file number for FILE in the associated ali file." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1569 (set-buffer (ada-get-ali-buffer file)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1570 (goto-char (point-min)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1571 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1572 (let ((begin (re-search-forward "^D"))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1573 (beginning-of-line) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1574 (re-search-forward (concat "^D " (file-name-nondirectory file))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1575 (count-lines begin (point)))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1576 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1577 (defun ada-read-identifier (pos) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1578 "Return the identlist around POS and switch to the .ali buffer. |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1579 The returned list represents the entity, and can be manipulated through the |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1580 macros `ada-name-of', `ada-line-of', `ada-column-of', `ada-file-of',..." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1581 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1582 ;; If at end of buffer (e.g the buffer is empty), error |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1583 (if (>= (point) (point-max)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1584 (error "No identifier on point")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1585 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1586 ;; goto first character of the identifier/operator (skip backward < and > |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1587 ;; since they are part of multiple character operators |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1588 (goto-char pos) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1589 (skip-chars-backward "a-zA-Z0-9_<>") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1590 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1591 ;; check if it really is an identifier |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1592 (if (ada-in-comment-p) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1593 (error "Inside comment")) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1594 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1595 (let (identifier identlist) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1596 ;; Just in front of a string => we could have an operator declaration, |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1597 ;; as in "+", "-", .. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1598 (if (= (char-after) ?\") |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1599 (forward-char 1)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1600 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1601 ;; if looking at an operator |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1602 ;; This is only true if: |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1603 ;; - the symbol is +, -, ... |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1604 ;; - the symbol is made of letters, and not followed by _ or a letter |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1605 (if (and (looking-at ada-operator-re) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1606 (or (not (= (char-syntax (char-after)) ?w)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1607 (not (or (= (char-syntax (char-after (match-end 0))) ?w) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1608 (= (char-after (match-end 0)) ?_))))) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1609 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1610 (if (and (= (char-before) ?\") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1611 (= (char-after (+ (length (match-string 0)) (point))) ?\")) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1612 (forward-char -1)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1613 (set 'identifier (regexp-quote (concat "\"" (match-string 0) "\"")))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1614 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1615 (if (ada-in-string-p) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1616 (error "Inside string or character constant")) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1617 (if (looking-at (concat ada-keywords "[^a-zA-Z_]")) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1618 (error "No cross-reference available for reserved keyword")) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1619 (if (looking-at "[a-zA-Z0-9_]+") |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1620 (set 'identifier (match-string 0)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1621 (error "No identifier around"))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1622 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1623 ;; Build the identlist |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1624 (set 'identlist (ada-make-identlist)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1625 (ada-set-name identlist (downcase identifier)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1626 (ada-set-line identlist |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1627 (number-to-string (count-lines 1 (point)))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1628 (ada-set-column identlist |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1629 (number-to-string (1+ (current-column)))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1630 (ada-set-file identlist (buffer-file-name)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1631 identlist |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1632 )) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1633 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1634 (defun ada-get-all-references (identlist) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1635 "Complete IDENTLIST with definition file and places where it is referenced. |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1636 Information is extracted from the ali file." |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1637 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1638 (let ((ali-buffer (ada-get-ali-buffer (ada-file-of identlist))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1639 declaration-found) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1640 (set-buffer ali-buffer) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1641 (goto-char (point-min)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1642 (ada-set-on-declaration identlist nil) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1643 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1644 ;; First attempt: we might already be on the declaration of the identifier |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1645 ;; We want to look for the declaration only in a definite interval (after |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1646 ;; the "^X ..." line for the current file, and before the next "^X" line |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1647 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1648 (if (re-search-forward |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1649 (concat "^X [0-9]+ " (file-name-nondirectory (ada-file-of identlist))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1650 nil t) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1651 (let ((bound (save-excursion (re-search-forward "^X " nil t)))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1652 (set 'declaration-found |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1653 (re-search-forward |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1654 (concat "^" (ada-line-of identlist) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1655 "." (ada-column-of identlist) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1656 "[ *]" (ada-name-of identlist) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1657 "[{\[\(<= ]?\\(.*\\)$") bound t)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1658 (if declaration-found |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1659 (ada-set-on-declaration identlist t)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1660 )) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1661 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1662 ;; If declaration is still nil, then we were not on a declaration, and |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1663 ;; have to fall back on other algorithms |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1664 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1665 (unless declaration-found |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1666 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1667 ;; Since we alread know the number of the file, search for a direct |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1668 ;; reference to it |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1669 (goto-char (point-min)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1670 (set 'declaration-found t) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1671 (ada-set-ali-index |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1672 identlist |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1673 (number-to-string (ada-find-file-number-in-ali |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1674 (ada-file-of identlist)))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1675 (unless (re-search-forward (concat (ada-ali-index-of identlist) |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1676 "|\\([0-9]+[^0-9][0-9]+\\(\n\\.\\)? \\)*" |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1677 (ada-line-of identlist) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1678 "[^etpzkd<>=^]" |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1679 (ada-column-of identlist) "\\>") |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1680 nil t) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1681 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1682 ;; if we did not find it, it may be because the first reference |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1683 ;; is not required to have a 'unit_number|' item included. |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1684 ;; Or maybe we are already on the declaration... |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1685 (unless (re-search-forward |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1686 (concat |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1687 "^[0-9]+.[0-9]+[ *]" |
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1688 (ada-name-of identlist) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1689 "[ <{=\(\[]\\(.\\|\n\\.\\)*\\<" |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1690 (ada-line-of identlist) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1691 "[^0-9]" |
45930
dd1d952f59c2
Update copyright notice.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44909
diff
changeset
|
1692 (ada-column-of identlist) "\\>") |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1693 nil t) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1694 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1695 ;; If still not found, then either the declaration is unknown |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1696 ;; or the source file has been modified since the ali file was |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1697 ;; created |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1698 (set 'declaration-found nil) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1699 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1700 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1701 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1702 ;; Last check to be completly sure we have found the correct line (the |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1703 ;; ali might not be up to date for instance) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1704 (if declaration-found |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1705 (progn |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1706 (beginning-of-line) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1707 ;; while we have a continuation line, go up one line |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1708 (while (looking-at "^\\.") |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1709 (previous-line 1) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1710 (beginning-of-line)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1711 (unless (looking-at (concat "[0-9]+.[0-9]+[ *]" |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1712 (ada-name-of identlist) "[ <{=\(\[]")) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1713 (set 'declaration-found nil)))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1714 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1715 ;; Still no success ! The ali file must be too old, and we need to |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1716 ;; use a basic algorithm based on guesses. Note that this only happens |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1717 ;; if the user does not want us to automatically recompile files |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1718 ;; automatically |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1719 (unless declaration-found |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1720 (if (ada-xref-find-in-modified-ali identlist) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1721 (set 'declaration-found t) |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1722 ;; No more idea to find the declaration. Give up |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1723 (progn |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1724 (kill-buffer ali-buffer) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1725 (error (concat "No declaration of " (ada-name-of identlist) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1726 " found.")) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1727 ))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1728 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1729 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1730 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1731 ;; Now that we have found a suitable line in the .ali file, get the |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1732 ;; information available |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1733 (beginning-of-line) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1734 (if declaration-found |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1735 (let ((current-line (buffer-substring |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1736 (point) (save-excursion (end-of-line) (point))))) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1737 (save-excursion |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1738 (next-line 1) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1739 (beginning-of-line) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1740 (while (looking-at "^\\.\\(.*\\)") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1741 (set 'current-line (concat current-line (match-string 1))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1742 (next-line 1)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1743 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1744 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1745 (if (re-search-backward "^X [0-9]+ \\([a-zA-Z0-9_.-]+\\)" nil t) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1746 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1747 ;; If we can find the file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1748 (condition-case err |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1749 (ada-set-declare-file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1750 identlist |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1751 (ada-get-ada-file-name (match-string 1) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1752 (ada-file-of identlist))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1753 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1754 ;; Else clean up the ali file |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1755 (error-file-not-found |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1756 (signal (car err) (cdr err))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1757 (error |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1758 (kill-buffer ali-buffer) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1759 (error (error-message-string err))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1760 )) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1761 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1762 (ada-set-references identlist current-line) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1763 )) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1764 )) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1765 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1766 (defun ada-xref-find-in-modified-ali (identlist) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1767 "Find the matching position for IDENTLIST in the current ali buffer. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1768 This function is only called when the file was not up-to-date, so we need |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1769 to make some guesses. |
26227 | 1770 This function is disabled for operators, and only works for identifiers." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1771 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1772 (unless (= (string-to-char (ada-name-of identlist)) ?\") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1773 (progn |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1774 (let ((declist '()) ;;; ( (line_in_ali_file line_in_ada) ( ... )) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1775 (my-regexp (concat "[ *]" |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1776 (regexp-quote (ada-name-of identlist)) " ")) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1777 (line-ada "--") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1778 (col-ada "--") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1779 (line-ali 0) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1780 (len 0) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1781 (choice 0) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1782 (ali-buffer (current-buffer))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1783 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1784 (goto-char (point-max)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1785 (while (re-search-backward my-regexp nil t) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1786 (save-excursion |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1787 (set 'line-ali (count-lines 1 (point))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1788 (beginning-of-line) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1789 ;; have a look at the line and column numbers |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1790 (if (looking-at "^\\([0-9]+\\).\\([0-9]+\\)[ *]") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1791 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1792 (setq line-ada (match-string 1)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1793 (setq col-ada (match-string 2))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1794 (setq line-ada "--") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1795 (setq col-ada "--") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1796 ) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1797 ;; construct a list with the file names and the positions within |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1798 (if (re-search-backward "^X [0-9]+ \\([a-zA-Z0-9._-]+\\)" nil t) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1799 (add-to-list |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1800 'declist (list line-ali (match-string 1) line-ada col-ada)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1801 ) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1802 ) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1803 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1804 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1805 ;; how many possible declarations have we found ? |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1806 (setq len (length declist)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1807 (cond |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1808 ;; none => error |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1809 ((= len 0) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1810 (kill-buffer (current-buffer)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1811 (error (concat "No declaration of " |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1812 (ada-name-of identlist) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1813 " recorded in .ali file"))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1814 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1815 ;; one => should be the right one |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1816 ((= len 1) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1817 (goto-line (caar declist))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1818 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1819 ;; more than one => display choice list |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1820 (t |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1821 (save-window-excursion |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1822 (with-output-to-temp-buffer "*choice list*" |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1823 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1824 (princ "Identifier is overloaded and Xref information is not up to date.\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1825 (princ "Possible declarations are:\n\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1826 (princ " no. in file at line col\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1827 (princ " --- --------------------- ---- ----\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1828 (let ((counter 0)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1829 (while (< counter len) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1830 (princ (format " %2d) %-21s %4s %4s\n" |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1831 (1+ counter) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1832 (ada-get-ada-file-name |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1833 (nth 1 (nth counter declist)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1834 (ada-file-of identlist)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1835 (nth 2 (nth counter declist)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1836 (nth 3 (nth counter declist)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1837 )) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1838 (setq counter (1+ counter)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1839 ) ; end of while |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1840 ) ; end of let |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1841 ) ; end of with-output-to ... |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1842 (setq choice nil) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1843 (while (or |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1844 (not choice) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1845 (not (integerp choice)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1846 (< choice 1) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1847 (> choice len)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1848 (setq choice |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
58004
diff
changeset
|
1849 (string-to-number |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1850 (read-from-minibuffer "Enter No. of your choice: ")))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1851 ) |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
1852 (set-buffer ali-buffer) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1853 (goto-line (car (nth (1- choice) declist))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1854 )))))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1855 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1856 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1857 (defun ada-find-in-ali (identlist &optional other-frame) |
26227 | 1858 "Look in the .ali file for the definition of the identifier in IDENTLIST. |
73651
ed8762ada96d
(ada-find-in-ali): Use "non-nil" in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
73563
diff
changeset
|
1859 If OTHER-FRAME is non-nil, and `ada-xref-other-buffer' is non-nil, |
26227 | 1860 opens a new window to show the declaration." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1861 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1862 (ada-get-all-references identlist) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1863 (let ((ali-line (ada-references-of identlist)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1864 (locations nil) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1865 (start 0) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1866 file line col) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1867 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1868 ;; Note: in some cases, an entity can have multiple references to the |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1869 ;; bodies (this is for instance the case for a separate subprogram, that |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1870 ;; has a reference both to the stub and to the real body). |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1871 ;; In that case, we simply go to each one in turn. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1872 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1873 ;; Get all the possible locations |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1874 (string-match "^\\([0-9]+\\)[a-zA-Z+*]\\([0-9]+\\)[ *]" ali-line) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1875 (set 'locations (list (list (match-string 1 ali-line) ;; line |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1876 (match-string 2 ali-line) ;; column |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1877 (ada-declare-file-of identlist)))) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1878 (while (string-match "\\([0-9]+\\)[bc]\\(<[^>]+>\\)?\\([0-9]+\\)" |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1879 ali-line start) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1880 (setq line (match-string 1 ali-line) |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1881 col (match-string 3 ali-line) |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
1882 start (match-end 3)) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1883 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1884 ;; it there was a file number in the same line |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1885 ;; Make sure we correctly handle the case where the first file reference |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1886 ;; on the line is the type reference. |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1887 ;; 1U2 T(2|2r3) 34r23 |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
1888 (if (string-match (concat "[^{(<0-9]\\([0-9]+\\)|\\([^|bc]+\\)?" |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1889 (match-string 0 ali-line)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1890 ali-line) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1891 (let ((file-number (match-string 1 ali-line))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1892 (goto-char (point-min)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1893 (re-search-forward "^D \\([a-zA-Z0-9_.-]+\\)" nil t |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1894 (string-to-number file-number)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1895 (set 'file (match-string 1)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1896 ) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1897 ;; Else get the nearest file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1898 (set 'file (ada-declare-file-of identlist))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1899 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1900 (set 'locations (append locations (list (list line col file))))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1901 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1902 ;; Add the specs at the end again, so that from the last body we go to |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1903 ;; the specs |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1904 (set 'locations (append locations (list (car locations)))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1905 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1906 ;; Find the new location we want to go to. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1907 ;; If we are on none of the locations listed, we simply go to the specs. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1908 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1909 (setq line (caar locations) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1910 col (nth 1 (car locations)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1911 file (nth 2 (car locations))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1912 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1913 (while locations |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1914 (if (and (string= (caar locations) (ada-line-of identlist)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1915 (string= (nth 1 (car locations)) (ada-column-of identlist)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1916 (string= (file-name-nondirectory (nth 2 (car locations))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1917 (file-name-nondirectory (ada-file-of identlist)))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1918 (setq locations (cadr locations) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1919 line (car locations) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1920 col (nth 1 locations) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1921 file (nth 2 locations) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1922 locations nil) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1923 (set 'locations (cdr locations)))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1924 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1925 ;; Find the file in the source path |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1926 (set 'file (ada-get-ada-file-name file (ada-file-of identlist))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1927 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1928 ;; Kill the .ali buffer |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1929 (kill-buffer (current-buffer)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1930 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1931 ;; Now go to the buffer |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1932 (ada-xref-change-buffer file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1933 (string-to-number line) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1934 (1- (string-to-number col)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1935 identlist |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1936 other-frame) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1937 )) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
1938 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1939 (defun ada-find-in-src-path (identlist &optional other-frame) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1940 "More general function for cross-references. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1941 This function should be used when the standard algorithm that parses the |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1942 .ali file has failed, either because that file was too old or even did not |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1943 exist. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1944 This function attempts to find the possible declarations for the identifier |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1945 anywhere in the object path. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1946 This command requires the external `egrep' program to be available. |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1947 |
78543
4e51ba479b3c
(ada-gnatls-args): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
78234
diff
changeset
|
1948 This works well when one is using an external library and wants to find |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
1949 the declaration and documentation of the subprograms one is using." |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
1950 ;; FIXME: what does this function do? |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1951 (let (list |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1952 (dirs (ada-xref-get-obj-dir-field)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1953 (regexp (concat "[ *]" (ada-name-of identlist))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1954 line column |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1955 choice |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1956 file) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1957 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1958 (save-excursion |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1959 |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
1960 ;; Do the grep in all the directories. We do multiple shell |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1961 ;; commands instead of one in case there is no .ali file in one |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1962 ;; of the directory and the shell stops because of that. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1963 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1964 (set-buffer (get-buffer-create "*grep*")) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1965 (while dirs |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1966 (insert (shell-command-to-string |
73378
3eb6ddcc34d3
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68773
diff
changeset
|
1967 (concat |
3eb6ddcc34d3
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68773
diff
changeset
|
1968 "grep -E -i -h " |
3eb6ddcc34d3
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68773
diff
changeset
|
1969 (shell-quote-argument (concat "^X|" regexp "( |$)")) |
3eb6ddcc34d3
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68773
diff
changeset
|
1970 " " |
3eb6ddcc34d3
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68773
diff
changeset
|
1971 (shell-quote-argument (file-name-as-directory (car dirs))) |
3eb6ddcc34d3
2006-10-15 Lennart Borgman <lennart.borgman.073@student.lu.se>
Kim F. Storm <storm@cua.dk>
parents:
68773
diff
changeset
|
1972 "*.ali"))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1973 (set 'dirs (cdr dirs))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1974 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1975 ;; Now parse the output |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1976 (set 'case-fold-search t) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1977 (goto-char (point-min)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1978 (while (re-search-forward regexp nil t) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1979 (save-excursion |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1980 (beginning-of-line) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1981 (if (not (= (char-after) ?X)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1982 (progn |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1983 (looking-at "\\([0-9]+\\).\\([0-9]+\\)") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1984 (setq line (match-string 1) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1985 column (match-string 2)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1986 (re-search-backward "^X [0-9]+ \\(.*\\)$") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1987 (set 'file (list (match-string 1) line column)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1988 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1989 ;; There could be duplicate choices, because of the structure |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1990 ;; of the .ali files |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1991 (unless (member file list) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1992 (set 'list (append list (list file)))))))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1993 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1994 ;; Current buffer is still "*grep*" |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1995 (kill-buffer "*grep*") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1996 ) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
1997 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1998 ;; Now display the list of possible matches |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
1999 (cond |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
2000 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2001 ;; No choice found => Error |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2002 ((null list) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2003 (error "No cross-reference found, please recompile your file")) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
2004 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2005 ;; Only one choice => Do the cross-reference |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2006 ((= (length list) 1) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2007 (set 'file (ada-find-src-file-in-dir (caar list))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2008 (if file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2009 (ada-xref-change-buffer file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2010 (string-to-number (nth 1 (car list))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2011 (string-to-number (nth 2 (car list))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2012 identlist |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2013 other-frame) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2014 (error (concat (caar list) " not found in src_dir"))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2015 (message "This is only a (good) guess at the cross-reference.") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2016 ) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
2017 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2018 ;; Else, ask the user |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2019 (t |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2020 (save-window-excursion |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2021 (with-output-to-temp-buffer "*choice list*" |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
2022 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2023 (princ "Identifier is overloaded and Xref information is not up to date.\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2024 (princ "Possible declarations are:\n\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2025 (princ " no. in file at line col\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2026 (princ " --- --------------------- ---- ----\n") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2027 (let ((counter 0)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2028 (while (< counter (length list)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2029 (princ (format " %2d) %-21s %4s %4s\n" |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2030 (1+ counter) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2031 (nth 0 (nth counter list)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2032 (nth 1 (nth counter list)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2033 (nth 2 (nth counter list)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2034 )) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2035 (setq counter (1+ counter)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2036 ))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2037 (setq choice nil) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2038 (while (or (not choice) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2039 (not (integerp choice)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2040 (< choice 1) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2041 (> choice (length list))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2042 (setq choice |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
58004
diff
changeset
|
2043 (string-to-number |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2044 (read-from-minibuffer "Enter No. of your choice: ")))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2045 ) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2046 (set 'choice (1- choice)) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2047 (kill-buffer "*choice list*") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2048 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2049 (set 'file (ada-find-src-file-in-dir (car (nth choice list)))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2050 (if file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2051 (ada-xref-change-buffer file |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2052 (string-to-number (nth 1 (nth choice list))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2053 (string-to-number (nth 2 (nth choice list))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2054 identlist |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2055 other-frame) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2056 (signal 'error-file-not-found (car (nth choice list)))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2057 (message "This is only a (good) guess at the cross-reference.") |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2058 )))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2059 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2060 (defun ada-xref-change-buffer |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2061 (file line column identlist &optional other-frame) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2062 "Select and display FILE, at LINE and COLUMN. |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2063 If we do not end on the same identifier as IDENTLIST, find the closest |
56766
e8b5658b7aac
Many doc and style fixes.
Richard M. Stallman <rms@gnu.org>
parents:
56284
diff
changeset
|
2064 match. Kills the .ali buffer at the end. |
26227 | 2065 If OTHER-FRAME is non-nil, creates a new frame to show the file." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2066 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2067 (let (declaration-buffer) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2068 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2069 ;; Select and display the destination buffer |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2070 (if ada-xref-other-buffer |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2071 (if other-frame |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2072 (find-file-other-frame file) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2073 (set 'declaration-buffer (find-file-noselect file)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2074 (set-buffer declaration-buffer) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2075 (switch-to-buffer-other-window declaration-buffer) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2076 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2077 (find-file file) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2078 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2079 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2080 ;; move the cursor to the correct position |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2081 (push-mark) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2082 (goto-line line) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2083 (move-to-column column) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2084 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2085 ;; If we are not on the identifier, the ali file was not up-to-date. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2086 ;; Try to find the nearest position where the identifier is found, |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2087 ;; this is probably the right one. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2088 (unless (looking-at (ada-name-of identlist)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2089 (ada-xref-search-nearest (ada-name-of identlist))) |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2090 )) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2091 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2092 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2093 (defun ada-xref-search-nearest (name) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2094 "Search for NAME nearest to the position recorded in the Xref file. |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2095 Return the position of the declaration in the buffer, or nil if not found." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2096 (let ((orgpos (point)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2097 (newpos nil) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2098 (diff nil)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2099 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2100 (goto-char (point-max)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2101 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2102 ;; loop - look for all declarations of name in this file |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2103 (while (search-backward name nil t) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2104 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2105 ;; check if it really is a complete Ada identifier |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2106 (if (and |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2107 (not (save-excursion |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2108 (goto-char (match-end 0)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2109 (looking-at "_"))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2110 (not (ada-in-string-or-comment-p)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2111 (or |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2112 ;; variable declaration ? |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2113 (save-excursion |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2114 (skip-chars-forward "a-zA-Z_0-9" ) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2115 (ada-goto-next-non-ws) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2116 (looking-at ":[^=]")) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2117 ;; procedure, function, task or package declaration ? |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2118 (save-excursion |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2119 (ada-goto-previous-word) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2120 (looking-at "\\<[pP][rR][oO][cC][eE][dD][uU][rR][eE]\\>\\|\\<[fF][uU][nN][cC][tT][iI][oO][nN]\\>\\|\\<[tT][yY][pP][eE]\\>\\|\\<[tT][aA][sS][kK]\\>\\|\\<[pP][aA][cC][kK][aA][gG][eE]\\>\\|\\<[bB][oO][dD][yY]\\>")))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2121 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2122 ;; check if it is nearer than the ones before if any |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2123 (if (or (not diff) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2124 (< (abs (- (point) orgpos)) diff)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2125 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2126 (setq newpos (point) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2127 diff (abs (- newpos orgpos)))))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2128 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2129 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2130 (if newpos |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2131 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2132 (message "ATTENTION: this declaration is only a (good) guess ...") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2133 (goto-char newpos)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2134 nil))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2135 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2136 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2137 ;; Find the parent library file of the current file |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2138 (defun ada-goto-parent () |
26227 | 2139 "Go to the parent library file." |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2140 (interactive) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2141 (ada-require-project-file) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2142 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2143 (let ((buffer (ada-get-ali-buffer (buffer-file-name))) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2144 (unit-name nil) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2145 (body-name nil) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2146 (ali-name nil)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2147 (save-excursion |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2148 (set-buffer buffer) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2149 (goto-char (point-min)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2150 (re-search-forward "^U \\([^ \t%]+\\)%[bs][ \t]+\\([^ \t]+\\)") |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2151 (setq unit-name (match-string 1)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2152 (if (not (string-match "\\(.*\\)\\.[^.]+" unit-name)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2153 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2154 (kill-buffer buffer) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2155 (error "No parent unit !")) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2156 (setq unit-name (match-string 1 unit-name)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2157 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2158 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2159 ;; look for the file name for the parent unit specification |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2160 (goto-char (point-min)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2161 (re-search-forward (concat "^W " unit-name |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2162 "%s[ \t]+\\([^ \t]+\\)[ \t]+" |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2163 "\\([^ \t\n]+\\)")) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2164 (setq body-name (match-string 1)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2165 (setq ali-name (match-string 2)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2166 (kill-buffer buffer) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2167 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2168 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2169 (setq ali-name (ada-find-ali-file-in-dir ali-name)) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2170 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2171 (save-excursion |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2172 ;; Tries to open the new ali file to find the spec file |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2173 (if ali-name |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2174 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2175 (find-file ali-name) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2176 (goto-char (point-min)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2177 (re-search-forward (concat "^U " unit-name "%s[ \t]+" |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2178 "\\([^ \t]+\\)")) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2179 (setq body-name (match-string 1)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2180 (kill-buffer (current-buffer)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2181 ) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2182 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2183 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2184 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2185 (find-file body-name) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2186 )) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2187 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2188 (defun ada-make-filename-from-adaname (adaname) |
26227 | 2189 "Determine the filename in which ADANAME is found. |
2190 This is a GNAT specific function that uses gnatkrunch." | |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2191 (let (krunch-buf) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2192 (setq krunch-buf (generate-new-buffer "*gkrunch*")) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2193 (save-excursion |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2194 (set-buffer krunch-buf) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2195 ;; send adaname to external process `gnatkr'. |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2196 ;; Add a dummy extension, since gnatkr versions have two different |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2197 ;; behaviors depending on the version: |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2198 ;; Up to 3.15: "AA.BB.CC" => aa-bb-cc |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2199 ;; After: "AA.BB.CC" => aa-bb.cc |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2200 (call-process "gnatkr" nil krunch-buf nil |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2201 (concat adaname ".adb") ada-krunch-args) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2202 ;; fetch output of that process |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2203 (setq adaname (buffer-substring |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2204 (point-min) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2205 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2206 (goto-char (point-min)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2207 (end-of-line) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2208 (point)))) |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2209 ;; Remove the extra extension we added above |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2210 (setq adaname (substring adaname 0 -4)) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2211 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2212 (kill-buffer krunch-buf))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2213 adaname |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2214 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2215 |
57824
83de34d9f04f
(ada-make-body-gnatstub): Don't use interactive-p.
Richard M. Stallman <rms@gnu.org>
parents:
56766
diff
changeset
|
2216 (defun ada-make-body-gnatstub (&optional interactive) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2217 "Create an Ada package body in the current buffer. |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2218 This function uses the `gnatstub' program to create the body. |
74411
f76dd5acc4b2
(ada-check-current): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
74378
diff
changeset
|
2219 If INTERACTIVE is nil, kill the current buffer. |
74074
55ec33a643b1
(ada-make-body-gnatstub): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
74003
diff
changeset
|
2220 This function typically is to be hooked into `ff-file-created-hook'." |
57824
83de34d9f04f
(ada-make-body-gnatstub): Don't use interactive-p.
Richard M. Stallman <rms@gnu.org>
parents:
56766
diff
changeset
|
2221 (interactive "p") |
74003
a62f860a2d9e
(ada-parse-prj-file): Don't delete project buffer; user may want to edit it.
Juanma Barranquero <lekktu@gmail.com>
parents:
73934
diff
changeset
|
2222 (ada-require-project-file) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2223 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2224 (save-some-buffers nil nil) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2225 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2226 ;; If the current buffer is the body (as is the case when calling this |
74074
55ec33a643b1
(ada-make-body-gnatstub): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
74003
diff
changeset
|
2227 ;; function from ff-file-created-hook), then kill this temporary buffer |
57824
83de34d9f04f
(ada-make-body-gnatstub): Don't use interactive-p.
Richard M. Stallman <rms@gnu.org>
parents:
56766
diff
changeset
|
2228 (unless interactive |
74411
f76dd5acc4b2
(ada-check-current): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
74378
diff
changeset
|
2229 (set-buffer-modified-p nil) |
f76dd5acc4b2
(ada-check-current): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
74378
diff
changeset
|
2230 (kill-buffer (current-buffer))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47745
diff
changeset
|
2231 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2232 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2233 ;; Make sure the current buffer is the spec (this might not be the case |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2234 ;; if for instance the user was asked for a project file) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2235 |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2236 (unless (buffer-file-name (car (buffer-list))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2237 (set-buffer (cadr (buffer-list)))) |
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2238 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2239 ;; Call the external process gnatstub |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2240 (let* ((gnatstub-opts (ada-treat-cmd-string ada-gnatstub-opts)) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2241 (filename (buffer-file-name (car (buffer-list)))) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2242 (output (concat (file-name-sans-extension filename) ".adb")) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2243 (gnatstub-cmd (concat "gnatstub " gnatstub-opts " " filename)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2244 (buffer (get-buffer-create "*gnatstub*"))) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2245 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2246 (save-excursion |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2247 (set-buffer buffer) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2248 (compilation-minor-mode 1) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2249 (erase-buffer) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2250 (insert gnatstub-cmd) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2251 (newline) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2252 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2253 ;; call gnatstub to create the body file |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2254 (call-process shell-file-name nil buffer nil "-c" gnatstub-cmd) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2255 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2256 (if (save-excursion |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2257 (set-buffer buffer) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2258 (goto-char (point-min)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2259 (search-forward "command not found" nil t)) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2260 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2261 (message "gnatstub was not found -- using the basic algorithm") |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2262 (sleep-for 2) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2263 (kill-buffer buffer) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2264 (ada-make-body)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2265 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2266 ;; Else clean up the output |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2267 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2268 (if (file-exists-p output) |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2269 (progn |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2270 (find-file output) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2271 (kill-buffer buffer)) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2272 |
73563
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2273 ;; display the error buffer |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2274 (display-buffer buffer) |
23b9a43eb0a5
(ada-compile-current): Don't add newlines to commands.
Juanma Barranquero <lekktu@gmail.com>
parents:
73378
diff
changeset
|
2275 ) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2276 ))) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2277 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2278 (defun ada-xref-initialize () |
38441
ceb40bd97a77
(ada-xref-initialize): Fix call to add-hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
2279 "Function called by `ada-mode-hook' to initialize the ada-xref.el package. |
ceb40bd97a77
(ada-xref-initialize): Fix call to add-hook.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38422
diff
changeset
|
2280 For instance, it creates the gnat-specific menus, sets some hooks for |
74378
77f5754d4ba2
(is-windows, ada-find-in-src-path): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
74074
diff
changeset
|
2281 `find-file'." |
74074
55ec33a643b1
(ada-make-body-gnatstub): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
74003
diff
changeset
|
2282 (remove-hook 'ff-file-created-hook 'ada-make-body) ; from global hook |
55ec33a643b1
(ada-make-body-gnatstub): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
74003
diff
changeset
|
2283 (remove-hook 'ff-file-created-hook 'ada-make-body t) ; from local hook |
55ec33a643b1
(ada-make-body-gnatstub): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents:
74003
diff
changeset
|
2284 (add-hook 'ff-file-created-hook 'ada-make-body-gnatstub nil t) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2285 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2286 ;; Completion for file names in the mini buffer should ignore .ali files |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2287 (add-to-list 'completion-ignored-extensions ".ali") |
50737
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
2288 |
f6a0822e108d
(ada-gnatls-args): New variable. Add support for specifying arguments to
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
2289 (ada-xref-update-project-menu) |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2290 ) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2291 |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2292 ;; ----- Add to ada-mode-hook --------------------------------------------- |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2293 |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2294 ;; This must be done before initializing the Ada menu. |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2295 (add-hook 'ada-mode-hook 'ada-xref-initialize) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2296 |
73934
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2297 ;; Define a new error type |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2298 (put 'error-file-not-found |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2299 'error-conditions |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2300 '(error ada-mode-errors error-file-not-found)) |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2301 (put 'error-file-not-found |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2302 'error-message |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2303 "File not found in src-dir (check project file): ") |
0a6f264ee5b6
(ada-prj-default-check-cmd): New variable, replacing deleted variable
Juanma Barranquero <lekktu@gmail.com>
parents:
73651
diff
changeset
|
2304 |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
2305 ;; Initializes the cross references to the runtime library |
44466
f200fce92816
ada-mode no longer supports a different
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38441
diff
changeset
|
2306 (ada-initialize-runtime-library "") |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
2307 |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
2308 ;; Add these standard directories to the search path |
50811
d29943b8f829
(uniquify-buffer-name-style, uniquify-after-kill-buffer-p)
Juanma Barranquero <lekktu@gmail.com>
parents:
50737
diff
changeset
|
2309 (set 'ada-search-directories-internal |
30408
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
2310 (append (mapcar 'directory-file-name ada-xref-runtime-library-specs-path) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
2311 ada-search-directories)) |
e3e2c9051c5f
Got rid of all byte-compiler warnings on Emacs.
Gerd Moellmann <gerd@gnu.org>
parents:
26227
diff
changeset
|
2312 |
25899
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2313 (provide 'ada-xref) |
e5e3310746eb
New file. Use Gnat for lookup and completion in Ada mode
Gerd Moellmann <gerd@gnu.org>
parents:
diff
changeset
|
2314 |
52401 | 2315 ;;; arch-tag: 415a39fe-577b-4676-b3b1-6ff6db7ca24e |
32301
0f1f7e931493
Fix header line, copyright notice.
Dave Love <fx@gnu.org>
parents:
30408
diff
changeset
|
2316 ;;; ada-xref.el ends here |