diff options
| author | Stefan Monnier | 2002-06-20 17:31:56 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-06-20 17:31:56 +0000 |
| commit | 93cdce2074cd594521e8e115687af06ab6531851 (patch) | |
| tree | e35f31c0af14a73a229258c47ec07a2c4485ff34 | |
| parent | 61c08d00ad3c26c732d3bbb28dd9b2c436ca0c00 (diff) | |
| download | emacs-93cdce2074cd594521e8e115687af06ab6531851.tar.gz emacs-93cdce2074cd594521e8e115687af06ab6531851.zip | |
Update copyright notice.
(ada-xref-create-ali): The default is now not to create automatically the
ALI files by compiling the unit, since this isn't always reliable and
requires an up-to-date project file.
(ada-prj-default-comp-cmd): No longer use gcc directly to compile
a file, but use gnatmake instead, since this gives access to the GNAT
project files.
(ada-xref-search-with-egrep): New variable, suggested by P. Waroquiers.
(ada-load-project-hook): New variable, for support of GNAT project files.
(ada-update-project-menu): Fix the detection of the project file name.
(ada-add-keymap): Change key binding for ada-find-file, that conflicted
with another binding in ada-mode.el.
(ada-add-menu): New menu "List Local References", to list the reference
to the entity only in the current file, instead of looking in the whole
project. Much faster.
(ada-find-references): New parameters arg and local-only.
(ada-find-any-references): New parameters local-only and append.
(ada-goto-declaration): Fix handling of predefined entities in xref.
(ada-get-all-references): Updated to the new xref format in GNAT 3.15,
still compatible with GNAT 3.14 of course. Fix various calls to
count-lines, that didn't work correctly when the buffer was narrowed.
| -rw-r--r-- | lisp/progmodes/ada-xref.el | 173 |
1 files changed, 124 insertions, 49 deletions
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index 94eb7ef26e5..9a1f458848f 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | ;;; ada-xref.el --- for lookup and completion in Ada mode | 1 | ;;; ada-xref.el --- for lookup and completion in Ada mode |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 2001 | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 2001, 2002 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de> | 6 | ;; Author: Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de> |
| 7 | ;; Rolf Ebert <ebert@inf.enst.fr> | 7 | ;; Rolf Ebert <ebert@inf.enst.fr> |
| 8 | ;; Emmanuel Briot <briot@gnat.com> | 8 | ;; Emmanuel Briot <briot@gnat.com> |
| 9 | ;; Maintainer: Emmanuel Briot <briot@gnat.com> | 9 | ;; Maintainer: Emmanuel Briot <briot@gnat.com> |
| 10 | ;; Ada Core Technologies's version: $Revision: 1.9 $ | 10 | ;; Ada Core Technologies's version: Revision: 1.155.2.8 (GNAT 3.15) |
| 11 | ;; Keywords: languages ada xref | 11 | ;; Keywords: languages ada xref |
| 12 | 12 | ||
| 13 | ;; This file is part of GNU Emacs. | 13 | ;; This file is part of GNU Emacs. |
| @@ -51,7 +51,7 @@ | |||
| 51 | Otherwise create either a new buffer or a new frame." | 51 | Otherwise create either a new buffer or a new frame." |
| 52 | :type 'boolean :group 'ada) | 52 | :type 'boolean :group 'ada) |
| 53 | 53 | ||
| 54 | (defcustom ada-xref-create-ali t | 54 | (defcustom ada-xref-create-ali nil |
| 55 | "*If non-nil, run gcc whenever the cross-references are not up-to-date. | 55 | "*If non-nil, run gcc whenever the cross-references are not up-to-date. |
| 56 | If nil, the cross-reference mode will never run gcc." | 56 | If nil, the cross-reference mode will never run gcc." |
| 57 | :type 'boolean :group 'ada) | 57 | :type 'boolean :group 'ada) |
| @@ -91,7 +91,8 @@ The command gnatfind is used every time you choose the menu | |||
| 91 | :type 'string :group 'ada) | 91 | :type 'string :group 'ada) |
| 92 | 92 | ||
| 93 | (defcustom ada-prj-default-comp-cmd | 93 | (defcustom ada-prj-default-comp-cmd |
| 94 | "${cross_prefix}gcc -x ada -c ${comp_opt} ${full_current}" | 94 | (concat "${cross_prefix}gnatmake -u -c ${gnatmake_opt} ${full_current} -cargs" |
| 95 | " ${comp_opt}") | ||
| 95 | "*Default command to be used to compile a single file. | 96 | "*Default command to be used to compile a single file. |
| 96 | Emacs will add the filename at the end of this command. This is the same | 97 | Emacs will add the filename at the end of this command. This is the same |
| 97 | syntax as in the project file." | 98 | syntax as in the project file." |
| @@ -132,6 +133,26 @@ Otherwise, ask the user for the name of the project file to use." | |||
| 132 | "*If non-nil, a new Emacs frame will be swallowed in GVD when debugging. | 133 | "*If non-nil, a new Emacs frame will be swallowed in GVD when debugging. |
| 133 | If GVD is not the debugger used, nothing happens.") | 134 | If GVD is not the debugger used, nothing happens.") |
| 134 | 135 | ||
| 136 | (defcustom ada-xref-search-with-egrep t | ||
| 137 | "*If non-nil, use egrep to find the possible declarations for an entity. | ||
| 138 | This alternate method is used when the exact location was not found in the | ||
| 139 | information provided by GNAT. However, it might be expensive if you have a lot | ||
| 140 | of sources, since it will search in all the files in your project." | ||
| 141 | :type 'boolean :group 'ada) | ||
| 142 | |||
| 143 | (defvar ada-load-project-hook nil | ||
| 144 | "Hook that is run when loading a project file. | ||
| 145 | Each function in this hook takes one argument FILENAME, that is the name of | ||
| 146 | the project file to load. | ||
| 147 | This hook should be used to support new formats for the project files. | ||
| 148 | |||
| 149 | If the function can load the file with the given filename, it should create a | ||
| 150 | buffer that contains a conversion of the file to the standard format of the | ||
| 151 | project files, and return that buffer. (the usual \"src_dir=\" or \"obj_dir=\" | ||
| 152 | lines). It should return nil if it doesn't know how to convert that project | ||
| 153 | file.") | ||
| 154 | |||
| 155 | |||
| 135 | ;; ------- Nothing to be modified by the user below this | 156 | ;; ------- Nothing to be modified by the user below this |
| 136 | (defvar ada-last-prj-file "" | 157 | (defvar ada-last-prj-file "" |
| 137 | "Name of the last project file entered by the user.") | 158 | "Name of the last project file entered by the user.") |
| @@ -289,10 +310,10 @@ replaced by the name including the extension." | |||
| 289 | ;; Ada file or not even associated with a file | 310 | ;; Ada file or not even associated with a file |
| 290 | (list 'filename (expand-file-name | 311 | (list 'filename (expand-file-name |
| 291 | (cond | 312 | (cond |
| 292 | (file | ||
| 293 | (ada-prj-get-prj-dir file)) | ||
| 294 | (ada-prj-default-project-file | 313 | (ada-prj-default-project-file |
| 295 | ada-prj-default-project-file) | 314 | ada-prj-default-project-file) |
| 315 | (file | ||
| 316 | (ada-prj-get-prj-dir file)) | ||
| 296 | (t | 317 | (t |
| 297 | (message (concat "Not editing an Ada file," | 318 | (message (concat "Not editing an Ada file," |
| 298 | "and no default project " | 319 | "and no default project " |
| @@ -436,8 +457,12 @@ All the directories are returned as absolute directories." | |||
| 436 | (append submenu | 457 | (append submenu |
| 437 | (list (cons (intern name) | 458 | (list (cons (intern name) |
| 438 | (list | 459 | (list |
| 439 | 'menu-item (file-name-sans-extension | 460 | 'menu-item |
| 440 | (file-name-nondirectory name)) | 461 | (if (string= (file-name-extension name) |
| 462 | ada-project-file-extension) | ||
| 463 | (file-name-sans-extension | ||
| 464 | (file-name-nondirectory name)) | ||
| 465 | (file-name-nondirectory name)) | ||
| 441 | command | 466 | command |
| 442 | :button (cons | 467 | :button (cons |
| 443 | :toggle | 468 | :toggle |
| @@ -515,7 +540,6 @@ Completion is available." | |||
| 515 | (define-key ada-mode-map "\C-c5\C-d" 'ada-goto-declaration-other-frame) | 540 | (define-key ada-mode-map "\C-c5\C-d" 'ada-goto-declaration-other-frame) |
| 516 | (define-key ada-mode-map "\C-c\C-d" 'ada-goto-declaration) | 541 | (define-key ada-mode-map "\C-c\C-d" 'ada-goto-declaration) |
| 517 | (define-key ada-mode-map "\C-c\C-s" 'ada-xref-goto-previous-reference) | 542 | (define-key ada-mode-map "\C-c\C-s" 'ada-xref-goto-previous-reference) |
| 518 | (define-key ada-mode-map "\C-c\C-x" 'ada-reread-prj-file) | ||
| 519 | (define-key ada-mode-map "\C-c\C-c" 'ada-compile-application) | 543 | (define-key ada-mode-map "\C-c\C-c" 'ada-compile-application) |
| 520 | (define-key ada-mode-map "\C-cc" 'ada-change-prj) | 544 | (define-key ada-mode-map "\C-cc" 'ada-change-prj) |
| 521 | (define-key ada-mode-map "\C-cd" 'ada-set-default-project-file) | 545 | (define-key ada-mode-map "\C-cd" 'ada-set-default-project-file) |
| @@ -523,8 +547,9 @@ Completion is available." | |||
| 523 | (define-key ada-mode-map "\C-cr" 'ada-run-application) | 547 | (define-key ada-mode-map "\C-cr" 'ada-run-application) |
| 524 | (define-key ada-mode-map "\C-c\C-o" 'ada-goto-parent) | 548 | (define-key ada-mode-map "\C-c\C-o" 'ada-goto-parent) |
| 525 | (define-key ada-mode-map "\C-c\C-r" 'ada-find-references) | 549 | (define-key ada-mode-map "\C-c\C-r" 'ada-find-references) |
| 550 | (define-key ada-mode-map "\C-cl" 'ada-find-local-references) | ||
| 526 | (define-key ada-mode-map "\C-c\C-v" 'ada-check-current) | 551 | (define-key ada-mode-map "\C-c\C-v" 'ada-check-current) |
| 527 | (define-key ada-mode-map "\C-c\C-f" 'ada-find-file) | 552 | (define-key ada-mode-map "\C-cf" 'ada-find-file) |
| 528 | ) | 553 | ) |
| 529 | 554 | ||
| 530 | ;; ----- Menus -------------------------------------------------------------- | 555 | ;; ----- Menus -------------------------------------------------------------- |
| @@ -564,6 +589,9 @@ name as was passed to `ada-create-menu'." | |||
| 564 | goto-menu ["List References" ada-find-references t] | 589 | goto-menu ["List References" ada-find-references t] |
| 565 | "Next compilation error") | 590 | "Next compilation error") |
| 566 | (funcall (symbol-function 'add-menu-button) | 591 | (funcall (symbol-function 'add-menu-button) |
| 592 | goto-menu ["List Local References" ada-find-local-references t] | ||
| 593 | "Next compilation error") | ||
| 594 | (funcall (symbol-function 'add-menu-button) | ||
| 567 | goto-menu ["Goto Declaration Other Frame" | 595 | goto-menu ["Goto Declaration Other Frame" |
| 568 | ada-goto-declaration-other-frame t] | 596 | ada-goto-declaration-other-frame t] |
| 569 | "Next compilation error") | 597 | "Next compilation error") |
| @@ -620,11 +648,14 @@ name as was passed to `ada-create-menu'." | |||
| 620 | ) | 648 | ) |
| 621 | 649 | ||
| 622 | ;; for Emacs | 650 | ;; for Emacs |
| 623 | (let* ((menu (lookup-key ada-mode-map [menu-bar ada])) | 651 | (let* ((menu (or (lookup-key ada-mode-map [menu-bar Ada]) |
| 624 | (edit-menu (lookup-key ada-mode-map [menu-bar ada edit])) | 652 | ;; Emacs-21.4's easymenu.el downcases the events. |
| 625 | (help-menu (lookup-key ada-mode-map [menu-bar ada help])) | 653 | (lookup-key ada-mode-map [menu-bar ada]))) |
| 626 | (goto-menu (lookup-key ada-mode-map [menu-bar ada goto])) | 654 | (edit-menu (or (lookup-key menu [Edit]) (lookup-key menu [edit]))) |
| 627 | (options-menu (lookup-key ada-mode-map [menu-bar ada options]))) | 655 | (help-menu (or (lookup-key menu [Help]) (lookup-key menu [help]))) |
| 656 | (goto-menu (or (lookup-key menu [Goto]) (lookup-key menu [goto]))) | ||
| 657 | (options-menu (or (lookup-key menu [Options]) | ||
| 658 | (lookup-key menu [options])))) | ||
| 628 | 659 | ||
| 629 | (define-key-after menu [Check] '("Check file" . ada-check-current) | 660 | (define-key-after menu [Check] '("Check file" . ada-check-current) |
| 630 | 'Customize) | 661 | 'Customize) |
| @@ -656,6 +687,8 @@ name as was passed to `ada-create-menu'." | |||
| 656 | '("Goto References to any entity" . ada-find-any-references)) | 687 | '("Goto References to any entity" . ada-find-any-references)) |
| 657 | (define-key goto-menu [References] | 688 | (define-key goto-menu [References] |
| 658 | '("List References" . ada-find-references)) | 689 | '("List References" . ada-find-references)) |
| 690 | (define-key goto-menu [Local-References] | ||
| 691 | '("List Local References" . ada-find-local-references)) | ||
| 659 | (define-key goto-menu [Prev] | 692 | (define-key goto-menu [Prev] |
| 660 | '("Goto Previous Reference" . ada-xref-goto-previous-reference)) | 693 | '("Goto Previous Reference" . ada-xref-goto-previous-reference)) |
| 661 | (define-key goto-menu [Decl-other] | 694 | (define-key goto-menu [Decl-other] |
| @@ -732,7 +765,7 @@ This is overriden on VMS to convert from VMS filenames to Unix filenames." | |||
| 732 | (defun ada-set-default-project-file (name) | 765 | (defun ada-set-default-project-file (name) |
| 733 | "Set the file whose name is NAME as the default project file." | 766 | "Set the file whose name is NAME as the default project file." |
| 734 | (interactive "fProject file:") | 767 | (interactive "fProject file:") |
| 735 | (set 'ada-prj-default-project-file name) | 768 | (setq ada-prj-default-project-file name) |
| 736 | (ada-reread-prj-file name) | 769 | (ada-reread-prj-file name) |
| 737 | ) | 770 | ) |
| 738 | 771 | ||
| @@ -843,8 +876,12 @@ The current buffer should be the ada-file buffer." | |||
| 843 | ;; find-file anyway, since the speedbar frame is special and does not | 876 | ;; find-file anyway, since the speedbar frame is special and does not |
| 844 | ;; allow the selection of a file in it. | 877 | ;; allow the selection of a file in it. |
| 845 | 878 | ||
| 846 | (set-buffer (find-file-noselect prj-file)) | 879 | (let* ((buffer (run-hook-with-args-until-success |
| 847 | 880 | 'ada-load-project-hook prj-file))) | |
| 881 | (unless buffer | ||
| 882 | (setq buffer (find-file-noselect prj-file nil))) | ||
| 883 | (set-buffer buffer)) | ||
| 884 | |||
| 848 | (widen) | 885 | (widen) |
| 849 | (goto-char (point-min)) | 886 | (goto-char (point-min)) |
| 850 | 887 | ||
| @@ -930,7 +967,7 @@ The current buffer should be the ada-file buffer." | |||
| 930 | (append (mapcar 'directory-file-name compilation-search-path) | 967 | (append (mapcar 'directory-file-name compilation-search-path) |
| 931 | ada-search-directories)) | 968 | ada-search-directories)) |
| 932 | 969 | ||
| 933 | ;; Kill the .ali buffer | 970 | ;; Kill the project buffer |
| 934 | (kill-buffer nil) | 971 | (kill-buffer nil) |
| 935 | (set-buffer ada-buffer) | 972 | (set-buffer ada-buffer) |
| 936 | 973 | ||
| @@ -946,12 +983,13 @@ The current buffer should be the ada-file buffer." | |||
| 946 | )) | 983 | )) |
| 947 | 984 | ||
| 948 | 985 | ||
| 949 | (defun ada-find-references (&optional pos) | 986 | (defun ada-find-references (&optional pos arg local-only) |
| 950 | "Find all references to the entity under POS. | 987 | "Find all references to the entity under POS. |
| 951 | Calls gnatfind to find the references." | 988 | Calls gnatfind to find the references. |
| 952 | (interactive "") | 989 | if ARG is t, the contents of the old *gnatfind* buffer is preserved. |
| 953 | (unless pos | 990 | if LOCAL-ONLY is t, only the declarations in the current file are returned." |
| 954 | (set 'pos (point))) | 991 | (interactive "d |
| 992 | P") | ||
| 955 | (ada-require-project-file) | 993 | (ada-require-project-file) |
| 956 | 994 | ||
| 957 | (let* ((identlist (ada-read-identifier pos)) | 995 | (let* ((identlist (ada-read-identifier pos)) |
| @@ -965,16 +1003,29 @@ Calls gnatfind to find the references." | |||
| 965 | (file-newer-than-file-p (ada-file-of identlist) alifile)) | 1003 | (file-newer-than-file-p (ada-file-of identlist) alifile)) |
| 966 | (ada-find-any-references (ada-name-of identlist) | 1004 | (ada-find-any-references (ada-name-of identlist) |
| 967 | (ada-file-of identlist) | 1005 | (ada-file-of identlist) |
| 968 | nil nil) | 1006 | nil nil local-only arg) |
| 969 | (ada-find-any-references (ada-name-of identlist) | 1007 | (ada-find-any-references (ada-name-of identlist) |
| 970 | (ada-file-of identlist) | 1008 | (ada-file-of identlist) |
| 971 | (ada-line-of identlist) | 1009 | (ada-line-of identlist) |
| 972 | (ada-column-of identlist)))) | 1010 | (ada-column-of identlist) local-only arg))) |
| 973 | ) | 1011 | ) |
| 974 | 1012 | ||
| 975 | (defun ada-find-any-references (entity &optional file line column) | 1013 | (defun ada-find-local-references (&optional pos arg) |
| 1014 | "Find all references to the entity under POS. | ||
| 1015 | Calls gnatfind to find the references. | ||
| 1016 | if ARG is t, the contents of the old *gnatfind* buffer is preserved." | ||
| 1017 | (interactive "d | ||
| 1018 | P") | ||
| 1019 | (ada-find-references pos arg t)) | ||
| 1020 | |||
| 1021 | (defun ada-find-any-references | ||
| 1022 | (entity &optional file line column local-only append) | ||
| 976 | "Search for references to any entity whose name is ENTITY. | 1023 | "Search for references to any entity whose name is ENTITY. |
| 977 | ENTITY was first found the location given by FILE, LINE and COLUMN." | 1024 | ENTITY was first found the location given by FILE, LINE and COLUMN. |
| 1025 | If LOCAL-ONLY is t, then only the references in file will be listed, which | ||
| 1026 | is much faster. | ||
| 1027 | If APPEND is t, then the output of the command will be append to the existing | ||
| 1028 | buffer *gnatfind* if it exists." | ||
| 978 | (interactive "sEntity name: ") | 1029 | (interactive "sEntity name: ") |
| 979 | (ada-require-project-file) | 1030 | (ada-require-project-file) |
| 980 | 1031 | ||
| @@ -992,19 +1043,33 @@ ENTITY was first found the location given by FILE, LINE and COLUMN." | |||
| 992 | quote-entity | 1043 | quote-entity |
| 993 | (if file (concat ":" (file-name-nondirectory file))) | 1044 | (if file (concat ":" (file-name-nondirectory file))) |
| 994 | (if line (concat ":" line)) | 1045 | (if line (concat ":" line)) |
| 995 | (if column (concat ":" column))))) | 1046 | (if column (concat ":" column)) |
| 1047 | (if local-only (concat " " (file-name-nondirectory file))) | ||
| 1048 | )) | ||
| 1049 | old-contents) | ||
| 996 | 1050 | ||
| 997 | ;; If a project file is defined, use it | 1051 | ;; If a project file is defined, use it |
| 998 | (if (and ada-prj-default-project-file | 1052 | (if (and ada-prj-default-project-file |
| 999 | (not (string= ada-prj-default-project-file ""))) | 1053 | (not (string= ada-prj-default-project-file ""))) |
| 1000 | (setq command (concat command " -p" ada-prj-default-project-file))) | 1054 | (setq command (concat command " -p" ada-prj-default-project-file))) |
| 1001 | 1055 | ||
| 1056 | (if (and append (get-buffer "*gnatfind*")) | ||
| 1057 | (save-excursion | ||
| 1058 | (set-buffer "*gnatfind*") | ||
| 1059 | (setq old-contents (buffer-string)))) | ||
| 1060 | |||
| 1002 | (compile-internal command "No more references" "gnatfind") | 1061 | (compile-internal command "No more references" "gnatfind") |
| 1003 | 1062 | ||
| 1004 | ;; Hide the "Compilation" menu | 1063 | ;; Hide the "Compilation" menu |
| 1005 | (save-excursion | 1064 | (save-excursion |
| 1006 | (set-buffer "*gnatfind*") | 1065 | (set-buffer "*gnatfind*") |
| 1007 | (local-unset-key [menu-bar compilation-menu])) | 1066 | (local-unset-key [menu-bar compilation-menu]) |
| 1067 | |||
| 1068 | (if old-contents | ||
| 1069 | (progn | ||
| 1070 | (goto-char 1) | ||
| 1071 | (insert old-contents) | ||
| 1072 | (goto-char (point-max))))) | ||
| 1008 | ) | 1073 | ) |
| 1009 | ) | 1074 | ) |
| 1010 | 1075 | ||
| @@ -1102,7 +1167,20 @@ If OTHER-FRAME is non-nil, display the cross-reference in another frame." | |||
| 1102 | (let ((identlist (ada-read-identifier pos))) | 1167 | (let ((identlist (ada-read-identifier pos))) |
| 1103 | (condition-case nil | 1168 | (condition-case nil |
| 1104 | (ada-find-in-ali identlist other-frame) | 1169 | (ada-find-in-ali identlist other-frame) |
| 1105 | (error (ada-find-in-src-path identlist other-frame))))) | 1170 | (error |
| 1171 | (let ((ali-file (ada-get-ali-file-name (ada-file-of identlist)))) | ||
| 1172 | |||
| 1173 | ;; If the ALI file was up-to-date, then we probably have a predefined | ||
| 1174 | ;; entity, whose references are not given by GNAT | ||
| 1175 | (if (and (file-exists-p ali-file) | ||
| 1176 | (file-newer-than-file-p ali-file (ada-file-of identlist))) | ||
| 1177 | (message "No cross-reference found. It might be a predefined entity.") | ||
| 1178 | |||
| 1179 | ;; Else, look in every ALI file, except if the user doesn't want that | ||
| 1180 | (if ada-xref-search-with-egrep | ||
| 1181 | (ada-find-in-src-path identlist other-frame) | ||
| 1182 | (message "Cross-referencing information is not up-to-date. Please recompile.") | ||
| 1183 | ))))))) | ||
| 1106 | 1184 | ||
| 1107 | (defun ada-goto-declaration-other-frame (pos &optional other-frame) | 1185 | (defun ada-goto-declaration-other-frame (pos &optional other-frame) |
| 1108 | "Display the declaration of the identifier around POS. | 1186 | "Display the declaration of the identifier around POS. |
| @@ -1647,7 +1725,7 @@ macros `ada-name-of', `ada-line-of', `ada-column-of', `ada-file-of',..." | |||
| 1647 | (set 'identlist (ada-make-identlist)) | 1725 | (set 'identlist (ada-make-identlist)) |
| 1648 | (ada-set-name identlist (downcase identifier)) | 1726 | (ada-set-name identlist (downcase identifier)) |
| 1649 | (ada-set-line identlist | 1727 | (ada-set-line identlist |
| 1650 | (number-to-string (count-lines (point-min) (point)))) | 1728 | (number-to-string (count-lines 1 (point)))) |
| 1651 | (ada-set-column identlist | 1729 | (ada-set-column identlist |
| 1652 | (number-to-string (1+ (current-column)))) | 1730 | (number-to-string (1+ (current-column)))) |
| 1653 | (ada-set-file identlist (buffer-file-name)) | 1731 | (ada-set-file identlist (buffer-file-name)) |
| @@ -1677,7 +1755,7 @@ from the ali file (definition file and places where it is referenced)." | |||
| 1677 | (concat "^" (ada-line-of identlist) | 1755 | (concat "^" (ada-line-of identlist) |
| 1678 | "." (ada-column-of identlist) | 1756 | "." (ada-column-of identlist) |
| 1679 | "[ *]" (ada-name-of identlist) | 1757 | "[ *]" (ada-name-of identlist) |
| 1680 | " \\(.*\\)$") bound t)) | 1758 | "[{\(<= ]?\\(.*\\)$") bound t)) |
| 1681 | (if declaration-found | 1759 | (if declaration-found |
| 1682 | (ada-set-on-declaration identlist t)) | 1760 | (ada-set-on-declaration identlist t)) |
| 1683 | )) | 1761 | )) |
| @@ -1696,10 +1774,10 @@ from the ali file (definition file and places where it is referenced)." | |||
| 1696 | (number-to-string (ada-find-file-number-in-ali | 1774 | (number-to-string (ada-find-file-number-in-ali |
| 1697 | (ada-file-of identlist)))) | 1775 | (ada-file-of identlist)))) |
| 1698 | (unless (re-search-forward (concat (ada-ali-index-of identlist) | 1776 | (unless (re-search-forward (concat (ada-ali-index-of identlist) |
| 1699 | "|\\([0-9]+.[0-9]+ \\)*" | 1777 | "|\\([0-9]+[^0-9][0-9]+\\(\n\\.\\)? \\)*" |
| 1700 | (ada-line-of identlist) | 1778 | (ada-line-of identlist) |
| 1701 | "[^0-9]" | 1779 | "[^etp]" |
| 1702 | (ada-column-of identlist)) | 1780 | (ada-column-of identlist) "\\>") |
| 1703 | nil t) | 1781 | nil t) |
| 1704 | 1782 | ||
| 1705 | ;; if we did not find it, it may be because the first reference | 1783 | ;; if we did not find it, it may be because the first reference |
| @@ -1707,10 +1785,12 @@ from the ali file (definition file and places where it is referenced)." | |||
| 1707 | ;; Or maybe we are already on the declaration... | 1785 | ;; Or maybe we are already on the declaration... |
| 1708 | (unless (re-search-forward | 1786 | (unless (re-search-forward |
| 1709 | (concat | 1787 | (concat |
| 1710 | "^\\(\\([a-zA-Z0-9_.]+\\|\"[<>=+*-/a-z]\"\\)[ *]\\)*" | 1788 | "^[0-9]+.[0-9]+[ *]" |
| 1789 | (ada-name-of identlist) | ||
| 1790 | "[ <{=\(]\\(.\\|\n\\.\\)*\\<" | ||
| 1711 | (ada-line-of identlist) | 1791 | (ada-line-of identlist) |
| 1712 | "[^0-9]" | 1792 | "[^0-9]" |
| 1713 | (ada-column-of identlist)) | 1793 | (ada-column-of identlist) "\\>") |
| 1714 | nil t) | 1794 | nil t) |
| 1715 | 1795 | ||
| 1716 | ;; If still not found, then either the declaration is unknown | 1796 | ;; If still not found, then either the declaration is unknown |
| @@ -1729,7 +1809,7 @@ from the ali file (definition file and places where it is referenced)." | |||
| 1729 | (while (looking-at "^\\.") | 1809 | (while (looking-at "^\\.") |
| 1730 | (previous-line 1)) | 1810 | (previous-line 1)) |
| 1731 | (unless (looking-at (concat "[0-9]+.[0-9]+[ *]" | 1811 | (unless (looking-at (concat "[0-9]+.[0-9]+[ *]" |
| 1732 | (ada-name-of identlist) "[ <]")) | 1812 | (ada-name-of identlist) "[ <{=\(]")) |
| 1733 | (set 'declaration-found nil)))) | 1813 | (set 'declaration-found nil)))) |
| 1734 | 1814 | ||
| 1735 | ;; Still no success ! The ali file must be too old, and we need to | 1815 | ;; Still no success ! The ali file must be too old, and we need to |
| @@ -1802,7 +1882,7 @@ This function is disabled for operators, and only works for identifiers." | |||
| 1802 | (goto-char (point-max)) | 1882 | (goto-char (point-max)) |
| 1803 | (while (re-search-backward my-regexp nil t) | 1883 | (while (re-search-backward my-regexp nil t) |
| 1804 | (save-excursion | 1884 | (save-excursion |
| 1805 | (set 'line-ali (count-lines (point-min) (point))) | 1885 | (setq line-ali (count-lines 1 (point))) |
| 1806 | (beginning-of-line) | 1886 | (beginning-of-line) |
| 1807 | ;; have a look at the line and column numbers | 1887 | ;; have a look at the line and column numbers |
| 1808 | (if (looking-at "^\\([0-9]+\\).\\([0-9]+\\)[ *]") | 1888 | (if (looking-at "^\\([0-9]+\\).\\([0-9]+\\)[ *]") |
| @@ -2291,11 +2371,6 @@ find-file...." | |||
| 2291 | ;; This should really be an `add-hook'. -stef | 2371 | ;; This should really be an `add-hook'. -stef |
| 2292 | (setq ff-file-created-hooks 'ada-make-body-gnatstub) | 2372 | (setq ff-file-created-hooks 'ada-make-body-gnatstub) |
| 2293 | 2373 | ||
| 2294 | ;; Read the project file and update the search path | ||
| 2295 | ;; before looking for the other file | ||
| 2296 | (make-local-hook 'ff-pre-find-hooks) | ||
| 2297 | (add-hook 'ff-pre-find-hooks 'ada-require-project-file nil t) | ||
| 2298 | |||
| 2299 | ;; Completion for file names in the mini buffer should ignore .ali files | 2374 | ;; Completion for file names in the mini buffer should ignore .ali files |
| 2300 | (add-to-list 'completion-ignored-extensions ".ali") | 2375 | (add-to-list 'completion-ignored-extensions ".ali") |
| 2301 | ) | 2376 | ) |
| @@ -2334,10 +2409,10 @@ find-file...." | |||
| 2334 | ;; Make sure that the files are always associated with a project file. Since | 2409 | ;; Make sure that the files are always associated with a project file. Since |
| 2335 | ;; the project file has some fields that are used for the editor (like the | 2410 | ;; the project file has some fields that are used for the editor (like the |
| 2336 | ;; casing exceptions), it has to be read before the user edits a file). | 2411 | ;; casing exceptions), it has to be read before the user edits a file). |
| 2337 | (add-hook 'ada-mode-hook | 2412 | ;; (add-hook 'ada-mode-hook |
| 2338 | (lambda() | 2413 | ;; (lambda() |
| 2339 | (let ((file (ada-prj-find-prj-file t))) | 2414 | ;; (let ((file (ada-prj-find-prj-file t))) |
| 2340 | (if file (ada-reread-prj-file file))))) | 2415 | ;; (if file (ada-reread-prj-file file))))) |
| 2341 | 2416 | ||
| 2342 | (provide 'ada-xref) | 2417 | (provide 'ada-xref) |
| 2343 | 2418 | ||