diff options
| author | Stefan Monnier | 2002-06-20 17:17:32 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-06-20 17:17:32 +0000 |
| commit | 61c08d00ad3c26c732d3bbb28dd9b2c436ca0c00 (patch) | |
| tree | c49e1c1cebb773ae03e077d750c6b4a4f339c39b | |
| parent | a63fa26f4d70b75b0aa223b2ed916bc7775da232 (diff) | |
| download | emacs-61c08d00ad3c26c732d3bbb28dd9b2c436ca0c00.tar.gz emacs-61c08d00ad3c26c732d3bbb28dd9b2c436ca0c00.zip | |
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.
| -rw-r--r-- | lisp/progmodes/ada-prj.el | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el index a3f4027e9e7..09ec600486e 100644 --- a/lisp/progmodes/ada-prj.el +++ b/lisp/progmodes/ada-prj.el | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | ;;; ada-prj.el --- easy editing of project files for the ada-mode | 1 | ;;; ada-prj.el --- easy editing of project files for the ada-mode |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 99, 2000, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 99, 2000, 2001, 2002 |
| 4 | ;; Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | ;; Author: Emmanuel Briot <briot@gnat.com> | 6 | ;; Author: Emmanuel Briot <briot@gnat.com> |
| 6 | ;; Ada Core Technologies's version: $Revision: 1.53 $ | 7 | ;; Ada Core Technologies's version: Revision: 1.55.2.2 (GNAT 3.15) |
| 7 | ;; Keywords: languages, ada, project file | 8 | ;; Keywords: languages, ada, project file |
| 8 | 9 | ||
| 9 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| @@ -81,12 +82,9 @@ | |||
| 81 | "Editing the project file associated with the current Ada buffer. | 82 | "Editing the project file associated with the current Ada buffer. |
| 82 | If there is none, opens a new project file" | 83 | If there is none, opens a new project file" |
| 83 | (interactive) | 84 | (interactive) |
| 84 | (let ((file (ada-prj-find-prj-file))) | 85 | (if ada-prj-default-project-file |
| 85 | (if file | 86 | (ada-customize) |
| 86 | (progn | 87 | (ada-prj-new))) |
| 87 | (ada-reread-prj-file file) | ||
| 88 | (ada-customize)) | ||
| 89 | (ada-prj-new)))) | ||
| 90 | 88 | ||
| 91 | (defun ada-prj-add-keymap () | 89 | (defun ada-prj-add-keymap () |
| 92 | "Add new keybindings for ada-prj." | 90 | "Add new keybindings for ada-prj." |
| @@ -236,8 +234,12 @@ If the current value of FIELD is the default value, returns an empty string." | |||
| 236 | (defun ada-prj-load-directory (field &optional file-name) | 234 | (defun ada-prj-load-directory (field &optional file-name) |
| 237 | "Append the content of FILE-NAME to FIELD in the current project file. | 235 | "Append the content of FILE-NAME to FIELD in the current project file. |
| 238 | If FILE-NAME is nil, ask the user for the name." | 236 | If FILE-NAME is nil, ask the user for the name." |
| 239 | (unless file-name | 237 | |
| 240 | (set 'file-name (read-file-name "Root directory: " nil nil t))) | 238 | ;; Do not use an external dialog for this, since it wouldn't allow |
| 239 | ;; the user to select a directory | ||
| 240 | (let ((use-dialog-box nil)) | ||
| 241 | (unless file-name | ||
| 242 | (set 'file-name (read-file-name "Root directory: " nil nil t)))) | ||
| 241 | 243 | ||
| 242 | (set 'ada-prj-current-values | 244 | (set 'ada-prj-current-values |
| 243 | (plist-put ada-prj-current-values | 245 | (plist-put ada-prj-current-values |
| @@ -500,27 +502,41 @@ If FILENAME is given, edit that file." | |||
| 500 | (let ((ada-buffer (current-buffer)) | 502 | (let ((ada-buffer (current-buffer)) |
| 501 | (inhibit-read-only t)) | 503 | (inhibit-read-only t)) |
| 502 | 504 | ||
| 503 | (ada-require-project-file) | 505 | ;; We can only edit interactively the standard ada-mode project files. If |
| 504 | 506 | ;; the user is using other formats for the project file (through hooks in | |
| 505 | (switch-to-buffer "*Customize Ada Mode*") | 507 | ;; `ada-load-project-hook', we simply edit the file |
| 506 | (kill-all-local-variables) | ||
| 507 | 508 | ||
| 508 | (ada-xref-set-default-prj-values 'ada-prj-default-values ada-buffer) | 509 | (if (and (not new-file) |
| 509 | (ada-prj-initialize-values 'ada-prj-current-values ada-buffer filename) | 510 | (or ada-prj-default-project-file filename) |
| 510 | 511 | (string= (file-name-extension | |
| 511 | (set (make-local-variable 'ada-prj-ada-buffer) ada-buffer) | 512 | (or filename ada-prj-default-project-file)) |
| 512 | 513 | "gpr")) | |
| 513 | (use-local-map (copy-keymap custom-mode-map)) | 514 | (progn |
| 514 | (local-set-key "\C-x\C-s" 'ada-prj-save) | 515 | (find-file ada-prj-default-project-file) |
| 515 | 516 | (add-hook 'after-save-hook 'ada-reread-prj-file t t) | |
| 516 | (make-local-variable 'widget-keymap) | 517 | ) |
| 517 | (define-key widget-keymap "\C-x\C-s" 'ada-prj-save) | ||
| 518 | |||
| 519 | (set (make-local-variable 'ada-old-cross-prefix) | ||
| 520 | (ada-xref-get-project-field 'cross-prefix)) | ||
| 521 | 518 | ||
| 522 | (ada-prj-display-page 1) | 519 | ;; Else start the interactive editor |
| 523 | )) | 520 | (switch-to-buffer "*Customize Ada Mode*") |
| 521 | (kill-all-local-variables) | ||
| 522 | |||
| 523 | (ada-xref-set-default-prj-values 'ada-prj-default-values ada-buffer) | ||
| 524 | (ada-prj-initialize-values | ||
| 525 | 'ada-prj-current-values ada-buffer filename) | ||
| 526 | |||
| 527 | (set (make-local-variable 'ada-prj-ada-buffer) ada-buffer) | ||
| 528 | |||
| 529 | (use-local-map (copy-keymap custom-mode-map)) | ||
| 530 | (local-set-key "\C-x\C-s" 'ada-prj-save) | ||
| 531 | |||
| 532 | (make-local-variable 'widget-keymap) | ||
| 533 | (define-key widget-keymap "\C-x\C-s" 'ada-prj-save) | ||
| 534 | |||
| 535 | (set (make-local-variable 'ada-old-cross-prefix) | ||
| 536 | (ada-xref-get-project-field 'cross-prefix)) | ||
| 537 | |||
| 538 | (ada-prj-display-page 1) | ||
| 539 | ))) | ||
| 524 | 540 | ||
| 525 | ;; ---------------- Utilities -------------------------------- | 541 | ;; ---------------- Utilities -------------------------------- |
| 526 | 542 | ||
| @@ -544,8 +560,6 @@ If ADA-FILE is nil, returns the project file for the current buffer." | |||
| 544 | (setq ada-file (buffer-file-name))) | 560 | (setq ada-file (buffer-file-name))) |
| 545 | 561 | ||
| 546 | (save-excursion | 562 | (save-excursion |
| 547 | (set-buffer (get-file-buffer ada-file)) | ||
| 548 | |||
| 549 | (let ((prj-file (ada-prj-find-prj-file t))) | 563 | (let ((prj-file (ada-prj-find-prj-file t))) |
| 550 | (if (or (not prj-file) | 564 | (if (or (not prj-file) |
| 551 | (not (file-exists-p prj-file)) | 565 | (not (file-exists-p prj-file)) |