diff options
| author | Juanma Barranquero | 2003-04-29 23:40:08 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2003-04-29 23:40:08 +0000 |
| commit | c94ca9e0b3eb7b95197c14f26357a8bca1da0a83 (patch) | |
| tree | ffeb49480cbf999f6ee08ceaf8c5517f8c391e91 | |
| parent | f7a8090935a8972278e60dcc4a14a78a40f8b2f3 (diff) | |
| download | emacs-c94ca9e0b3eb7b95197c14f26357a8bca1da0a83.tar.gz emacs-c94ca9e0b3eb7b95197c14f26357a8bca1da0a83.zip | |
(ada-gnatls-args): New variable. Add support for specifying arguments to
gnatls.
(ada-initialize-runtime-library): Properly parse "." in the output of gnatls.
(ada-add-keymap): Removed, since this is now done in ada-mode.el itself.
(ada-add-ada-menu): Likewise.
(ada-set-default-project-file): New parameter KEEP-EXISTING.
(ada-prj-find-prj-file): New parameter FILE.
(ada-parse-prj-file): Take into account the ADA_INCLUDE_PATH and
ADA_OBJECTS_PATH environment variables. Minor reorganization of the code
(ada-get-all-references): Add support for GNAT 3.16 cross-references.
| -rw-r--r-- | lisp/progmodes/ada-xref.el | 457 |
1 files changed, 153 insertions, 304 deletions
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index 369119208f9..d0227e3c911 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, 2002 | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 2001, 2002, 2003 |
| 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.155.2.8 (GNAT 3.15) | 10 | ;; Ada Core Technologies's version: Revision: 1.181 |
| 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. |
| @@ -66,6 +66,16 @@ the application." | |||
| 66 | Set to 0, if you don't use crunched filenames. This should be a string." | 66 | Set to 0, if you don't use crunched filenames. This should be a string." |
| 67 | :type 'string :group 'ada) | 67 | :type 'string :group 'ada) |
| 68 | 68 | ||
| 69 | (defcustom ada-gnatls-args '("-v") | ||
| 70 | "*Arguments to pass to gnatfind when the location of the runtime is searched. | ||
| 71 | Typical use is to pass --RTS=soft-floats on some systems that support it. | ||
| 72 | |||
| 73 | You can also add -I- if you do not want the current directory to be included. | ||
| 74 | Otherwise, going from specs to bodies and back will first look for files in the | ||
| 75 | current directory. This only has an impact if you are not using project files, | ||
| 76 | but only ADA_INCLUDE_PATH." | ||
| 77 | :type '(repeat string) :group 'ada) | ||
| 78 | |||
| 69 | (defcustom ada-prj-default-comp-opt "-gnatq -gnatQ" | 79 | (defcustom ada-prj-default-comp-opt "-gnatq -gnatQ" |
| 70 | "Default compilation options." | 80 | "Default compilation options." |
| 71 | :type 'string :group 'ada) | 81 | :type 'string :group 'ada) |
| @@ -202,6 +212,37 @@ It has the following format: | |||
| 202 | \((project_name . value) (project_name . value) ...) | 212 | \((project_name . value) (project_name . value) ...) |
| 203 | As always, the values of the project file are defined through properties.") | 213 | As always, the values of the project file are defined through properties.") |
| 204 | 214 | ||
| 215 | |||
| 216 | ;; ----- Identlist manipulation ------------------------------------------- | ||
| 217 | ;; An identlist is a vector that is used internally to reference an identifier | ||
| 218 | ;; To facilitate its use, we provide the following macros | ||
| 219 | |||
| 220 | (defmacro ada-make-identlist () (make-vector 8 nil)) | ||
| 221 | (defmacro ada-name-of (identlist) (list 'aref identlist 0)) | ||
| 222 | (defmacro ada-line-of (identlist) (list 'aref identlist 1)) | ||
| 223 | (defmacro ada-column-of (identlist) (list 'aref identlist 2)) | ||
| 224 | (defmacro ada-file-of (identlist) (list 'aref identlist 3)) | ||
| 225 | (defmacro ada-ali-index-of (identlist) (list 'aref identlist 4)) | ||
| 226 | (defmacro ada-declare-file-of (identlist) (list 'aref identlist 5)) | ||
| 227 | (defmacro ada-references-of (identlist) (list 'aref identlist 6)) | ||
| 228 | (defmacro ada-on-declaration (identlist) (list 'aref identlist 7)) | ||
| 229 | |||
| 230 | (defmacro ada-set-name (identlist name) (list 'aset identlist 0 name)) | ||
| 231 | (defmacro ada-set-line (identlist line) (list 'aset identlist 1 line)) | ||
| 232 | (defmacro ada-set-column (identlist col) (list 'aset identlist 2 col)) | ||
| 233 | (defmacro ada-set-file (identlist file) (list 'aset identlist 3 file)) | ||
| 234 | (defmacro ada-set-ali-index (identlist index) (list 'aset identlist 4 index)) | ||
| 235 | (defmacro ada-set-declare-file (identlist file) (list 'aset identlist 5 file)) | ||
| 236 | (defmacro ada-set-references (identlist ref) (list 'aset identlist 6 ref)) | ||
| 237 | (defmacro ada-set-on-declaration (ident value) (list 'aset ident 7 value)) | ||
| 238 | |||
| 239 | (defsubst ada-get-ali-buffer (file) | ||
| 240 | "Reads the ali file into a new buffer, and returns this buffer's name" | ||
| 241 | (find-file-noselect (ada-get-ali-file-name file))) | ||
| 242 | |||
| 243 | |||
| 244 | ;; ----------------------------------------------------------------------- | ||
| 245 | |||
| 205 | (defun ada-quote-cmd (cmd) | 246 | (defun ada-quote-cmd (cmd) |
| 206 | "Duplicates all \\ characters in CMD so that it can be passed to `compile'" | 247 | "Duplicates all \\ characters in CMD so that it can be passed to `compile'" |
| 207 | (mapconcat 'identity (split-string cmd "\\\\") "\\\\")) | 248 | (mapconcat 'identity (split-string cmd "\\\\") "\\\\")) |
| @@ -220,8 +261,8 @@ CROSS-PREFIX is the prefix to use for the gnatls command" | |||
| 220 | ;; Even if we get an error, delete the *gnatls* buffer | 261 | ;; Even if we get an error, delete the *gnatls* buffer |
| 221 | (unwind-protect | 262 | (unwind-protect |
| 222 | (progn | 263 | (progn |
| 223 | (call-process (concat cross-prefix "gnatls") | 264 | (apply 'call-process (concat cross-prefix "gnatls") |
| 224 | nil t nil "-v") | 265 | (append '(nil t nil) ada-gnatls-args)) |
| 225 | (goto-char (point-min)) | 266 | (goto-char (point-min)) |
| 226 | 267 | ||
| 227 | ;; Source path | 268 | ;; Source path |
| @@ -230,7 +271,8 @@ CROSS-PREFIX is the prefix to use for the gnatls command" | |||
| 230 | (forward-line 1) | 271 | (forward-line 1) |
| 231 | (while (not (looking-at "^$")) | 272 | (while (not (looking-at "^$")) |
| 232 | (back-to-indentation) | 273 | (back-to-indentation) |
| 233 | (unless (looking-at "<Current_Directory>") | 274 | (if (looking-at "<Current_Directory>") |
| 275 | (add-to-list 'ada-xref-runtime-library-specs-path ".") | ||
| 234 | (add-to-list 'ada-xref-runtime-library-specs-path | 276 | (add-to-list 'ada-xref-runtime-library-specs-path |
| 235 | (buffer-substring-no-properties | 277 | (buffer-substring-no-properties |
| 236 | (point) | 278 | (point) |
| @@ -243,7 +285,8 @@ CROSS-PREFIX is the prefix to use for the gnatls command" | |||
| 243 | (forward-line 1) | 285 | (forward-line 1) |
| 244 | (while (not (looking-at "^$")) | 286 | (while (not (looking-at "^$")) |
| 245 | (back-to-indentation) | 287 | (back-to-indentation) |
| 246 | (unless (looking-at "<Current_Directory>") | 288 | (if (looking-at "<Current_Directory>") |
| 289 | (add-to-list 'ada-xref-runtime-library-ali-path ".") | ||
| 247 | (add-to-list 'ada-xref-runtime-library-ali-path | 290 | (add-to-list 'ada-xref-runtime-library-ali-path |
| 248 | (buffer-substring-no-properties | 291 | (buffer-substring-no-properties |
| 249 | (point) | 292 | (point) |
| @@ -312,8 +355,7 @@ replaced by the name including the extension." | |||
| 312 | (cond | 355 | (cond |
| 313 | (ada-prj-default-project-file | 356 | (ada-prj-default-project-file |
| 314 | ada-prj-default-project-file) | 357 | ada-prj-default-project-file) |
| 315 | (file | 358 | (file (ada-prj-find-prj-file file t)) |
| 316 | (ada-prj-get-prj-dir file)) | ||
| 317 | (t | 359 | (t |
| 318 | (message (concat "Not editing an Ada file," | 360 | (message (concat "Not editing an Ada file," |
| 319 | "and no default project " | 361 | "and no default project " |
| @@ -433,7 +475,6 @@ All the directories are returned as absolute directories." | |||
| 433 | 475 | ||
| 434 | (defun ada-xref-update-project-menu () | 476 | (defun ada-xref-update-project-menu () |
| 435 | "Update the menu Ada->Project, with the list of available project files." | 477 | "Update the menu Ada->Project, with the list of available project files." |
| 436 | (interactive) | ||
| 437 | (let (submenu) | 478 | (let (submenu) |
| 438 | 479 | ||
| 439 | ;; Create the standard items | 480 | ;; Create the standard items |
| @@ -475,14 +516,10 @@ All the directories are returned as absolute directories." | |||
| 475 | (or ada-xref-project-files '(nil))) | 516 | (or ada-xref-project-files '(nil))) |
| 476 | 517 | ||
| 477 | (if (not ada-xemacs) | 518 | (if (not ada-xemacs) |
| 478 | (if (and (lookup-key ada-mode-map [menu-bar Ada]) | 519 | (if (lookup-key ada-mode-map [menu-bar Ada Project]) |
| 479 | (lookup-key ada-mode-map [menu-bar Ada Project])) | 520 | (setcdr (lookup-key ada-mode-map [menu-bar Ada Project]) |
| 480 | (setcdr (lookup-key ada-mode-map [menu-bar Ada Project]) | 521 | submenu))) |
| 481 | submenu) | 522 | )) |
| 482 | (if (lookup-key ada-mode-map [menu-bar ada Project]) | ||
| 483 | (setcdr (lookup-key ada-mode-map [menu-bar ada Project]) | ||
| 484 | submenu)))) | ||
| 485 | )) | ||
| 486 | 523 | ||
| 487 | 524 | ||
| 488 | ;;------------------------------------------------------------- | 525 | ;;------------------------------------------------------------- |
| @@ -528,215 +565,6 @@ Completion is available." | |||
| 528 | (error (concat filename " not found in src_dir"))))) | 565 | (error (concat filename " not found in src_dir"))))) |
| 529 | 566 | ||
| 530 | 567 | ||
| 531 | ;; ----- Keybindings ------------------------------------------------------ | ||
| 532 | |||
| 533 | (defun ada-add-keymap () | ||
| 534 | "Add new key bindings when using `ada-xrel.el'." | ||
| 535 | (interactive) | ||
| 536 | (if ada-xemacs | ||
| 537 | (progn | ||
| 538 | (define-key ada-mode-map '(shift button3) 'ada-point-and-xref) | ||
| 539 | (define-key ada-mode-map '(control tab) 'ada-complete-identifier)) | ||
| 540 | (define-key ada-mode-map [C-tab] 'ada-complete-identifier) | ||
| 541 | (define-key ada-mode-map [S-mouse-3] 'ada-point-and-xref)) | ||
| 542 | |||
| 543 | (define-key ada-mode-map "\C-co" 'ff-find-other-file) | ||
| 544 | (define-key ada-mode-map "\C-c5\C-d" 'ada-goto-declaration-other-frame) | ||
| 545 | (define-key ada-mode-map "\C-c\C-d" 'ada-goto-declaration) | ||
| 546 | (define-key ada-mode-map "\C-c\C-s" 'ada-xref-goto-previous-reference) | ||
| 547 | (define-key ada-mode-map "\C-c\C-c" 'ada-compile-application) | ||
| 548 | (define-key ada-mode-map "\C-cc" 'ada-change-prj) | ||
| 549 | (define-key ada-mode-map "\C-cd" 'ada-set-default-project-file) | ||
| 550 | (define-key ada-mode-map "\C-cg" 'ada-gdb-application) | ||
| 551 | (define-key ada-mode-map "\C-cr" 'ada-run-application) | ||
| 552 | (define-key ada-mode-map "\C-c\C-o" 'ada-goto-parent) | ||
| 553 | (define-key ada-mode-map "\C-c\C-r" 'ada-find-references) | ||
| 554 | (define-key ada-mode-map "\C-cl" 'ada-find-local-references) | ||
| 555 | (define-key ada-mode-map "\C-c\C-v" 'ada-check-current) | ||
| 556 | (define-key ada-mode-map "\C-cf" 'ada-find-file) | ||
| 557 | ) | ||
| 558 | |||
| 559 | ;; ----- Menus -------------------------------------------------------------- | ||
| 560 | (defun ada-add-ada-menu () | ||
| 561 | "Add some items to the standard Ada mode menu. | ||
| 562 | The items are added to the menu called NAME, which should be the same | ||
| 563 | name as was passed to `ada-create-menu'." | ||
| 564 | (interactive) | ||
| 565 | (if ada-xemacs | ||
| 566 | (let* ((menu-list '("Ada")) | ||
| 567 | (goto-menu '("Ada" "Goto")) | ||
| 568 | (edit-menu '("Ada" "Edit")) | ||
| 569 | (help-menu '("Ada" "Help")) | ||
| 570 | (options-menu (list "Ada" "Options"))) | ||
| 571 | (funcall (symbol-function 'add-menu-button) | ||
| 572 | menu-list ["Check file" ada-check-current | ||
| 573 | (string= mode-name "Ada")] "Goto") | ||
| 574 | (funcall (symbol-function 'add-menu-button) | ||
| 575 | menu-list ["Compile file" ada-compile-current | ||
| 576 | (string= mode-name "Ada")] "Goto") | ||
| 577 | (funcall (symbol-function 'add-menu-button) | ||
| 578 | menu-list ["Build" ada-compile-application t] "Goto") | ||
| 579 | (funcall (symbol-function 'add-menu-button) | ||
| 580 | menu-list ["Run" ada-run-application t] "Goto") | ||
| 581 | (funcall (symbol-function 'add-menu-button) | ||
| 582 | menu-list ["Debug" ada-gdb-application t] "Goto") | ||
| 583 | (funcall (symbol-function 'add-menu-button) | ||
| 584 | menu-list ["--" nil t] "Goto") | ||
| 585 | (funcall (symbol-function 'add-menu-button) | ||
| 586 | goto-menu ["Goto Parent Unit" ada-goto-parent t] | ||
| 587 | "Next compilation error") | ||
| 588 | (funcall (symbol-function 'add-menu-button) | ||
| 589 | goto-menu ["Goto References to any entity" | ||
| 590 | ada-find-any-references t] | ||
| 591 | "Next compilation error") | ||
| 592 | (funcall (symbol-function 'add-menu-button) | ||
| 593 | goto-menu ["List References" ada-find-references t] | ||
| 594 | "Next compilation error") | ||
| 595 | (funcall (symbol-function 'add-menu-button) | ||
| 596 | goto-menu ["List Local References" ada-find-local-references t] | ||
| 597 | "Next compilation error") | ||
| 598 | (funcall (symbol-function 'add-menu-button) | ||
| 599 | goto-menu ["Goto Declaration Other Frame" | ||
| 600 | ada-goto-declaration-other-frame t] | ||
| 601 | "Next compilation error") | ||
| 602 | (funcall (symbol-function 'add-menu-button) | ||
| 603 | goto-menu ["Goto Declaration/Body" | ||
| 604 | ada-goto-declaration t] | ||
| 605 | "Next compilation error") | ||
| 606 | (funcall (symbol-function 'add-menu-button) | ||
| 607 | goto-menu ["Goto Previous Reference" | ||
| 608 | ada-xref-goto-previous-reference t] | ||
| 609 | "Next compilation error") | ||
| 610 | (funcall (symbol-function 'add-menu-button) | ||
| 611 | goto-menu ["--" nil t] "Next compilation error") | ||
| 612 | (funcall (symbol-function 'add-menu-button) | ||
| 613 | edit-menu ["Complete Identifier" | ||
| 614 | ada-complete-identifier t] | ||
| 615 | "Indent Line") | ||
| 616 | (funcall (symbol-function 'add-menu-button) | ||
| 617 | edit-menu ["--------" nil t] "Indent Line") | ||
| 618 | (funcall (symbol-function 'add-menu-button) | ||
| 619 | help-menu ["Gnat User Guide" (info "gnat_ug")]) | ||
| 620 | (funcall (symbol-function 'add-menu-button) | ||
| 621 | help-menu ["Gnat Reference Manual" (info "gnat_rm")]) | ||
| 622 | (funcall (symbol-function 'add-menu-button) | ||
| 623 | help-menu ["Gcc Documentation" (info "gcc")]) | ||
| 624 | (funcall (symbol-function 'add-menu-button) | ||
| 625 | help-menu ["Gdb Documentation" (info "gdb")]) | ||
| 626 | (funcall (symbol-function 'add-menu-button) | ||
| 627 | help-menu ["Ada95 Reference Manual" (info "arm95")]) | ||
| 628 | (funcall (symbol-function 'add-menu-button) | ||
| 629 | options-menu | ||
| 630 | ["Show Cross-References in Other Buffer" | ||
| 631 | (setq ada-xref-other-buffer | ||
| 632 | (not ada-xref-other-buffer)) | ||
| 633 | :style toggle :selected ada-xref-other-buffer]) | ||
| 634 | (funcall (symbol-function 'add-menu-button) | ||
| 635 | options-menu | ||
| 636 | ["Automatically Recompile for Cross-References" | ||
| 637 | (setq ada-xref-create-ali (not ada-xref-create-ali)) | ||
| 638 | :style toggle :selected ada-xref-create-ali]) | ||
| 639 | (funcall (symbol-function 'add-menu-button) | ||
| 640 | options-menu | ||
| 641 | ["Confirm Commands" | ||
| 642 | (setq ada-xref-confirm-compile | ||
| 643 | (not ada-xref-confirm-compile)) | ||
| 644 | :style toggle :selected ada-xref-confirm-compile]) | ||
| 645 | (if (string-match "gvd" ada-prj-default-debugger) | ||
| 646 | (funcall (symbol-function 'add-menu-button) | ||
| 647 | options-menu | ||
| 648 | ["Tight Integration With Gnu Visual Debugger" | ||
| 649 | (setq ada-tight-gvd-integration | ||
| 650 | (not ada-tight-gvd-integration)) | ||
| 651 | :style toggle :selected ada-tight-gvd-integration])) | ||
| 652 | ) | ||
| 653 | |||
| 654 | ;; for Emacs | ||
| 655 | (let* ((menu (or (lookup-key ada-mode-map [menu-bar Ada]) | ||
| 656 | ;; Emacs-21.4's easymenu.el downcases the events. | ||
| 657 | (lookup-key ada-mode-map [menu-bar ada]))) | ||
| 658 | (edit-menu (or (lookup-key menu [Edit]) (lookup-key menu [edit]))) | ||
| 659 | (help-menu (or (lookup-key menu [Help]) (lookup-key menu [help]))) | ||
| 660 | (goto-menu (or (lookup-key menu [Goto]) (lookup-key menu [goto]))) | ||
| 661 | (options-menu (or (lookup-key menu [Options]) | ||
| 662 | (lookup-key menu [options])))) | ||
| 663 | |||
| 664 | (define-key-after menu [Check] '("Check file" . ada-check-current) | ||
| 665 | 'Customize) | ||
| 666 | (define-key-after menu [Compile] '("Compile file" . ada-compile-current) | ||
| 667 | 'Check) | ||
| 668 | (define-key-after menu [Build] '("Build" . ada-compile-application) | ||
| 669 | 'Compile) | ||
| 670 | (define-key-after menu [Run] '("Run" . ada-run-application) 'Build) | ||
| 671 | (define-key-after menu [Debug] '("Debug" . ada-gdb-application) 'Run) | ||
| 672 | (define-key-after menu [rem] '("--" . nil) 'Debug) | ||
| 673 | (define-key-after menu [Project] | ||
| 674 | (cons "Project" (make-sparse-keymap)) 'rem) | ||
| 675 | |||
| 676 | (define-key help-menu [Gnat_ug] | ||
| 677 | '("Gnat User Guide" . (lambda() (interactive) (info "gnat_ug")))) | ||
| 678 | (define-key help-menu [Gnat_rm] | ||
| 679 | '("Gnat Reference Manual" . (lambda() (interactive) (info "gnat_rm")))) | ||
| 680 | (define-key help-menu [Gcc] | ||
| 681 | '("Gcc Documentation" . (lambda() (interactive) (info "gcc")))) | ||
| 682 | (define-key help-menu [gdb] | ||
| 683 | '("Gdb Documentation" . (lambda() (interactive) (info "gdb")))) | ||
| 684 | (define-key help-menu [arm95] | ||
| 685 | '("Ada95 Reference Manual" . (lambda() (interactive) (info "arm95")))) | ||
| 686 | |||
| 687 | (define-key goto-menu [rem] '("----" . nil)) | ||
| 688 | (define-key goto-menu [Parent] '("Goto Parent Unit" | ||
| 689 | . ada-goto-parent)) | ||
| 690 | (define-key goto-menu [References-any] | ||
| 691 | '("Goto References to any entity" . ada-find-any-references)) | ||
| 692 | (define-key goto-menu [References] | ||
| 693 | '("List References" . ada-find-references)) | ||
| 694 | (define-key goto-menu [Local-References] | ||
| 695 | '("List Local References" . ada-find-local-references)) | ||
| 696 | (define-key goto-menu [Prev] | ||
| 697 | '("Goto Previous Reference" . ada-xref-goto-previous-reference)) | ||
| 698 | (define-key goto-menu [Decl-other] | ||
| 699 | '("Goto Declaration Other Frame" . ada-goto-declaration-other-frame)) | ||
| 700 | (define-key goto-menu [Decl] | ||
| 701 | '("Goto Declaration/Body" . ada-goto-declaration)) | ||
| 702 | |||
| 703 | (define-key edit-menu [rem] '("----" . nil)) | ||
| 704 | (define-key edit-menu [Complete] '("Complete Identifier" | ||
| 705 | . ada-complete-identifier)) | ||
| 706 | |||
| 707 | (define-key-after options-menu [xrefrecompile] | ||
| 708 | '(menu-item "Automatically Recompile for Cross-References" | ||
| 709 | (lambda()(interactive) | ||
| 710 | (setq ada-xref-create-ali (not ada-xref-create-ali))) | ||
| 711 | :button (:toggle . ada-xref-create-ali)) t) | ||
| 712 | (define-key-after options-menu [xrefconfirm] | ||
| 713 | '(menu-item "Confirm Commands" | ||
| 714 | (lambda()(interactive) | ||
| 715 | (setq ada-xref-confirm-compile | ||
| 716 | (not ada-xref-confirm-compile))) | ||
| 717 | :button (:toggle . ada-xref-confirm-compile)) t) | ||
| 718 | (define-key-after options-menu [xrefother] | ||
| 719 | '(menu-item "Show Cross-References in Other Buffer" | ||
| 720 | (lambda()(interactive) | ||
| 721 | (setq ada-xref-other-buffer (not ada-xref-other-buffer))) | ||
| 722 | :button (:toggle . ada-xref-other-buffer)) t) | ||
| 723 | |||
| 724 | (if (string-match "gvd" ada-prj-default-debugger) | ||
| 725 | (define-key-after options-menu [tightgvd] | ||
| 726 | '(menu-item "Tight Integration With Gnu Visual Debugger" | ||
| 727 | (lambda()(interactive) | ||
| 728 | (setq ada-tight-gvd-integration | ||
| 729 | (not ada-tight-gvd-integration))) | ||
| 730 | :button (:toggle . ada-tight-gvd-integration)) t)) | ||
| 731 | |||
| 732 | (define-key edit-menu [rem3] '("------------" . nil)) | ||
| 733 | (define-key edit-menu [open-file-from-src-path] | ||
| 734 | '("Search File on source path..." . ada-find-file)) | ||
| 735 | ) | ||
| 736 | ) | ||
| 737 | (ada-xref-update-project-menu) | ||
| 738 | ) | ||
| 739 | |||
| 740 | ;; ----- Utilities ------------------------------------------------- | 568 | ;; ----- Utilities ------------------------------------------------- |
| 741 | 569 | ||
| 742 | (defun ada-require-project-file () | 570 | (defun ada-require-project-file () |
| @@ -766,17 +594,23 @@ name as was passed to `ada-create-menu'." | |||
| 766 | This is overriden on VMS to convert from VMS filenames to Unix filenames." | 594 | This is overriden on VMS to convert from VMS filenames to Unix filenames." |
| 767 | name) | 595 | name) |
| 768 | 596 | ||
| 769 | (defun ada-set-default-project-file (name) | 597 | (defun ada-set-default-project-file (name &optional keep-existing) |
| 770 | "Set the file whose name is NAME as the default project file." | 598 | "Set the file whose name is NAME as the default project file. |
| 599 | If KEEP-EXISTING is true and a project file has already been loaded, nothing | ||
| 600 | is done. This is meant to be used from ada-mode-hook, for instance to force | ||
| 601 | a project file unless the user has already loaded one." | ||
| 771 | (interactive "fProject file:") | 602 | (interactive "fProject file:") |
| 772 | (setq ada-prj-default-project-file name) | 603 | (if (or (not keep-existing) |
| 773 | (ada-reread-prj-file name) | 604 | (not ada-prj-default-project-file) |
| 774 | ) | 605 | (equal ada-prj-default-project-file "")) |
| 606 | (progn | ||
| 607 | (setq ada-prj-default-project-file name) | ||
| 608 | (ada-reread-prj-file name)))) | ||
| 775 | 609 | ||
| 776 | ;; ------ Handling the project file ----------------------------- | 610 | ;; ------ Handling the project file ----------------------------- |
| 777 | 611 | ||
| 778 | (defun ada-prj-find-prj-file (&optional no-user-question) | 612 | (defun ada-prj-find-prj-file (&optional file no-user-question) |
| 779 | "Find the prj file associated with the current buffer. | 613 | "Find the prj file associated with FILE (or the current buffer if nil). |
| 780 | If NO-USER-QUESTION is non-nil, use a default file if not project file was | 614 | If NO-USER-QUESTION is non-nil, use a default file if not project file was |
| 781 | found, and do not ask the user. | 615 | found, and do not ask the user. |
| 782 | If the buffer is not an Ada buffer, associate it with the default project | 616 | If the buffer is not an Ada buffer, associate it with the default project |
| @@ -789,14 +623,16 @@ file. If none is set, return nil." | |||
| 789 | ;; the current buffer is not a real file (for instance an emerge buffer) | 623 | ;; the current buffer is not a real file (for instance an emerge buffer) |
| 790 | 624 | ||
| 791 | (if (or (not (string= mode-name "Ada")) | 625 | (if (or (not (string= mode-name "Ada")) |
| 792 | (not (buffer-file-name)) | 626 | (not (buffer-file-name))) |
| 793 | (and ada-prj-default-project-file | 627 | |
| 794 | (not (string= ada-prj-default-project-file "")))) | 628 | (if (and ada-prj-default-project-file |
| 795 | (set 'selected ada-prj-default-project-file) | 629 | (not (string= ada-prj-default-project-file ""))) |
| 630 | (setq selected ada-prj-default-project-file) | ||
| 631 | (setq selected nil)) | ||
| 796 | 632 | ||
| 797 | ;; other cases: use a more complex algorithm | 633 | ;; other cases: use a more complex algorithm |
| 798 | 634 | ||
| 799 | (let* ((current-file (buffer-file-name)) | 635 | (let* ((current-file (or file (buffer-file-name))) |
| 800 | (first-choice (concat | 636 | (first-choice (concat |
| 801 | (file-name-sans-extension current-file) | 637 | (file-name-sans-extension current-file) |
| 802 | ada-project-file-extension)) | 638 | ada-project-file-extension)) |
| @@ -836,6 +672,7 @@ file. If none is set, return nil." | |||
| 836 | counter | 672 | counter |
| 837 | (nth (1- counter) prj-files))) | 673 | (nth (1- counter) prj-files))) |
| 838 | (setq counter (1+ counter)) | 674 | (setq counter (1+ counter)) |
| 675 | |||
| 839 | ))) ; end of with-output-to ... | 676 | ))) ; end of with-output-to ... |
| 840 | (setq choice nil) | 677 | (setq choice nil) |
| 841 | (while (or | 678 | (while (or |
| @@ -859,7 +696,8 @@ file. If none is set, return nil." | |||
| 859 | (unless (string= ada-last-prj-file "") | 696 | (unless (string= ada-last-prj-file "") |
| 860 | (set 'selected ada-last-prj-file)))) | 697 | (set 'selected ada-last-prj-file)))) |
| 861 | ))) | 698 | ))) |
| 862 | selected | 699 | |
| 700 | (or selected "default.adp") | ||
| 863 | )) | 701 | )) |
| 864 | 702 | ||
| 865 | 703 | ||
| @@ -872,6 +710,9 @@ The current buffer should be the ada-file buffer." | |||
| 872 | (ada-buffer (current-buffer))) | 710 | (ada-buffer (current-buffer))) |
| 873 | (setq prj-file (expand-file-name prj-file)) | 711 | (setq prj-file (expand-file-name prj-file)) |
| 874 | 712 | ||
| 713 | ;; Set the project file as the active one. | ||
| 714 | (setq ada-prj-default-project-file prj-file) | ||
| 715 | |||
| 875 | ;; Initialize the project with the default values | 716 | ;; Initialize the project with the default values |
| 876 | (ada-xref-set-default-prj-values 'project (current-buffer)) | 717 | (ada-xref-set-default-prj-values 'project (current-buffer)) |
| 877 | 718 | ||
| @@ -880,9 +721,11 @@ The current buffer should be the ada-file buffer." | |||
| 880 | ;; find-file anyway, since the speedbar frame is special and does not | 721 | ;; find-file anyway, since the speedbar frame is special and does not |
| 881 | ;; allow the selection of a file in it. | 722 | ;; allow the selection of a file in it. |
| 882 | 723 | ||
| 883 | (let* ((buffer (run-hook-with-args-until-success | 724 | (if (file-exists-p prj-file) |
| 884 | 'ada-load-project-hook prj-file))) | 725 | (progn |
| 885 | (unless buffer | 726 | (let* ((buffer (run-hook-with-args-until-success |
| 727 | 'ada-load-project-hook prj-file))) | ||
| 728 | (unless buffer | ||
| 886 | (setq buffer (find-file-noselect prj-file nil))) | 729 | (setq buffer (find-file-noselect prj-file nil))) |
| 887 | (set-buffer buffer)) | 730 | (set-buffer buffer)) |
| 888 | 731 | ||
| @@ -938,8 +781,34 @@ The current buffer should be the ada-file buffer." | |||
| 938 | (reverse run_cmd)))) | 781 | (reverse run_cmd)))) |
| 939 | (set 'project (plist-put project 'debug_post_cmd | 782 | (set 'project (plist-put project 'debug_post_cmd |
| 940 | (reverse debug_post_cmd))) | 783 | (reverse debug_post_cmd))) |
| 941 | (set 'project (plist-put project 'debug_pre_cmd | 784 | (set 'project (plist-put project 'debug_pre_cmd |
| 942 | (reverse debug_pre_cmd))) | 785 | (reverse debug_pre_cmd))) |
| 786 | |||
| 787 | ;; Kill the project buffer | ||
| 788 | (kill-buffer nil) | ||
| 789 | (set-buffer ada-buffer) | ||
| 790 | ) | ||
| 791 | |||
| 792 | ;; Else the file wasn't readable (probably the default project). | ||
| 793 | ;; We initialize it with the current environment variables. | ||
| 794 | ;; We need to add the startup directory in front so that | ||
| 795 | ;; files locally redefined are properly found. We cannot | ||
| 796 | ;; add ".", which varies too much depending on what the | ||
| 797 | ;; current buffer is. | ||
| 798 | (set 'project | ||
| 799 | (plist-put project 'src_dir | ||
| 800 | (append | ||
| 801 | (list command-line-default-directory) | ||
| 802 | (split-string (or (getenv "ADA_INCLUDE_PATH") "") ":") | ||
| 803 | (list "." default-directory)))) | ||
| 804 | (set 'project | ||
| 805 | (plist-put project 'obj_dir | ||
| 806 | (append | ||
| 807 | (list command-line-default-directory) | ||
| 808 | (split-string (or (getenv "ADA_OBJECTS_PATH") "") ":") | ||
| 809 | (list "." default-directory)))) | ||
| 810 | ) | ||
| 811 | |||
| 943 | 812 | ||
| 944 | ;; Delete the default project file from the list, if it is there. | 813 | ;; Delete the default project file from the list, if it is there. |
| 945 | ;; Note that in that case, this default project is the only one in | 814 | ;; Note that in that case, this default project is the only one in |
| @@ -952,9 +821,6 @@ The current buffer should be the ada-file buffer." | |||
| 952 | (setcdr (assoc prj-file ada-xref-project-files) project) | 821 | (setcdr (assoc prj-file ada-xref-project-files) project) |
| 953 | (add-to-list 'ada-xref-project-files (cons prj-file project))) | 822 | (add-to-list 'ada-xref-project-files (cons prj-file project))) |
| 954 | 823 | ||
| 955 | ;; Set the project file as the active one. | ||
| 956 | (setq ada-prj-default-project-file prj-file) | ||
| 957 | |||
| 958 | ;; Sets up the compilation-search-path so that Emacs is able to | 824 | ;; Sets up the compilation-search-path so that Emacs is able to |
| 959 | ;; go to the source of the errors in a compilation buffer | 825 | ;; go to the source of the errors in a compilation buffer |
| 960 | (setq compilation-search-path (ada-xref-get-src-dir-field)) | 826 | (setq compilation-search-path (ada-xref-get-src-dir-field)) |
| @@ -971,10 +837,6 @@ The current buffer should be the ada-file buffer." | |||
| 971 | (append (mapcar 'directory-file-name compilation-search-path) | 837 | (append (mapcar 'directory-file-name compilation-search-path) |
| 972 | ada-search-directories)) | 838 | ada-search-directories)) |
| 973 | 839 | ||
| 974 | ;; Kill the project buffer | ||
| 975 | (kill-buffer nil) | ||
| 976 | (set-buffer ada-buffer) | ||
| 977 | |||
| 978 | (ada-xref-update-project-menu) | 840 | (ada-xref-update-project-menu) |
| 979 | ) | 841 | ) |
| 980 | 842 | ||
| @@ -1079,35 +941,6 @@ buffer *gnatfind* if it exists." | |||
| 1079 | 941 | ||
| 1080 | (defalias 'ada-change-prj (symbol-function 'ada-set-default-project-file)) | 942 | (defalias 'ada-change-prj (symbol-function 'ada-set-default-project-file)) |
| 1081 | 943 | ||
| 1082 | ;; ----- Identlist manipulation ------------------------------------------- | ||
| 1083 | ;; An identlist is a vector that is used internally to reference an identifier | ||
| 1084 | ;; To facilitate its use, we provide the following macros | ||
| 1085 | |||
| 1086 | (defmacro ada-make-identlist () (make-vector 8 nil)) | ||
| 1087 | (defmacro ada-name-of (identlist) (list 'aref identlist 0)) | ||
| 1088 | (defmacro ada-line-of (identlist) (list 'aref identlist 1)) | ||
| 1089 | (defmacro ada-column-of (identlist) (list 'aref identlist 2)) | ||
| 1090 | (defmacro ada-file-of (identlist) (list 'aref identlist 3)) | ||
| 1091 | (defmacro ada-ali-index-of (identlist) (list 'aref identlist 4)) | ||
| 1092 | (defmacro ada-declare-file-of (identlist) (list 'aref identlist 5)) | ||
| 1093 | (defmacro ada-references-of (identlist) (list 'aref identlist 6)) | ||
| 1094 | (defmacro ada-on-declaration (identlist) (list 'aref identlist 7)) | ||
| 1095 | |||
| 1096 | (defmacro ada-set-name (identlist name) (list 'aset identlist 0 name)) | ||
| 1097 | (defmacro ada-set-line (identlist line) (list 'aset identlist 1 line)) | ||
| 1098 | (defmacro ada-set-column (identlist col) (list 'aset identlist 2 col)) | ||
| 1099 | (defmacro ada-set-file (identlist file) (list 'aset identlist 3 file)) | ||
| 1100 | (defmacro ada-set-ali-index (identlist index) (list 'aset identlist 4 index)) | ||
| 1101 | (defmacro ada-set-declare-file (identlist file) (list 'aset identlist 5 file)) | ||
| 1102 | (defmacro ada-set-references (identlist ref) (list 'aset identlist 6 ref)) | ||
| 1103 | (defmacro ada-set-on-declaration (ident value) (list 'aset ident 7 value)) | ||
| 1104 | |||
| 1105 | (defsubst ada-get-ali-buffer (file) | ||
| 1106 | "Reads the ali file into a new buffer, and returns this buffer's name" | ||
| 1107 | (find-file-noselect (ada-get-ali-file-name file))) | ||
| 1108 | |||
| 1109 | |||
| 1110 | |||
| 1111 | ;; ----- Identifier Completion -------------------------------------------- | 944 | ;; ----- Identifier Completion -------------------------------------------- |
| 1112 | (defun ada-complete-identifier (pos) | 945 | (defun ada-complete-identifier (pos) |
| 1113 | "Tries to complete the identifier around POS. | 946 | "Tries to complete the identifier around POS. |
| @@ -1150,11 +983,29 @@ option." | |||
| 1150 | ;; ----- Cross-referencing ---------------------------------------- | 983 | ;; ----- Cross-referencing ---------------------------------------- |
| 1151 | 984 | ||
| 1152 | (defun ada-point-and-xref () | 985 | (defun ada-point-and-xref () |
| 1153 | "Calls `mouse-set-point' and then `ada-goto-declaration'." | 986 | "Jump to the declaration of the entity below the cursor." |
| 1154 | (interactive) | 987 | (interactive) |
| 1155 | (mouse-set-point last-input-event) | 988 | (mouse-set-point last-input-event) |
| 1156 | (ada-goto-declaration (point))) | 989 | (ada-goto-declaration (point))) |
| 1157 | 990 | ||
| 991 | (defun ada-point-and-xref-body () | ||
| 992 | "Jump to the body of the entity under the cursor." | ||
| 993 | (interactive) | ||
| 994 | (mouse-set-point last-input-event) | ||
| 995 | (ada-goto-body (point))) | ||
| 996 | |||
| 997 | (defun ada-goto-body (pos &optional other-frame) | ||
| 998 | "Display the body of the entity around POS. | ||
| 999 | If the entity doesn't have a body, display its declaration. | ||
| 1000 | As a side effect, the buffer for the declaration is also open." | ||
| 1001 | (interactive "d") | ||
| 1002 | (ada-goto-declaration pos other-frame) | ||
| 1003 | |||
| 1004 | ;; Temporarily force the display in the same buffer, since we | ||
| 1005 | ;; already changed previously | ||
| 1006 | (let ((ada-xref-other-buffer nil)) | ||
| 1007 | (ada-goto-declaration (point) nil))) | ||
| 1008 | |||
| 1158 | (defun ada-goto-declaration (pos &optional other-frame) | 1009 | (defun ada-goto-declaration (pos &optional other-frame) |
| 1159 | "Display the declaration of the identifier around POS. | 1010 | "Display the declaration of the identifier around POS. |
| 1160 | The declaration is shown in another buffer if `ada-xref-other-buffer' is | 1011 | The declaration is shown in another buffer if `ada-xref-other-buffer' is |
| @@ -1258,7 +1109,7 @@ If ARG is not nil, ask for user confirmation." | |||
| 1258 | ;; Insert newlines so as to separate the name of the commands to run | 1109 | ;; Insert newlines so as to separate the name of the commands to run |
| 1259 | ;; and the output of the commands. this doesn't work with cmdproxy.exe, | 1110 | ;; and the output of the commands. this doesn't work with cmdproxy.exe, |
| 1260 | ;; which gets confused by newline characters. | 1111 | ;; which gets confused by newline characters. |
| 1261 | (if (not (string-match "cmdproxy.exe" shell-file-name)) | 1112 | (if (not (string-match ".exe" shell-file-name)) |
| 1262 | (setq cmd (concat cmd "\n\n"))) | 1113 | (setq cmd (concat cmd "\n\n"))) |
| 1263 | 1114 | ||
| 1264 | (compile (ada-quote-cmd cmd)))) | 1115 | (compile (ada-quote-cmd cmd)))) |
| @@ -1291,7 +1142,7 @@ command, and should be either comp_cmd (default) or check_cmd." | |||
| 1291 | ;; Insert newlines so as to separate the name of the commands to run | 1142 | ;; Insert newlines so as to separate the name of the commands to run |
| 1292 | ;; and the output of the commands. this doesn't work with cmdproxy.exe, | 1143 | ;; and the output of the commands. this doesn't work with cmdproxy.exe, |
| 1293 | ;; which gets confused by newline characters. | 1144 | ;; which gets confused by newline characters. |
| 1294 | (if (not (string-match "cmdproxy.exe" shell-file-name)) | 1145 | (if (not (string-match ".exe" shell-file-name)) |
| 1295 | (setq cmd (concat cmd "\n\n"))) | 1146 | (setq cmd (concat cmd "\n\n"))) |
| 1296 | 1147 | ||
| 1297 | (compile (ada-quote-cmd cmd)))) | 1148 | (compile (ada-quote-cmd cmd)))) |
| @@ -1395,7 +1246,8 @@ If ARG is non-nil, ask the user to confirm the command." | |||
| 1395 | (if (or arg ada-xref-confirm-compile) | 1246 | (if (or arg ada-xref-confirm-compile) |
| 1396 | (set 'cmd (read-from-minibuffer "enter command to debug: " cmd))) | 1247 | (set 'cmd (read-from-minibuffer "enter command to debug: " cmd))) |
| 1397 | 1248 | ||
| 1398 | (let (comint-exec | 1249 | (let ((old-comint-exec (symbol-function 'comint-exec)) |
| 1250 | comint-exec | ||
| 1399 | in-post-mode | 1251 | in-post-mode |
| 1400 | gud-gdb-massage-args) | 1252 | gud-gdb-massage-args) |
| 1401 | 1253 | ||
| @@ -1410,8 +1262,10 @@ If ARG is non-nil, ask the user to confirm the command." | |||
| 1410 | (if post-cmd | 1262 | (if post-cmd |
| 1411 | (set 'post-cmd (concat post-cmd "\n"))) | 1263 | (set 'post-cmd (concat post-cmd "\n"))) |
| 1412 | 1264 | ||
| 1265 | |||
| 1413 | ;; Temporarily replaces the definition of `comint-exec' so that we | 1266 | ;; Temporarily replaces the definition of `comint-exec' so that we |
| 1414 | ;; can execute commands before running gdb. | 1267 | ;; can execute commands before running gdb. |
| 1268 | (make-local-variable 'comint-exec) | ||
| 1415 | (fset 'comint-exec | 1269 | (fset 'comint-exec |
| 1416 | `(lambda (buffer name command startfile switches) | 1270 | `(lambda (buffer name command startfile switches) |
| 1417 | (let (compilation-buffer-name-function) | 1271 | (let (compilation-buffer-name-function) |
| @@ -1435,6 +1289,11 @@ If ARG is non-nil, ask the user to confirm the command." | |||
| 1435 | (funcall (symbol-function 'jdb) cmd) | 1289 | (funcall (symbol-function 'jdb) cmd) |
| 1436 | (gdb cmd)) | 1290 | (gdb cmd)) |
| 1437 | 1291 | ||
| 1292 | ;; Restore the standard fset command (or for instance C-U M-x shell | ||
| 1293 | ;; wouldn't work anymore | ||
| 1294 | |||
| 1295 | (fset 'comint-exec old-comint-exec) | ||
| 1296 | |||
| 1438 | ;; Send post-commands to the debugger | 1297 | ;; Send post-commands to the debugger |
| 1439 | (process-send-string (get-buffer-process (current-buffer)) post-cmd) | 1298 | (process-send-string (get-buffer-process (current-buffer)) post-cmd) |
| 1440 | 1299 | ||
| @@ -1465,7 +1324,7 @@ automatically modifies the setup for all the Ada buffer that use this file." | |||
| 1465 | 1324 | ||
| 1466 | ;; Reread the location of the standard runtime library | 1325 | ;; Reread the location of the standard runtime library |
| 1467 | (ada-initialize-runtime-library | 1326 | (ada-initialize-runtime-library |
| 1468 | (or (ada-xref-get-project-field 'cross-prefix) "")) | 1327 | (or (ada-xref-get-project-field 'cross_prefix) "")) |
| 1469 | ) | 1328 | ) |
| 1470 | 1329 | ||
| 1471 | ;; ------ Private routines | 1330 | ;; ------ Private routines |
| @@ -1780,7 +1639,7 @@ from the ali file (definition file and places where it is referenced)." | |||
| 1780 | (unless (re-search-forward (concat (ada-ali-index-of identlist) | 1639 | (unless (re-search-forward (concat (ada-ali-index-of identlist) |
| 1781 | "|\\([0-9]+[^0-9][0-9]+\\(\n\\.\\)? \\)*" | 1640 | "|\\([0-9]+[^0-9][0-9]+\\(\n\\.\\)? \\)*" |
| 1782 | (ada-line-of identlist) | 1641 | (ada-line-of identlist) |
| 1783 | "[^etp]" | 1642 | "[^etpzkd<>=^]" |
| 1784 | (ada-column-of identlist) "\\>") | 1643 | (ada-column-of identlist) "\\>") |
| 1785 | nil t) | 1644 | nil t) |
| 1786 | 1645 | ||
| @@ -1886,7 +1745,7 @@ This function is disabled for operators, and only works for identifiers." | |||
| 1886 | (goto-char (point-max)) | 1745 | (goto-char (point-max)) |
| 1887 | (while (re-search-backward my-regexp nil t) | 1746 | (while (re-search-backward my-regexp nil t) |
| 1888 | (save-excursion | 1747 | (save-excursion |
| 1889 | (setq line-ali (count-lines 1 (point))) | 1748 | (set 'line-ali (count-lines 1 (point))) |
| 1890 | (beginning-of-line) | 1749 | (beginning-of-line) |
| 1891 | ;; have a look at the line and column numbers | 1750 | ;; have a look at the line and column numbers |
| 1892 | (if (looking-at "^\\([0-9]+\\).\\([0-9]+\\)[ *]") | 1751 | (if (looking-at "^\\([0-9]+\\).\\([0-9]+\\)[ *]") |
| @@ -1977,13 +1836,14 @@ opens a new window to show the declaration." | |||
| 1977 | (set 'locations (list (list (match-string 1 ali-line) ;; line | 1836 | (set 'locations (list (list (match-string 1 ali-line) ;; line |
| 1978 | (match-string 2 ali-line) ;; column | 1837 | (match-string 2 ali-line) ;; column |
| 1979 | (ada-declare-file-of identlist)))) | 1838 | (ada-declare-file-of identlist)))) |
| 1980 | (while (string-match "\\([0-9]+\\)[bc]\\([0-9]+\\)" ali-line start) | 1839 | (while (string-match "\\([0-9]+\\)[bc]\\(<[^>]+>\\)?\\([0-9]+\\)" |
| 1840 | ali-line start) | ||
| 1981 | (setq line (match-string 1 ali-line) | 1841 | (setq line (match-string 1 ali-line) |
| 1982 | col (match-string 2 ali-line) | 1842 | col (match-string 3 ali-line) |
| 1983 | start (match-end 2)) | 1843 | start (match-end 3)) |
| 1984 | 1844 | ||
| 1985 | ;; it there was a file number in the same line | 1845 | ;; it there was a file number in the same line |
| 1986 | (if (string-match (concat "\\([0-9]+\\)|\\([^|bc]+\\)?" | 1846 | (if (string-match (concat "[^{(<]\\([0-9]+\\)|\\([^|bc]+\\)?" |
| 1987 | (match-string 0 ali-line)) | 1847 | (match-string 0 ali-line)) |
| 1988 | ali-line) | 1848 | ali-line) |
| 1989 | (let ((file-number (match-string 1 ali-line))) | 1849 | (let ((file-number (match-string 1 ali-line))) |
| @@ -2377,6 +2237,8 @@ find-file...." | |||
| 2377 | 2237 | ||
| 2378 | ;; Completion for file names in the mini buffer should ignore .ali files | 2238 | ;; Completion for file names in the mini buffer should ignore .ali files |
| 2379 | (add-to-list 'completion-ignored-extensions ".ali") | 2239 | (add-to-list 'completion-ignored-extensions ".ali") |
| 2240 | |||
| 2241 | (ada-xref-update-project-menu) | ||
| 2380 | ) | 2242 | ) |
| 2381 | 2243 | ||
| 2382 | 2244 | ||
| @@ -2395,11 +2257,6 @@ find-file...." | |||
| 2395 | (if (ada-find-file-in-dir "ddd" exec-path) | 2257 | (if (ada-find-file-in-dir "ddd" exec-path) |
| 2396 | (set 'ada-prj-default-debugger "ddd --tty -fullname -toolbar")))) | 2258 | (set 'ada-prj-default-debugger "ddd --tty -fullname -toolbar")))) |
| 2397 | 2259 | ||
| 2398 | ;; Set the keymap once and for all, so that the keys set by the user in his | ||
| 2399 | ;; config file are not overwritten every time we open a new file. | ||
| 2400 | (ada-add-ada-menu) | ||
| 2401 | (ada-add-keymap) | ||
| 2402 | |||
| 2403 | (add-hook 'ada-mode-hook 'ada-xref-initialize) | 2260 | (add-hook 'ada-mode-hook 'ada-xref-initialize) |
| 2404 | 2261 | ||
| 2405 | ;; Initializes the cross references to the runtime library | 2262 | ;; Initializes the cross references to the runtime library |
| @@ -2410,14 +2267,6 @@ find-file...." | |||
| 2410 | (append (mapcar 'directory-file-name ada-xref-runtime-library-specs-path) | 2267 | (append (mapcar 'directory-file-name ada-xref-runtime-library-specs-path) |
| 2411 | ada-search-directories)) | 2268 | ada-search-directories)) |
| 2412 | 2269 | ||
| 2413 | ;; Make sure that the files are always associated with a project file. Since | ||
| 2414 | ;; the project file has some fields that are used for the editor (like the | ||
| 2415 | ;; casing exceptions), it has to be read before the user edits a file). | ||
| 2416 | ;; (add-hook 'ada-mode-hook | ||
| 2417 | ;; (lambda() | ||
| 2418 | ;; (let ((file (ada-prj-find-prj-file t))) | ||
| 2419 | ;; (if file (ada-reread-prj-file file))))) | ||
| 2420 | |||
| 2421 | (provide 'ada-xref) | 2270 | (provide 'ada-xref) |
| 2422 | 2271 | ||
| 2423 | ;;; ada-xref.el ends here | 2272 | ;;; ada-xref.el ends here |