aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/ada-prj.el
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2002-06-20 17:17:32 +0000
committerStefan Monnier <[email protected]>2002-06-20 17:17:32 +0000
commit61c08d00ad3c26c732d3bbb28dd9b2c436ca0c00 (patch)
treec49e1c1cebb773ae03e077d750c6b4a4f339c39b /lisp/progmodes/ada-prj.el
parenta63fa26f4d70b75b0aa223b2ed916bc7775da232 (diff)
Update copyright. Improve `revision' info.
(ada-prj-load-directory): Make sure we do not use one of the new Emacs 21 dialogs to select the file, since we want a directory name only. (ada-customize): Add support for the new GNAT project files.
Diffstat (limited to 'lisp/progmodes/ada-prj.el')
-rw-r--r--lisp/progmodes/ada-prj.el76
1 files changed, 45 insertions, 31 deletions
diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el
index a3f4027e9e..09ec600486 100644
--- a/lisp/progmodes/ada-prj.el
+++ b/lisp/progmodes/ada-prj.el
@@ -1,9 +1,10 @@
;;; ada-prj.el --- easy editing of project files for the ada-mode
-;; Copyright (C) 1998, 99, 2000, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 99, 2000, 2001, 2002
+;; Free Software Foundation, Inc.
;; Author: Emmanuel Briot <[email protected]>
-;; Ada Core Technologies's version: $Revision: 1.53 $
+;; Ada Core Technologies's version: Revision: 1.55.2.2 (GNAT 3.15)
;; Keywords: languages, ada, project file
;; This file is part of GNU Emacs.
@@ -81,12 +82,9 @@
"Editing the project file associated with the current Ada buffer.
If there is none, opens a new project file"
(interactive)
- (let ((file (ada-prj-find-prj-file)))
- (if file
- (progn
- (ada-reread-prj-file file)
- (ada-customize))
- (ada-prj-new))))
+ (if ada-prj-default-project-file
+ (ada-customize)
+ (ada-prj-new)))
(defun ada-prj-add-keymap ()
"Add new keybindings for ada-prj."
@@ -236,8 +234,12 @@ If the current value of FIELD is the default value, returns an empty string."
(defun ada-prj-load-directory (field &optional file-name)
"Append the content of FILE-NAME to FIELD in the current project file.
If FILE-NAME is nil, ask the user for the name."
- (unless file-name
- (set 'file-name (read-file-name "Root directory: " nil nil t)))
+
+ ;; Do not use an external dialog for this, since it wouldn't allow
+ ;; the user to select a directory
+ (let ((use-dialog-box nil))
+ (unless file-name
+ (set 'file-name (read-file-name "Root directory: " nil nil t))))
(set 'ada-prj-current-values
(plist-put ada-prj-current-values
@@ -500,27 +502,41 @@ If FILENAME is given, edit that file."
(let ((ada-buffer (current-buffer))
(inhibit-read-only t))
- (ada-require-project-file)
-
- (switch-to-buffer "*Customize Ada Mode*")
- (kill-all-local-variables)
+ ;; We can only edit interactively the standard ada-mode project files. If
+ ;; the user is using other formats for the project file (through hooks in
+ ;; `ada-load-project-hook', we simply edit the file
- (ada-xref-set-default-prj-values 'ada-prj-default-values ada-buffer)
- (ada-prj-initialize-values 'ada-prj-current-values ada-buffer filename)
-
- (set (make-local-variable 'ada-prj-ada-buffer) ada-buffer)
-
- (use-local-map (copy-keymap custom-mode-map))
- (local-set-key "\C-x\C-s" 'ada-prj-save)
-
- (make-local-variable 'widget-keymap)
- (define-key widget-keymap "\C-x\C-s" 'ada-prj-save)
-
- (set (make-local-variable 'ada-old-cross-prefix)
- (ada-xref-get-project-field 'cross-prefix))
+ (if (and (not new-file)
+ (or ada-prj-default-project-file filename)
+ (string= (file-name-extension
+ (or filename ada-prj-default-project-file))
+ "gpr"))
+ (progn
+ (find-file ada-prj-default-project-file)
+ (add-hook 'after-save-hook 'ada-reread-prj-file t t)
+ )
- (ada-prj-display-page 1)
- ))
+ ;; Else start the interactive editor
+ (switch-to-buffer "*Customize Ada Mode*")
+ (kill-all-local-variables)
+
+ (ada-xref-set-default-prj-values 'ada-prj-default-values ada-buffer)
+ (ada-prj-initialize-values
+ 'ada-prj-current-values ada-buffer filename)
+
+ (set (make-local-variable 'ada-prj-ada-buffer) ada-buffer)
+
+ (use-local-map (copy-keymap custom-mode-map))
+ (local-set-key "\C-x\C-s" 'ada-prj-save)
+
+ (make-local-variable 'widget-keymap)
+ (define-key widget-keymap "\C-x\C-s" 'ada-prj-save)
+
+ (set (make-local-variable 'ada-old-cross-prefix)
+ (ada-xref-get-project-field 'cross-prefix))
+
+ (ada-prj-display-page 1)
+ )))
;; ---------------- Utilities --------------------------------
@@ -544,8 +560,6 @@ If ADA-FILE is nil, returns the project file for the current buffer."
(setq ada-file (buffer-file-name)))
(save-excursion
- (set-buffer (get-file-buffer ada-file))
-
(let ((prj-file (ada-prj-find-prj-file t)))
(if (or (not prj-file)
(not (file-exists-p prj-file))