annotate lisp/progmodes/ada-prj.el @ 29596:c3845ffcb423

Convert all tibetan-1-column characters to the corresponding tibetan characters. (tibetan-add-components): Delete code for the special treatment of 'a chung.
author Kenichi Handa <handa@m17n.org>
date Mon, 12 Jun 2000 06:11:56 +0000
parents 1be4a89d81d3
children 01ac16657214
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
1 ;;; @(#) ada-prj.el --- Easy editing of project files for the ada-mode
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
3 ;; Copyright (C) 1998,1999 Free Software Foundation, Inc.
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
4
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5 ;; Author: Emmanuel Briot <briot@gnat.com>
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
6 ;; Ada Core Technologies's version: $Revision: 1.30 $
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
7 ;; Keywords: languages, ada, project file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9 ;; This file is not part of GNU Emacs.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
10
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; This program is free software; you can redistribute it and/or modify
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14 ;; any later version.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; This program is distributed in the hope that it will be useful,
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26 ;;; This package provides a set of functions to easily edit the project
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 ;;; files used by the ada-mode.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28 ;;; The only function publicly available here is `ada-prj-customize'.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;;; Please ada-mode.el and its documentation for more information about the
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30 ;;; project files.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 ;;;
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 ;;; You need Emacs >= 20.2 to run this package
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 ;; Code:
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37 ;; ----- Requirements -----------------------------------------------------
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 (require 'cus-edit)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42 ;; ----- Buffer local variables -------------------------------------------
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
43 ;; if non nil, then all the widgets will have the default values, instead
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 ;; of reading them from the project file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 (make-variable-buffer-local (defvar ada-prj-edit-use-default-values nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 ;; List of the default values used for the field in the project file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 ;; Mainly used to save only the modified fields into the file itself
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49 ;; The values are hold in the properties of this variable
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
50 (make-variable-buffer-local (defvar ada-prj-default nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 (make-variable-buffer-local (defvar ada-prj-widget-prj-dir nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 (make-variable-buffer-local (defvar ada-prj-widget-src-dir nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (make-variable-buffer-local (defvar ada-prj-widget-obj-dir nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 (make-variable-buffer-local (defvar ada-prj-widget-main nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 (make-variable-buffer-local (defvar ada-prj-widget-comp-opt nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57 (make-variable-buffer-local (defvar ada-prj-widget-bind-opt nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 (make-variable-buffer-local (defvar ada-prj-widget-link-opt nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (make-variable-buffer-local (defvar ada-prj-widget-remote-machine nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 (make-variable-buffer-local (defvar ada-prj-widget-comp-cmd nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 (make-variable-buffer-local (defvar ada-prj-widget-make-cmd nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 (make-variable-buffer-local (defvar ada-prj-widget-run-cmd nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 (make-variable-buffer-local (defvar ada-prj-widget-debug-cmd nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (make-variable-buffer-local (defvar ada-prj-widget-cross-prefix nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 ;; ------ Functions -------------------------------------------------------
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 (defun ada-prj-add-ada-menu ()
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
69 "Add a new submenu to the Ada menu."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (interactive)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 (if ada-xemacs
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (progn
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 (add-menu-button '("Ada" "Project") ["New/Edit" ada-customize t] "Associate")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (let ((prj-menu (lookup-key ada-mode-map [menu-bar Ada Project])))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (define-key prj-menu [New] '("New/Edit" . ada-customize)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 ))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (defun ada-prj-add-keymap ()
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
81 "Add new keybindings for ada-prj."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (define-key ada-mode-map "\C-cu" 'ada-customize))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (defun ada-customize (&optional new-file)
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
85 "Edit the project file associated with the current buffer.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
86 If there is none or NEW-FILE is non-nil, make a new one."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (interactive)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 (if new-file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (progn
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (setq ada-prj-edit-use-default-values t)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 (kill-local-variable 'ada-prj-prj-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (ada-prj-customize)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 (setq ada-prj-edit-use-default-values nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (ada-prj-customize)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (defun ada-prj-save ()
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
97 "Save the currently edited project file."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (interactive)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (let ((file-name (widget-value ada-prj-widget-prj-dir))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 value output)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (setq output
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (concat
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (ada-prj-set-list "src_dir" (widget-value ada-prj-widget-src-dir))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 "\n"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (ada-prj-set-list "obj_dir" (widget-value ada-prj-widget-obj-dir))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 "\n"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 (unless (string= (setq value (widget-value ada-prj-widget-comp-opt))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (get 'ada-prj-default 'comp_opt))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (concat "comp_opt=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (unless (string= (setq value (widget-value ada-prj-widget-bind-opt))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (get 'ada-prj-default 'bind_opt))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 (concat "bind_opt=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (unless (string= (setq value (widget-value ada-prj-widget-link-opt))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 (get 'ada-prj-default 'link_opt))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (concat "link_opt=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 (unless (string= (setq value (widget-value ada-prj-widget-main))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 (get 'ada-prj-default 'main))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 (concat "main=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 (unless (string= (setq value (widget-value ada-prj-widget-cross-prefix))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (get 'ada-prj-default 'cross-prefix))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (concat "cross_prefix=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (unless (string= (setq value (widget-value ada-prj-widget-remote-machine))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 (get 'ada-prj-default 'remote-machine))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (concat "remote_machine=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (unless (string= (setq value (widget-value ada-prj-widget-comp-cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (get 'ada-prj-default 'comp_cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (concat "comp_cmd=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (unless (string= (setq value (widget-value ada-prj-widget-make-cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 (get 'ada-prj-default 'make_cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 (concat "make_cmd=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (unless (string= (setq value (widget-value ada-prj-widget-run-cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 (get 'ada-prj-default 'run_cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (concat "run_cmd=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (unless (string= (setq value (widget-value ada-prj-widget-debug-cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (get 'ada-prj-default 'debug_cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136 (concat "debug_cmd=" value "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
137 ))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138 (find-file file-name)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
139 (erase-buffer)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
140 (insert output)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
141 (save-buffer)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
142 ;; kill the project buffer
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
143 (kill-buffer nil)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
145 ;; kill the editor buffer
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
146 (kill-buffer "*Customize Ada Mode*")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
147
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
148 ;; automatically associates the current buffer with the
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
149 ;; new project file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
150 (make-local-variable 'ada-prj-prj-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
151 (setq ada-prj-prj-file file-name)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
152
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
153 ;; force emacs to reread the project files
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
154 (ada-reread-prj-file t)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
155 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
156 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
157
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
158 (defun ada-prj-customize ()
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
159 "Edit the project file associated with the current Ada buffer."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
160 (let* ((old-name (buffer-file-name))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
161 prj-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
162
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
163 (unless old-name
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
164 (error
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
165 "No file name given for this buffer ! You need to open a file first"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
166
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
167 ;; Find the project file associated with the buffer
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
168 (setq prj-file (ada-prj-get-prj-dir old-name))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
169
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
170 (switch-to-buffer "*Customize Ada Mode*")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
171 (kill-all-local-variables)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
172
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
173 ;; Find the default values
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
174 (setq ada-prj-default nil)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 (put 'ada-prj-default 'src_dir (list (file-name-directory old-name)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
176 (put 'ada-prj-default 'obj_dir (list (file-name-directory old-name)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
177 (put 'ada-prj-default 'comp_opt "")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
178 (put 'ada-prj-default 'bind_opt "")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
179 (put 'ada-prj-default 'link_opt "")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
180 (put 'ada-prj-default 'main "")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
181 (put 'ada-prj-default 'cross_prefix "")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
182 (put 'ada-prj-default 'remote_machine "")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
183 (put 'ada-prj-default 'comp_cmd
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
184 (concat "cd " (file-name-directory old-name) " && "
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
185 ada-prj-default-comp-cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
186 (put 'ada-prj-default 'make_cmd
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
187 (concat "cd " (file-name-directory old-name) " && "
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
188 ada-prj-default-make-cmd))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
189 (put 'ada-prj-default 'run_cmd (if is-windows "${main}.exe" "${main}"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
190 (put 'ada-prj-default 'debug_cmd
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
191 (if is-windows "${cross_prefix}gdb ${main}.exe"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
192 "${cross_prefix}gdb ${main}"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
193
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
194 (let ((inhibit-read-only t))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
195 (erase-buffer))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
196
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
197 ;;; Overlay-lists is not defined on XEmacs
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
198 (if (fboundp 'overlay-lists)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
199 (let ((all (overlay-lists)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
200 ;; Delete all the overlays.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
201 (mapcar 'delete-overlay (car all))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
202 (mapcar 'delete-overlay (cdr all))))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
203
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
204 (use-local-map (copy-keymap custom-mode-map))
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
205 (local-set-key "\C-x\C-s" 'ada-prj-save)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
206
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
207 (widget-insert "
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
208 ----------------------------------------------------------------
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
209 -- Customize your Emacs Ada mode for the current application --
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
210 ----------------------------------------------------------------
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
211 This buffer will allow you to create easily a project file for your application.
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
212 This file will tell Emacs where to find the ada sources, the cross-referencing
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
213 informations, how to compile and run your application, ...
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
214
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
215 Please use the RETURN key, or middle mouse button to activate the fields.\n\n")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
216
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
217 ;; Reset Button
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
218 (widget-create 'push-button
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
219 :notify (lambda (&rest ignore)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
220 (setq ada-prj-edit-use-default-values t)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
221 (kill-buffer nil)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
222 (ada-prj-customize)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
223 (setq ada-prj-edit-use-default-values nil)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
224 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
225 "Reset to Default Values")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
226 (widget-insert "\n")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
227
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
228
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
229 ;; Create local variables with their initial value
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
230 (setq ada-prj-widget-prj-dir
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
231 (ada-prj-new 'ada-prj-widget-prj-dir nil "" prj-file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
232 "\nName and directory of the project file.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
233 Put a new name here if you want to create a new project file\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
234
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
235 (setq ada-prj-widget-src-dir
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
236 (ada-prj-list 'ada-prj-widget-src-dir prj-file "src_dir"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
237 (get 'ada-prj-default 'src_dir)
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
238 "\nYou should enter below all the directories where Emacs
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
239 will find your ada sources for the current application\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
240
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
241 (setq ada-prj-widget-obj-dir
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
242 (ada-prj-list 'ada-prj-widget-obj-dir prj-file "obj_dir"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
243 (get 'ada-prj-default 'obj_dir)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
244 "\nBelow are the directories where the object files generated
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
245 by the compiler will be found. This files are required for the cross-referencing
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
246 capabilities of the Emacs' Ada-mode.\n"))
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
247
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
248 (setq ada-prj-widget-comp-opt
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
249 (ada-prj-new 'ada-prj-widget-comp-opt prj-file "comp_opt"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
250 (get 'ada-prj-default 'comp_opt)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
251 "\nPut below the compiler switches.\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
252
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
253 (setq ada-prj-widget-bind-opt
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
254 (ada-prj-new 'ada-prj-widget-bind-opt prj-file "bind_opt"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
255 (get 'ada-prj-default 'bind_opt)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
256 "\nPut below the binder switches.\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
257
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
258 (setq ada-prj-widget-link-opt
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
259 (ada-prj-new 'ada-prj-widget-link-opt prj-file "link_opt"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
260 (get 'ada-prj-default 'link_opt)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
261 "\nPut below the linker switches.\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
262
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
263 (setq ada-prj-widget-main
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
264 (ada-prj-new 'ada-prj-widget-main prj-file "main"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
265 (file-name-sans-extension old-name)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
266 "\nPut below the name of the main program for your application\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
267
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
268 (setq ada-prj-widget-cross-prefix
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
269 (ada-prj-new 'ada-prj-widget-cross-prefix prj-file "cross_prefix"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
270 (get 'ada-prj-default 'cross_prefix)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
271 "\nIf you are using a cross compiler, you might want to
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
272 set the following variable so that the correct compiler is used by default\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
273
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
274 (setq ada-prj-widget-remote-machine
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
275 (ada-prj-new 'ada-prj-widget-remote-machine prj-file "remote_machine"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
276 (get 'ada-prj-default 'remote_machine)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
277 "\nName of the machine to log on before a compilation.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
278 Leave an empty field if you want to compile on the local machine.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
279 This will not work on Windows NT, since we only do a 'rsh' to the
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
280 remote machine and then issue the command. \n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
281
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
282 (widget-insert "\n
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
283 -------------------------------------------------------------------------------
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
284 / \\ !! Advanced Users !! : For the following commands, you may use
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
285 / | \\ a somewhat more complicated syntax to describe them. If you
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
286 / | \\ use some special fields, they will be replaced at run-time by
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
287 / | \\ the variables defined above.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
288 / | \\ These special fields are : ${remote_machine}
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
289 / o \\ -aI${src_dir} -I${src_dir} -aO${obj_dir} ${comp_opt}
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
290 ------------- ${bind_opt} ${link_opt} ${main} ${cross_prefix}
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
291
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
292 The easiest way is to ignore this possibility. These fields are intended only
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
293 for user who really understand what `variable substitution' means.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
294 -------------------------------------------------------------------------------\n")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
295
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
296 (setq ada-prj-widget-comp-cmd
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
297 (ada-prj-new 'ada-prj-widget-comp-cmd prj-file "comp_cmd"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
298 (get 'ada-prj-default 'comp_cmd)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
299 "\nPut below the command used to compile ONE file.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
300 The name of the file to compile will be added at the end of the command.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
301 This command will also be used to check the file.\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
302
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
303 (setq ada-prj-widget-make-cmd
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
304 (ada-prj-new 'ada-prj-widget-make-cmd prj-file "make_cmd"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
305 (get 'ada-prj-default 'make_cmd)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
306 "\nPut below the command used to compile the whole application.\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
307
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
308 (setq ada-prj-widget-run-cmd
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
309 (ada-prj-new 'ada-prj-widget-run-cmd prj-file "run_cmd"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
310 (get 'ada-prj-default 'run_cmd)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
311 "\nPut below the command used to run your application.\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
312
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
313 (setq ada-prj-widget-debug-cmd
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
314 (ada-prj-new 'ada-prj-widget-run-cmd prj-file "debug_cmd"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
315 (get 'ada-prj-default 'debug_cmd)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
316 "\nPut below the command used to launch the debugger on your application.\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
317
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
318 ;; the two buttons to validate or cancel the modification
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
319 (widget-insert "\nWhen you have finish completing the above fields, choose one of the two buttons
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
320 below, to validate or cancel your modifications.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
321 If you choose `OK', your settings will be saved to the file whose name is given above.\n")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
322
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
323 (widget-create 'push-button
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
324 :notify (lambda (&rest ignore) (ada-prj-save))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
325 "OK")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
326
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
327 (widget-insert " ")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
328 (widget-create 'push-button
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
329 :notify (lambda (&rest ignore)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
330 (kill-buffer nil))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
331 "Cancel")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
332 (widget-insert "\n")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
333
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
334
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
335 ;; if it exists, kill the project file buffer
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
336 (if (and prj-file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
337 (get-file-buffer prj-file))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
338 (kill-buffer (get-file-buffer prj-file)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
339
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
340 (widget-setup)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
341 (beginning-of-buffer)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
342 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
343 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
344
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
345
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
346 ;; ---------------- Utilities --------------------------------
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
347
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
348 (defun ada-prj-new (variable prj-file text default message)
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
349 "Create a buffer-local variable with name VARIABLE.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
350 If PRJ-FILE exists, read its value from that file, otherwise set it to
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
351 DEFAULT.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
352 It also creates a widget in the current buffer to edit this variable,
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
353 which MESSAGE explaning what the variable is supposed to do.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
354 TEXT is put just before the editable field, and should display the name
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
355 of the variable."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
356
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
357 ;; create local variable
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
358 (make-local-variable variable)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
359 (let ((value default)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
360 (regexp (concat "^" text "=\\(.*\\)")))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
361 ;; if the project file exists
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
362 (if (and prj-file (not ada-prj-edit-use-default-values)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
363 (file-readable-p prj-file))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
364 ;; find the value
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
365 (save-excursion
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
366 (find-file prj-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
367 (beginning-of-buffer)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
368 (if (re-search-forward regexp nil t)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
369 (setq value (match-string 1)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
370 ))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
371 ;; assign a new value to the variable
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
372 (setq variable value))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
373
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
374 (widget-insert message)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
375
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
376 (widget-create 'editable-field
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
377 :format (if (string= text "") "%v"
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
378 (concat text "= %v"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
379 :keymap widget-keymap
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
380 variable))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
381
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
382
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
383 (defun ada-prj-list (variable prj-file text default message)
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
384 "Create a buffer-local list variable with name VARIABLE.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
385 If PRJ-FILE exists, read its value from that file, otherwise set it to
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
386 DEFAULT.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
387 It also creates a widget in the current buffer to edit this variable,
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
388 which MESSAGE explaning what the variable is supposed to do.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
389 TEXT is put just before the editable field, and should display the name
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
390 of the variable."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
391
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
392 ;; create local variable
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
393 (make-local-variable variable)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
394 (let ((value nil)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
395 (regexp (concat "^" text "=\\(.*\\)")))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
396 ;; if the project file exists
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
397 (if (and prj-file (not ada-prj-edit-use-default-values)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
398 (file-readable-p prj-file))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
399 ;; find the value
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
400 (save-excursion
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
401 (find-file prj-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
402 (goto-char (point-min))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
403 ;; for each line, add its value
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
404 (while
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
405 (re-search-forward regexp nil t)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
406 (progn
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
407 (setq value (cons (match-string 1) value)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
408 )))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
409
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
410 ;; assign a new value to the variable
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
411 (setq variable
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
412 (if value (reverse value) default)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
413
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
414 (widget-insert message)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
415 (widget-create 'editable-list
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
416 :entry-format (concat text "= %i %d %v")
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
417 :value variable
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
418 (list 'editable-field :keymap widget-keymap)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
419
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
420 (defsubst ada-prj-set-list (string ada-dir-list)
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
421 "Join the strings in ADA-DIR-LIST into a single string. Each name is put
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
422 on a separate line that begins with STRING."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
423 (mapconcat (lambda (x)
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
424 (concat string "=" x
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
425 (unless (string= (substring x -1) "/")
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
426 "/")))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
427 ada-dir-list "\n"))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
428
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
429 (defun ada-prj-get-prj-dir (&optional ada-file)
26227
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
430 "Returns the directory/name of the project file for ADA-FILE.
1be4a89d81d3 Doc-string fixes.
Gerd Moellmann <gerd@gnu.org>
parents: 25901
diff changeset
431 If ADA-FILE is nil, returns the project file for the current buffer."
25901
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
432 (unless ada-file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
433 (setq ada-file (buffer-file-name)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
434
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
435 (save-excursion
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
436 (set-buffer (get-file-buffer ada-file))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
437 (if ada-prj-edit-use-default-values
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
438 (concat (file-name-sans-extension ada-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
439 ada-project-file-extension)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
440
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
441 (let ((prj-file (ada-prj-find-prj-file t)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
442 (if (or (not prj-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
443 (not (file-exists-p prj-file))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
444 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
445 (setq prj-file
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
446 (concat (file-name-sans-extension ada-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
447 ada-project-file-extension)))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
448 prj-file)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
449 ))
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
450 )
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
451
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
452
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
453 ;; Initializations for the package
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
454 (add-hook 'ada-mode-hook 'ada-prj-add-ada-menu)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
455
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
456 ;; Set the keymap once and for all, so that the keys set by the user in his
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
457 ;; config file are not overwritten every time we open a new file.
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
458 (ada-prj-add-keymap)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
459
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
460 (provide 'ada-prj)
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
461 ;;; package ada-prj.el ends here
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
462
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
463
9f327fa7ac10 New file.
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
464