44 |
|
|
45 |
(require 'compile) |
(require 'compile) |
46 |
(require 'comint) |
(require 'comint) |
47 |
|
(require 'find-file) |
48 |
|
(require 'ada-mode) |
49 |
|
|
50 |
;; ------ Use variables |
;; ------ Use variables |
51 |
(defcustom ada-xref-other-buffer t |
(defcustom ada-xref-other-buffer t |
517 |
;; one (in case ada-xref-project-files is nil) |
;; one (in case ada-xref-project-files is nil) |
518 |
(or ada-xref-project-files '(nil))) |
(or ada-xref-project-files '(nil))) |
519 |
|
|
520 |
(if (not ada-xemacs) |
(if (not (featurep 'xemacs)) |
521 |
(if (lookup-key ada-mode-map [menu-bar Ada Project]) |
(if (lookup-key ada-mode-map [menu-bar Ada Project]) |
522 |
(setcdr (lookup-key ada-mode-map [menu-bar Ada Project]) |
(setcdr (lookup-key ada-mode-map [menu-bar Ada Project]) |
523 |
submenu))) |
submenu))) |
728 |
(let* ((buffer (run-hook-with-args-until-success |
(let* ((buffer (run-hook-with-args-until-success |
729 |
'ada-load-project-hook prj-file))) |
'ada-load-project-hook prj-file))) |
730 |
(unless buffer |
(unless buffer |
731 |
(setq buffer (find-file-noselect prj-file nil))) |
(setq buffer (find-file-noselect prj-file nil))) |
732 |
(set-buffer buffer)) |
(set-buffer buffer)) |
733 |
|
|
734 |
(widen) |
(widen) |
735 |
(goto-char (point-min)) |
(goto-char (point-min)) |
736 |
|
|
737 |
|
;; Now overrides these values with the project file |
738 |
|
(while (not (eobp)) |
739 |
|
(if (looking-at "^\\([^=]+\\)=\\(.*\\)") |
740 |
|
(cond |
741 |
|
((string= (match-string 1) "src_dir") |
742 |
|
(add-to-list 'src_dir |
743 |
|
(file-name-as-directory (match-string 2)))) |
744 |
|
((string= (match-string 1) "obj_dir") |
745 |
|
(add-to-list 'obj_dir |
746 |
|
(file-name-as-directory (match-string 2)))) |
747 |
|
((string= (match-string 1) "casing") |
748 |
|
(set 'casing (cons (match-string 2) casing))) |
749 |
|
((string= (match-string 1) "build_dir") |
750 |
|
(set 'project |
751 |
|
(plist-put project 'build_dir |
752 |
|
(file-name-as-directory (match-string 2))))) |
753 |
|
((string= (match-string 1) "make_cmd") |
754 |
|
(add-to-list 'make_cmd (match-string 2))) |
755 |
|
((string= (match-string 1) "comp_cmd") |
756 |
|
(add-to-list 'comp_cmd (match-string 2))) |
757 |
|
((string= (match-string 1) "check_cmd") |
758 |
|
(add-to-list 'check_cmd (match-string 2))) |
759 |
|
((string= (match-string 1) "run_cmd") |
760 |
|
(add-to-list 'run_cmd (match-string 2))) |
761 |
|
((string= (match-string 1) "debug_pre_cmd") |
762 |
|
(add-to-list 'debug_pre_cmd (match-string 2))) |
763 |
|
((string= (match-string 1) "debug_post_cmd") |
764 |
|
(add-to-list 'debug_post_cmd (match-string 2))) |
765 |
|
(t |
766 |
|
(set 'project (plist-put project (intern (match-string 1)) |
767 |
|
(match-string 2)))))) |
768 |
|
(forward-line 1)) |
769 |
|
|
770 |
;; Now overrides these values with the project file |
(if src_dir (set 'project (plist-put project 'src_dir |
771 |
(while (not (eobp)) |
(reverse src_dir)))) |
772 |
(if (looking-at "^\\([^=]+\\)=\\(.*\\)") |
(if obj_dir (set 'project (plist-put project 'obj_dir |
773 |
(cond |
(reverse obj_dir)))) |
774 |
((string= (match-string 1) "src_dir") |
(if casing (set 'project (plist-put project 'casing |
775 |
(add-to-list 'src_dir |
(reverse casing)))) |
776 |
(file-name-as-directory (match-string 2)))) |
(if make_cmd (set 'project (plist-put project 'make_cmd |
777 |
((string= (match-string 1) "obj_dir") |
(reverse make_cmd)))) |
778 |
(add-to-list 'obj_dir |
(if comp_cmd (set 'project (plist-put project 'comp_cmd |
779 |
(file-name-as-directory (match-string 2)))) |
(reverse comp_cmd)))) |
780 |
((string= (match-string 1) "casing") |
(if check_cmd (set 'project (plist-put project 'check_cmd |
781 |
(set 'casing (cons (match-string 2) casing))) |
(reverse check_cmd)))) |
782 |
((string= (match-string 1) "build_dir") |
(if run_cmd (set 'project (plist-put project 'run_cmd |
783 |
(set 'project |
(reverse run_cmd)))) |
784 |
(plist-put project 'build_dir |
(set 'project (plist-put project 'debug_post_cmd |
785 |
(file-name-as-directory (match-string 2))))) |
(reverse debug_post_cmd))) |
|
((string= (match-string 1) "make_cmd") |
|
|
(add-to-list 'make_cmd (match-string 2))) |
|
|
((string= (match-string 1) "comp_cmd") |
|
|
(add-to-list 'comp_cmd (match-string 2))) |
|
|
((string= (match-string 1) "check_cmd") |
|
|
(add-to-list 'check_cmd (match-string 2))) |
|
|
((string= (match-string 1) "run_cmd") |
|
|
(add-to-list 'run_cmd (match-string 2))) |
|
|
((string= (match-string 1) "debug_pre_cmd") |
|
|
(add-to-list 'debug_pre_cmd (match-string 2))) |
|
|
((string= (match-string 1) "debug_post_cmd") |
|
|
(add-to-list 'debug_post_cmd (match-string 2))) |
|
|
(t |
|
|
(set 'project (plist-put project (intern (match-string 1)) |
|
|
(match-string 2)))))) |
|
|
(forward-line 1)) |
|
|
|
|
|
(if src_dir (set 'project (plist-put project 'src_dir |
|
|
(reverse src_dir)))) |
|
|
(if obj_dir (set 'project (plist-put project 'obj_dir |
|
|
(reverse obj_dir)))) |
|
|
(if casing (set 'project (plist-put project 'casing |
|
|
(reverse casing)))) |
|
|
(if make_cmd (set 'project (plist-put project 'make_cmd |
|
|
(reverse make_cmd)))) |
|
|
(if comp_cmd (set 'project (plist-put project 'comp_cmd |
|
|
(reverse comp_cmd)))) |
|
|
(if check_cmd (set 'project (plist-put project 'check_cmd |
|
|
(reverse check_cmd)))) |
|
|
(if run_cmd (set 'project (plist-put project 'run_cmd |
|
|
(reverse run_cmd)))) |
|
|
(set 'project (plist-put project 'debug_post_cmd |
|
|
(reverse debug_post_cmd))) |
|
786 |
(set 'project (plist-put project 'debug_pre_cmd |
(set 'project (plist-put project 'debug_pre_cmd |
787 |
(reverse debug_pre_cmd))) |
(reverse debug_pre_cmd))) |
788 |
|
|
835 |
|
|
836 |
;; Add the directories to the search path for ff-find-other-file |
;; Add the directories to the search path for ff-find-other-file |
837 |
;; Do not add the '/' or '\' at the end |
;; Do not add the '/' or '\' at the end |
838 |
(setq ada-search-directories |
(setq ada-search-directories-internal |
839 |
(append (mapcar 'directory-file-name compilation-search-path) |
(append (mapcar 'directory-file-name compilation-search-path) |
840 |
ada-search-directories)) |
ada-search-directories)) |
841 |
|
|
907 |
(concat "'\"" (substring entity 1 -1) "\"'")) |
(concat "'\"" (substring entity 1 -1) "\"'")) |
908 |
entity)) |
entity)) |
909 |
(switches (ada-xref-get-project-field 'gnatfind_opt)) |
(switches (ada-xref-get-project-field 'gnatfind_opt)) |
910 |
(command (concat "gnatfind " switches " " |
(command (concat "gnat find " switches " " |
911 |
quote-entity |
quote-entity |
912 |
(if file (concat ":" (file-name-nondirectory file))) |
(if file (concat ":" (file-name-nondirectory file))) |
913 |
(if line (concat ":" line)) |
(if line (concat ":" line)) |
919 |
;; If a project file is defined, use it |
;; If a project file is defined, use it |
920 |
(if (and ada-prj-default-project-file |
(if (and ada-prj-default-project-file |
921 |
(not (string= ada-prj-default-project-file ""))) |
(not (string= ada-prj-default-project-file ""))) |
922 |
(setq command (concat command " -p" ada-prj-default-project-file))) |
(if (string-equal (file-name-extension ada-prj-default-project-file) |
923 |
|
"gpr") |
924 |
|
(setq command (concat command " -P" ada-prj-default-project-file)) |
925 |
|
(setq command (concat command " -p" ada-prj-default-project-file)))) |
926 |
|
|
927 |
(if (and append (get-buffer "*gnatfind*")) |
(if (and append (get-buffer "*gnatfind*")) |
928 |
(save-excursion |
(save-excursion |
2236 |
"Function called by `ada-mode-hook' to initialize the ada-xref.el package. |
"Function called by `ada-mode-hook' to initialize the ada-xref.el package. |
2237 |
For instance, it creates the gnat-specific menus, sets some hooks for |
For instance, it creates the gnat-specific menus, sets some hooks for |
2238 |
find-file...." |
find-file...." |
|
(make-local-hook 'ff-file-created-hooks) |
|
2239 |
;; This should really be an `add-hook'. -stef |
;; This should really be an `add-hook'. -stef |
2240 |
(setq ff-file-created-hooks 'ada-make-body-gnatstub) |
(setq ff-file-created-hook 'ada-make-body-gnatstub) |
2241 |
|
|
2242 |
;; Completion for file names in the mini buffer should ignore .ali files |
;; Completion for file names in the mini buffer should ignore .ali files |
2243 |
(add-to-list 'completion-ignored-extensions ".ali") |
(add-to-list 'completion-ignored-extensions ".ali") |
2267 |
(ada-initialize-runtime-library "") |
(ada-initialize-runtime-library "") |
2268 |
|
|
2269 |
;; Add these standard directories to the search path |
;; Add these standard directories to the search path |
2270 |
(set 'ada-search-directories |
(set 'ada-search-directories-internal |
2271 |
(append (mapcar 'directory-file-name ada-xref-runtime-library-specs-path) |
(append (mapcar 'directory-file-name ada-xref-runtime-library-specs-path) |
2272 |
ada-search-directories)) |
ada-search-directories)) |
2273 |
|
|