diff options
| author | Gerd Moellmann | 1999-10-28 11:12:54 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-10-28 11:12:54 +0000 |
| commit | eec3232e2940bf5f4b14c005d3e5b87c06c69dec (patch) | |
| tree | dde2b164b962e0295de1686ea9af9666ebfb1f33 | |
| parent | fb8abe0d110b1bf09e95f424cf608b6d40972071 (diff) | |
| download | emacs-eec3232e2940bf5f4b14c005d3e5b87c06c69dec.tar.gz emacs-eec3232e2940bf5f4b14c005d3e5b87c06c69dec.zip | |
Doc-string fixes.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/ada-prj.el | 61 | ||||
| -rw-r--r-- | lisp/progmodes/ada-xref.el | 273 |
3 files changed, 171 insertions, 169 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 12918195381..e5cc615165e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 1999-10-28 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/ada-mode.el, progmodes/ada-prj.el, | ||
| 4 | progmodes/ada-stmt.el, progmodes/ada-xref.el: Doc-string and | ||
| 5 | comment fixes. | ||
| 6 | |||
| 1 | 1999-10-27 Dave Love <fx@gnu.org> | 7 | 1999-10-27 Dave Love <fx@gnu.org> |
| 2 | 8 | ||
| 3 | * progmodes/compile.el: Checkdoc-inspired fixes. | 9 | * progmodes/compile.el: Checkdoc-inspired fixes. |
diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el index 3832c0aa20d..e23a3371155 100644 --- a/lisp/progmodes/ada-prj.el +++ b/lisp/progmodes/ada-prj.el | |||
| @@ -1,6 +1,6 @@ | |||
| 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, 1999 Ada Core Technologies, Inc | 3 | ;; Copyright (C) 1998,1999 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Emmanuel Briot <briot@gnat.com> | 5 | ;; Author: Emmanuel Briot <briot@gnat.com> |
| 6 | ;; Ada Core Technologies's version: $Revision: 1.30 $ | 6 | ;; Ada Core Technologies's version: $Revision: 1.30 $ |
| @@ -66,7 +66,7 @@ | |||
| 66 | ;; ------ Functions ------------------------------------------------------- | 66 | ;; ------ Functions ------------------------------------------------------- |
| 67 | 67 | ||
| 68 | (defun ada-prj-add-ada-menu () | 68 | (defun ada-prj-add-ada-menu () |
| 69 | "Add a new submenu to the Ada menu" | 69 | "Add a new submenu to the Ada menu." |
| 70 | (interactive) | 70 | (interactive) |
| 71 | 71 | ||
| 72 | (if ada-xemacs | 72 | (if ada-xemacs |
| @@ -78,12 +78,12 @@ | |||
| 78 | )) | 78 | )) |
| 79 | 79 | ||
| 80 | (defun ada-prj-add-keymap () | 80 | (defun ada-prj-add-keymap () |
| 81 | "Add new keybindings for ada-prj" | 81 | "Add new keybindings for ada-prj." |
| 82 | (define-key ada-mode-map "\C-cu" 'ada-customize)) | 82 | (define-key ada-mode-map "\C-cu" 'ada-customize)) |
| 83 | 83 | ||
| 84 | (defun ada-customize (&optional new-file) | 84 | (defun ada-customize (&optional new-file) |
| 85 | "Edit the project file associated with the current buffer, or | 85 | "Edit the project file associated with the current buffer. |
| 86 | a new one if none is found" | 86 | If there is none or NEW-FILE is non-nil, make a new one." |
| 87 | (interactive) | 87 | (interactive) |
| 88 | (if new-file | 88 | (if new-file |
| 89 | (progn | 89 | (progn |
| @@ -94,7 +94,7 @@ a new one if none is found" | |||
| 94 | (ada-prj-customize))) | 94 | (ada-prj-customize))) |
| 95 | 95 | ||
| 96 | (defun ada-prj-save () | 96 | (defun ada-prj-save () |
| 97 | "save the edited project file" | 97 | "Save the currently edited project file." |
| 98 | (interactive) | 98 | (interactive) |
| 99 | (let ((file-name (widget-value ada-prj-widget-prj-dir)) | 99 | (let ((file-name (widget-value ada-prj-widget-prj-dir)) |
| 100 | value output) | 100 | value output) |
| @@ -156,7 +156,7 @@ a new one if none is found" | |||
| 156 | ) | 156 | ) |
| 157 | 157 | ||
| 158 | (defun ada-prj-customize () | 158 | (defun ada-prj-customize () |
| 159 | "Edit the project file whose name is given by prj-file." | 159 | "Edit the project file associated with the current Ada buffer." |
| 160 | (let* ((old-name (buffer-file-name)) | 160 | (let* ((old-name (buffer-file-name)) |
| 161 | prj-file) | 161 | prj-file) |
| 162 | 162 | ||
| @@ -201,15 +201,15 @@ a new one if none is found" | |||
| 201 | (mapcar 'delete-overlay (car all)) | 201 | (mapcar 'delete-overlay (car all)) |
| 202 | (mapcar 'delete-overlay (cdr all)))) | 202 | (mapcar 'delete-overlay (cdr all)))) |
| 203 | 203 | ||
| 204 | (use-local-map widget-keymap) | 204 | (use-local-map (copy-keymap custom-mode-map)) |
| 205 | (local-set-key "\C-x\C-s" 'ada-prj-save) | 205 | (local-set-key "\C-x\C-s" 'ada-prj-save) |
| 206 | 206 | ||
| 207 | (widget-insert " | 207 | (widget-insert " |
| 208 | ---------------------------------------------------------------- | 208 | ---------------------------------------------------------------- |
| 209 | -- Customize your emacs ada mode for the current application -- | 209 | -- Customize your Emacs Ada mode for the current application -- |
| 210 | ---------------------------------------------------------------- | 210 | ---------------------------------------------------------------- |
| 211 | This buffer will allow you to create easily a project file for your application. | 211 | This buffer will allow you to create easily a project file for your application. |
| 212 | This file will tell emacs where to find the ada sources, the cross-referencing | 212 | This file will tell Emacs where to find the ada sources, the cross-referencing |
| 213 | informations, how to compile and run your application, ... | 213 | informations, how to compile and run your application, ... |
| 214 | 214 | ||
| 215 | Please use the RETURN key, or middle mouse button to activate the fields.\n\n") | 215 | Please use the RETURN key, or middle mouse button to activate the fields.\n\n") |
| @@ -235,7 +235,7 @@ Put a new name here if you want to create a new project file\n")) | |||
| 235 | (setq ada-prj-widget-src-dir | 235 | (setq ada-prj-widget-src-dir |
| 236 | (ada-prj-list 'ada-prj-widget-src-dir prj-file "src_dir" | 236 | (ada-prj-list 'ada-prj-widget-src-dir prj-file "src_dir" |
| 237 | (get 'ada-prj-default 'src_dir) | 237 | (get 'ada-prj-default 'src_dir) |
| 238 | "\nYou should enter below all the directories where emacs | 238 | "\nYou should enter below all the directories where Emacs |
| 239 | will find your ada sources for the current application\n")) | 239 | will find your ada sources for the current application\n")) |
| 240 | 240 | ||
| 241 | (setq ada-prj-widget-obj-dir | 241 | (setq ada-prj-widget-obj-dir |
| @@ -243,7 +243,7 @@ will find your ada sources for the current application\n")) | |||
| 243 | (get 'ada-prj-default 'obj_dir) | 243 | (get 'ada-prj-default 'obj_dir) |
| 244 | "\nBelow are the directories where the object files generated | 244 | "\nBelow are the directories where the object files generated |
| 245 | by the compiler will be found. This files are required for the cross-referencing | 245 | by the compiler will be found. This files are required for the cross-referencing |
| 246 | capabilities of the emacs ada-mode.\n")) | 246 | capabilities of the Emacs' Ada-mode.\n")) |
| 247 | 247 | ||
| 248 | (setq ada-prj-widget-comp-opt | 248 | (setq ada-prj-widget-comp-opt |
| 249 | (ada-prj-new 'ada-prj-widget-comp-opt prj-file "comp_opt" | 249 | (ada-prj-new 'ada-prj-widget-comp-opt prj-file "comp_opt" |
| @@ -346,9 +346,13 @@ If you choose `OK', your settings will be saved to the file whose name is given | |||
| 346 | ;; ---------------- Utilities -------------------------------- | 346 | ;; ---------------- Utilities -------------------------------- |
| 347 | 347 | ||
| 348 | (defun ada-prj-new (variable prj-file text default message) | 348 | (defun ada-prj-new (variable prj-file text default message) |
| 349 | "Create a buffer-local text variable, whose value is either read in | 349 | "Create a buffer-local variable with name VARIABLE. |
| 350 | the prj-file or default | 350 | If PRJ-FILE exists, read its value from that file, otherwise set it to |
| 351 | Then adds a text field (with MESSAGE), and returns the created widget" | 351 | DEFAULT. |
| 352 | It also creates a widget in the current buffer to edit this variable, | ||
| 353 | which MESSAGE explaning what the variable is supposed to do. | ||
| 354 | TEXT is put just before the editable field, and should display the name | ||
| 355 | of the variable." | ||
| 352 | 356 | ||
| 353 | ;; create local variable | 357 | ;; create local variable |
| 354 | (make-local-variable variable) | 358 | (make-local-variable variable) |
| @@ -377,9 +381,13 @@ Then adds a text field (with MESSAGE), and returns the created widget" | |||
| 377 | 381 | ||
| 378 | 382 | ||
| 379 | (defun ada-prj-list (variable prj-file text default message) | 383 | (defun ada-prj-list (variable prj-file text default message) |
| 380 | "Create a buffer-local list variable, whose value is either read in | 384 | "Create a buffer-local list variable with name VARIABLE. |
| 381 | the prj-file or default | 385 | If PRJ-FILE exists, read its value from that file, otherwise set it to |
| 382 | Then adds a list widget (with MESSAGE), and returns the created widget" | 386 | DEFAULT. |
| 387 | It also creates a widget in the current buffer to edit this variable, | ||
| 388 | which MESSAGE explaning what the variable is supposed to do. | ||
| 389 | TEXT is put just before the editable field, and should display the name | ||
| 390 | of the variable." | ||
| 383 | 391 | ||
| 384 | ;; create local variable | 392 | ;; create local variable |
| 385 | (make-local-variable variable) | 393 | (make-local-variable variable) |
| @@ -409,21 +417,18 @@ Then adds a list widget (with MESSAGE), and returns the created widget" | |||
| 409 | :value variable | 417 | :value variable |
| 410 | (list 'editable-field :keymap widget-keymap))) | 418 | (list 'editable-field :keymap widget-keymap))) |
| 411 | 419 | ||
| 412 | (defun ada-prj-set-list (string ada-dir-list) | 420 | (defsubst ada-prj-set-list (string ada-dir-list) |
| 413 | "Creates a single string of blank-separated directory names" | 421 | "Join the strings in ADA-DIR-LIST into a single string. Each name is put |
| 422 | on a separate line that begins with STRING." | ||
| 414 | (mapconcat (lambda (x) | 423 | (mapconcat (lambda (x) |
| 415 | (concat string "=" | 424 | (concat string "=" x |
| 416 | x | 425 | (unless (string= (substring x -1) "/") |
| 417 | (unless (string= | ||
| 418 | (substring x -1) | ||
| 419 | "/") | ||
| 420 | "/"))) | 426 | "/"))) |
| 421 | ada-dir-list "\n")) | 427 | ada-dir-list "\n")) |
| 422 | 428 | ||
| 423 | (defun ada-prj-get-prj-dir (&optional ada-file) | 429 | (defun ada-prj-get-prj-dir (&optional ada-file) |
| 424 | "returns a string which is the directory/name of the prj file. | 430 | "Returns the directory/name of the project file for ADA-FILE. |
| 425 | If no-standard-prj is t, do not use the default algorithm, just | 431 | If ADA-FILE is nil, returns the project file for the current buffer." |
| 426 | use a default name" | ||
| 427 | (unless ada-file | 432 | (unless ada-file |
| 428 | (setq ada-file (buffer-file-name))) | 433 | (setq ada-file (buffer-file-name))) |
| 429 | 434 | ||
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el index 5c010e50de9..dceabb7c426 100644 --- a/lisp/progmodes/ada-xref.el +++ b/lisp/progmodes/ada-xref.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;; @(#) ada-xref.el --- use Gnat for lookup and completion in Ada mode | 1 | ;; @(#) ada-xref.el --- use Gnat for lookup and completion in Ada mode |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1994-1999 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1994, 1995--1998, 1999 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de> | 5 | ;; Author: Markus Heritsch <Markus.Heritsch@studbox.uni-stuttgart.de> |
| 6 | ;; Rolf Ebert <ebert@inf.enst.fr> | 6 | ;; Rolf Ebert <ebert@inf.enst.fr> |
| @@ -43,9 +43,9 @@ | |||
| 43 | ;; frame to show the declaration | 43 | ;; frame to show the declaration |
| 44 | ;;; - `ada-compile-application': recompile your whole application, provided | 44 | ;;; - `ada-compile-application': recompile your whole application, provided |
| 45 | ;;; that a project file exists in your directory | 45 | ;;; that a project file exists in your directory |
| 46 | ;;; - `ada-run-application': run your application directly from emacs | 46 | ;;; - `ada-run-application': run your application directly from Emacs |
| 47 | ;;; - `ada-reread-prj-file': force emacs to read your project file again. | 47 | ;;; - `ada-reread-prj-file': force Emacs to read your project file again. |
| 48 | ;;; Otherwise, this file is only read the first time emacs needs some | 48 | ;;; Otherwise, this file is only read the first time Emacs needs some |
| 49 | ;;; informations, which are then kept in memory | 49 | ;;; informations, which are then kept in memory |
| 50 | ;;; - `ada-change-prj': change the prj file associated with a buffer | 50 | ;;; - `ada-change-prj': change the prj file associated with a buffer |
| 51 | ;;; - `ada-change-default-prj': change the default project file used for | 51 | ;;; - `ada-change-default-prj': change the default project file used for |
| @@ -69,26 +69,27 @@ | |||
| 69 | 69 | ||
| 70 | ;; ------ Use variables | 70 | ;; ------ Use variables |
| 71 | (defcustom ada-xref-other-buffer t | 71 | (defcustom ada-xref-other-buffer t |
| 72 | "*if non-nil then either use a buffer in the same frame or another frame. | 72 | "*If nil, always display the cross-references in the same buffer. |
| 73 | If Nil, always jump to the declaration in the same buffer" | 73 | Otherwise create either a new buffer or a new frame." |
| 74 | :type 'boolean :group 'ada) | 74 | :type 'boolean :group 'ada) |
| 75 | 75 | ||
| 76 | (defcustom ada-xref-create-ali t | 76 | (defcustom ada-xref-create-ali t |
| 77 | "*if non-nil, run gcc whenever it is needed | 77 | "*If non-nil, run gcc whenever the cross-references are not up-to-date. |
| 78 | if nil, the cross-reference mode will never run gcc" | 78 | If nil, the cross-reference mode will never run gcc." |
| 79 | :type 'boolean :group 'ada) | 79 | :type 'boolean :group 'ada) |
| 80 | 80 | ||
| 81 | (defcustom ada-xref-confirm-compile nil | 81 | (defcustom ada-xref-confirm-compile nil |
| 82 | "*if non-nil, ask for command confirmation before compiling or | 82 | "*If non-nil, always ask for user confirmation before compiling or running |
| 83 | running the application" | 83 | the application." |
| 84 | :type 'boolean :group 'ada) | 84 | :type 'boolean :group 'ada) |
| 85 | 85 | ||
| 86 | (defcustom ada-krunch-args "0" | 86 | (defcustom ada-krunch-args "0" |
| 87 | "*Maximum number of characters for filename create by gnatkr | 87 | "*Maximum number of characters for filenames created by gnatkr. |
| 88 | Set to 0, if you don't use crunched filenames." | 88 | Set to 0, if you don't use crunched filenames. This should be a string." |
| 89 | :type 'string :group 'ada) | 89 | :type 'string :group 'ada) |
| 90 | 90 | ||
| 91 | (defcustom ada-prj-default-comp-cmd "${cross_prefix}gcc -c -g -gnatq ${comp_opt} -I${src_dir}" | 91 | (defcustom ada-prj-default-comp-cmd |
| 92 | "${cross_prefix}gcc -c -g -gnatq ${comp_opt} -I${src_dir}" | ||
| 92 | "*Default command to be used to compile a single file. | 93 | "*Default command to be used to compile a single file. |
| 93 | Emacs will add the filename at the end of this command. | 94 | Emacs will add the filename at the end of this command. |
| 94 | This is the same syntax as in the project file." | 95 | This is the same syntax as in the project file." |
| @@ -103,92 +104,85 @@ This is the same syntax as in the project file." | |||
| 103 | :type 'string :group 'ada) | 104 | :type 'string :group 'ada) |
| 104 | 105 | ||
| 105 | (defcustom ada-prj-default-project-file "" | 106 | (defcustom ada-prj-default-project-file "" |
| 106 | "*Non nil means always use this project file, no matter what the | 107 | "*Name of the project file to use for every Ada file. |
| 107 | directory is. Emacs will not try to use the standard algorithm to | 108 | Emacs will not try to use the standard algorithm to find the project file if |
| 108 | find the project file. | 109 | this string is not empty." |
| 109 | Note: you can use M-<TAB> in the customization buffer for completion" | ||
| 110 | :type '(file :must-match t) :group 'ada) | 110 | :type '(file :must-match t) :group 'ada) |
| 111 | 111 | ||
| 112 | (defcustom ada-gnatstub-opts "-q -I${src_dir}" | 112 | (defcustom ada-gnatstub-opts "-q -I${src_dir}" |
| 113 | "*List of the options to pass to gnatsub when generating the body from | 113 | "*List of the options to pass to gnatsub to generate the body of a package. |
| 114 | a spec file. This has the same syntax as in the project file (with | 114 | This has the same syntax as in the project file (with variable substitution)." |
| 115 | variable substitution" | ||
| 116 | :type 'string :group 'ada) | 115 | :type 'string :group 'ada) |
| 117 | 116 | ||
| 118 | (defcustom ada-always-ask-project nil | 117 | (defcustom ada-always-ask-project nil |
| 119 | "*Non-nil means ask for the name of a project file to use when none is | 118 | "*If nil, use default values when no project file was found. |
| 120 | found by the standard algorithm. | 119 | Otherwise, ask the user for the name of the project file to use.") |
| 121 | Nil means use default values when no project file was found") | ||
| 122 | 120 | ||
| 123 | ;; ------- Nothing to be modified by the user below this | 121 | ;; ------- Nothing to be modified by the user below this |
| 124 | (defvar ada-last-prj-file "" | 122 | (defvar ada-last-prj-file "" |
| 125 | "Name of the last project file entered by the user, when the | 123 | "Name of the last project file entered by the user.") |
| 126 | default algorithm did not find any possible project file") | ||
| 127 | 124 | ||
| 128 | (defvar ada-check-switch " -gnats " | 125 | (defvar ada-check-switch " -gnats " |
| 129 | "Switch added to the command line to check the current file") | 126 | "Switch added to the command line to check the current file.") |
| 130 | 127 | ||
| 131 | (defvar ada-project-file-extension ".adp" | 128 | (defvar ada-project-file-extension ".adp" |
| 132 | "The extension used for project files") | 129 | "The extension used for project files.") |
| 133 | 130 | ||
| 134 | (defconst is-windows (memq system-type (quote (windows-nt))) | 131 | (defconst is-windows (memq system-type (quote (windows-nt))) |
| 135 | "true if we are running on windows NT or windows 95") | 132 | "True if we are running on windows NT or windows 95.") |
| 136 | 133 | ||
| 137 | (defvar ada-xref-pos-ring '() | 134 | (defvar ada-xref-pos-ring '() |
| 138 | "This is the list of all the positions we went to with the | 135 | "List of positions selected by the cross-references functions. |
| 139 | cross-references features. This is used to go back to these positions.") | 136 | Used to go back to these positions.") |
| 140 | 137 | ||
| 141 | (defconst ada-xref-pos-ring-max 16 | 138 | (defconst ada-xref-pos-ring-max 16 |
| 142 | "Number of positions kept in the list ada-xref-pos-ring") | 139 | "Number of positions kept in the list ada-xref-pos-ring.") |
| 143 | 140 | ||
| 144 | (defvar ada-operator-re | 141 | (defvar ada-operator-re |
| 145 | "\\+\\|-\\|/\\|\\*\\|=\\|mod\\|and\\|not\\|or\\|xor\\|<=\\|<\\|>=\\|>" | 142 | "\\+\\|-\\|/\\|\\*\\|=\\|mod\\|and\\|not\\|or\\|xor\\|<=\\|<\\|>=\\|>" |
| 146 | "Regexp to match for operators") | 143 | "Regexp to match for operators.") |
| 147 | 144 | ||
| 148 | (defvar ada-xref-default-prj-file nil | 145 | (defvar ada-xref-default-prj-file nil |
| 149 | "name of the default prj file, per directory. | 146 | "Name of the default prj file, per directory. |
| 150 | Every directory is potentially associated with a default project file | 147 | Every directory is potentially associated with a default project file. |
| 151 | If it is nil, then the first prj file loaded will be the default for this | 148 | If it is nil, then the first prj file loaded will be the default for this |
| 152 | emacs session") | 149 | Emacs session.") |
| 153 | 150 | ||
| 154 | ;; These variables will be overwritted by buffer-local variables | 151 | ;; These variables will be overwritted by buffer-local variables |
| 155 | (defvar ada-prj-prj-file nil | 152 | (defvar ada-prj-prj-file nil |
| 156 | "Name of the project file for the current ada buffer") | 153 | "Name of the project file for the current ada buffer.") |
| 157 | (defvar ada-prj-src-dir nil | 154 | (defvar ada-prj-src-dir nil |
| 158 | "List of directories to look into for ada sources") | 155 | "List of directories to look into for ada sources.") |
| 159 | (defvar ada-prj-obj-dir nil | 156 | (defvar ada-prj-obj-dir nil |
| 160 | "List of directories to look into for object and .ali files") | 157 | "List of directories to look into for object and .ali files.") |
| 161 | (defvar ada-prj-comp-opt nil | 158 | (defvar ada-prj-comp-opt nil |
| 162 | "Switches to use on the command line for the default compile | 159 | "Switches to use on the command line for the default compile command.") |
| 163 | command (gcc)") | ||
| 164 | (defvar ada-prj-bind-opt nil | 160 | (defvar ada-prj-bind-opt nil |
| 165 | "Switches to use on the command line for the default bind | 161 | "Switches to use on the command line for the default bind command.") |
| 166 | command (gnatbind)") | ||
| 167 | (defvar ada-prj-link-opt nil | 162 | (defvar ada-prj-link-opt nil |
| 168 | "Switches to use on the command line for the default link | 163 | "Switches to use on the command line for the default link command.") |
| 169 | command (gnatlink)") | ||
| 170 | (defvar ada-prj-comp-cmd nil | 164 | (defvar ada-prj-comp-cmd nil |
| 171 | "Command to use to compile the current file only") | 165 | "Command to use to compile the current file only.") |
| 172 | (defvar ada-prj-make-cmd nil | 166 | (defvar ada-prj-make-cmd nil |
| 173 | "Command to use to compile the whole current application") | 167 | "Command to use to compile the whole current application.") |
| 174 | (defvar ada-prj-run-cmd nil | 168 | (defvar ada-prj-run-cmd nil |
| 175 | "Command to use to run the current application") | 169 | "Command to use to run the current application.") |
| 176 | (defvar ada-prj-debug-cmd nil | 170 | (defvar ada-prj-debug-cmd nil |
| 177 | "Command to use to run the debugger") | 171 | "Command to use to run the debugger.") |
| 178 | (defvar ada-prj-main nil | 172 | (defvar ada-prj-main nil |
| 179 | "Name of the main programm of the current application") | 173 | "Name of the main programm of the current application.") |
| 180 | (defvar ada-prj-remote-machine nil | 174 | (defvar ada-prj-remote-machine nil |
| 181 | "Name of the machine to log on before a compilation") | 175 | "Name of the machine to log on before a compilation.") |
| 182 | (defvar ada-prj-cross-prefix nil | 176 | (defvar ada-prj-cross-prefix nil |
| 183 | "Prefix to be added to the gnatmake, gcc, ... commands when | 177 | "Prefix to be added to the gnatmake, gcc, ... commands when |
| 184 | using a cross-compilation environment. | 178 | using a cross-compilation environment. |
| 185 | A '-' is automatically added at the end if not already present. | 179 | A '-' is automatically added at the end if not already present. |
| 186 | For instance, the compiler is called `ada-prj-cross-prefix'gnatmake") | 180 | For instance, the compiler is called `ada-prj-cross-prefix'gnatmake.") |
| 187 | 181 | ||
| 188 | ;; ----- Keybindings ------------------------------------------------------ | 182 | ;; ----- Keybindings ------------------------------------------------------ |
| 189 | 183 | ||
| 190 | (defun ada-add-keymap () | 184 | (defun ada-add-keymap () |
| 191 | "Add new key bindings when using ada-xrel.el" | 185 | "Add new key bindings when using `ada-xrel.el'." |
| 192 | (interactive) | 186 | (interactive) |
| 193 | (if ada-xemacs | 187 | (if ada-xemacs |
| 194 | (progn | 188 | (progn |
| @@ -216,14 +210,14 @@ For instance, the compiler is called `ada-prj-cross-prefix'gnatmake") | |||
| 216 | 210 | ||
| 217 | ;; ----- Menus -------------------------------------------------------------- | 211 | ;; ----- Menus -------------------------------------------------------------- |
| 218 | (defun ada-add-ada-menu () | 212 | (defun ada-add-ada-menu () |
| 219 | "Add some items to the standard Ada mode menu (the menu defined in | 213 | "Add some items to the standard Ada mode menu." |
| 220 | ada-mode.el)" | ||
| 221 | (interactive) | 214 | (interactive) |
| 222 | 215 | ||
| 223 | (if ada-xemacs | 216 | (if ada-xemacs |
| 224 | (progn | 217 | (progn |
| 225 | (add-menu-button '("Ada") ["Check file" ada-check-current t] "Goto") | 218 | (add-menu-button '("Ada") ["Check file" ada-check-current t] "Goto") |
| 226 | (add-menu-button '("Ada") ["Compile file" ada-compile-current t] "Goto") | 219 | (add-menu-button '("Ada") ["Compile file" ada-compile-current t] |
| 220 | "Goto") | ||
| 227 | (add-menu-button '("Ada") ["Build" ada-compile-application t] "Goto") | 221 | (add-menu-button '("Ada") ["Build" ada-compile-application t] "Goto") |
| 228 | (add-menu-button '("Ada") ["Run" ada-run-application t] "Goto") | 222 | (add-menu-button '("Ada") ["Run" ada-run-application t] "Goto") |
| 229 | (add-menu-button '("Ada") ["Debug" ada-gdb-application t] "Goto") | 223 | (add-menu-button '("Ada") ["Debug" ada-gdb-application t] "Goto") |
| @@ -235,20 +229,25 @@ ada-mode.el)" | |||
| 235 | "Goto") | 229 | "Goto") |
| 236 | (add-menu-button '("Ada" "Goto") ["Goto Parent Unit" ada-goto-parent t] | 230 | (add-menu-button '("Ada" "Goto") ["Goto Parent Unit" ada-goto-parent t] |
| 237 | "Next compilation error") | 231 | "Next compilation error") |
| 238 | (add-menu-button '("Ada" "Goto") ["Goto References to any entity" ada-find-any-references t] | 232 | (add-menu-button '("Ada" "Goto") ["Goto References to any entity" |
| 233 | ada-find-any-references t] | ||
| 239 | "Next compilation error") | 234 | "Next compilation error") |
| 240 | (add-menu-button '("Ada" "Goto") ["List References" ada-find-references t] | 235 | (add-menu-button '("Ada" "Goto") ["List References" |
| 236 | ada-find-references t] | ||
| 241 | "Next compilation error") | 237 | "Next compilation error") |
| 242 | (add-menu-button '("Ada" "Goto") ["Goto Declaration Other Frame" | 238 | (add-menu-button '("Ada" "Goto") ["Goto Declaration Other Frame" |
| 243 | ada-goto-declaration-other-frame t] | 239 | ada-goto-declaration-other-frame t] |
| 244 | "Next compilation error") | 240 | "Next compilation error") |
| 245 | (add-menu-button '("Ada" "Goto") ["Goto Declaration/Body" ada-goto-declaration t] | 241 | (add-menu-button '("Ada" "Goto") ["Goto Declaration/Body" |
| 242 | ada-goto-declaration t] | ||
| 246 | "Next compilation error") | 243 | "Next compilation error") |
| 247 | (add-menu-button '("Ada" "Goto") ["Goto Previous Reference" ada-xref-goto-previous-reference t] | 244 | (add-menu-button '("Ada" "Goto") ["Goto Previous Reference" |
| 245 | ada-xref-goto-previous-reference t] | ||
| 248 | "Next compilation error") | 246 | "Next compilation error") |
| 249 | (add-menu-button '("Ada" "Goto") ["--" nil t] | 247 | (add-menu-button '("Ada" "Goto") ["--" nil t] |
| 250 | "Next compilation error") | 248 | "Next compilation error") |
| 251 | (add-menu-button '("Ada" "Edit") ["Complete Identifier" ada-complete-identifier t] | 249 | (add-menu-button '("Ada" "Edit") ["Complete Identifier" |
| 250 | ada-complete-identifier t] | ||
| 252 | "Indent Line") | 251 | "Indent Line") |
| 253 | (add-menu-button '("Ada" "Edit") ["--------" nil t] | 252 | (add-menu-button '("Ada" "Edit") ["--------" nil t] |
| 254 | "Indent Line") | 253 | "Indent Line") |
| @@ -291,9 +290,11 @@ ada-mode.el)" | |||
| 291 | (define-key help-submenu [Gcc] | 290 | (define-key help-submenu [Gcc] |
| 292 | '("Gcc Documentation" . (lambda() (interactive) (info "gcc")))) | 291 | '("Gcc Documentation" . (lambda() (interactive) (info "gcc")))) |
| 293 | (define-key help-submenu [gdb] | 292 | (define-key help-submenu [gdb] |
| 294 | '("Ada Aware Gdb Documentation" . (lambda() (interactive) (info "gdb")))) | 293 | '("Ada Aware Gdb Documentation" . |
| 294 | (lambda() (interactive) (info "gdb")))) | ||
| 295 | (define-key goto-submenu [rem] '("----" . nil)) | 295 | (define-key goto-submenu [rem] '("----" . nil)) |
| 296 | (define-key goto-submenu [Parent] '("Goto Parent Unit" . ada-goto-parent)) | 296 | (define-key goto-submenu [Parent] |
| 297 | '("Goto Parent Unit" . ada-goto-parent)) | ||
| 297 | (define-key goto-submenu [References-any] | 298 | (define-key goto-submenu [References-any] |
| 298 | '("Goto References to any entity" . ada-find-any-references)) | 299 | '("Goto References to any entity" . ada-find-any-references)) |
| 299 | (define-key goto-submenu [References] | 300 | (define-key goto-submenu [References] |
| @@ -314,58 +315,54 @@ ada-mode.el)" | |||
| 314 | ;; ----- Utilities ------------------------------------------------- | 315 | ;; ----- Utilities ------------------------------------------------- |
| 315 | 316 | ||
| 316 | (defun ada-require-project-file () | 317 | (defun ada-require-project-file () |
| 317 | "If no project file is assigned to this buffer, load one" | 318 | "If no project file is assigned to this buffer, load one." |
| 318 | (if (not ( my-local-variable-if-set-p 'ada-prj-src-dir (current-buffer))) | 319 | (if (not ( my-local-variable-if-set-p 'ada-prj-src-dir (current-buffer))) |
| 319 | (ada-parse-prj-file (ada-prj-find-prj-file)))) | 320 | (ada-parse-prj-file (ada-prj-find-prj-file)))) |
| 320 | 321 | ||
| 321 | (defun my-local-variable-if-set-p (variable &optional buffer) | 322 | (defun my-local-variable-if-set-p (variable &optional buffer) |
| 323 | "Returns t if VARIABLE is local in BUFFER and is non-nil." | ||
| 322 | (and (local-variable-p variable buffer) | 324 | (and (local-variable-p variable buffer) |
| 323 | (save-excursion | 325 | (save-excursion |
| 324 | (set-buffer buffer) | 326 | (set-buffer buffer) |
| 325 | (symbol-value variable)))) | 327 | (symbol-value variable)))) |
| 326 | 328 | ||
| 327 | (defun ada-xref-push-pos (filename position) | 329 | (defun ada-xref-push-pos (filename position) |
| 328 | "Push (FILENAME, POSITION) on the position ring for cross-references" | 330 | "Push (FILENAME, POSITION) on the position ring for cross-references." |
| 329 | (setq ada-xref-pos-ring (cons (list position filename) ada-xref-pos-ring)) | 331 | (setq ada-xref-pos-ring (cons (list position filename) ada-xref-pos-ring)) |
| 330 | (if (> (length ada-xref-pos-ring) ada-xref-pos-ring-max) | 332 | (if (> (length ada-xref-pos-ring) ada-xref-pos-ring-max) |
| 331 | (setcdr (nthcdr (1- ada-xref-pos-ring-max) ada-xref-pos-ring) nil))) | 333 | (setcdr (nthcdr (1- ada-xref-pos-ring-max) ada-xref-pos-ring) nil))) |
| 332 | 334 | ||
| 333 | (defun ada-xref-goto-previous-reference () | 335 | (defun ada-xref-goto-previous-reference () |
| 334 | "Go to the previous cross-reference we were on" | 336 | "Go to the previous cross-reference we were on." |
| 335 | (interactive) | 337 | (interactive) |
| 336 | (if ada-xref-pos-ring | 338 | (if ada-xref-pos-ring |
| 337 | (progn | 339 | (let ((pos (car ada-xref-pos-ring))) |
| 338 | (let ((pos (car ada-xref-pos-ring))) | 340 | (setq ada-xref-pos-ring (cdr ada-xref-pos-ring)) |
| 339 | (setq ada-xref-pos-ring (cdr ada-xref-pos-ring)) | 341 | (find-file (car (cdr pos))) |
| 340 | (find-file (car (cdr pos))) | 342 | (goto-char (car pos))))) |
| 341 | (goto-char (car pos)))))) | ||
| 342 | 343 | ||
| 343 | (defun ada-convert-file-name (name) | 344 | (defun ada-convert-file-name (name) |
| 344 | "Function to convert from the buffer file name to the name given in | 345 | "Converts from NAME to a name that can be used by the compilation commands. |
| 345 | argument to the ada-compile-current function. This function is | 346 | This is overriden on VMS to convert from VMS filenames to Unix filenames." |
| 346 | overridden on VMS to convert from VMS filename to Unix filenames" | ||
| 347 | name) | 347 | name) |
| 348 | 348 | ||
| 349 | (defun ada-set-default-project-file (name) | 349 | (defun ada-set-default-project-file (name) |
| 350 | (interactive "fName of project file:") | 350 | "Set the file whose name is NAME as the default project file." |
| 351 | (interactive "fProject file:") | ||
| 351 | (set 'ada-prj-default-project-file name) | 352 | (set 'ada-prj-default-project-file name) |
| 352 | (ada-reread-prj-file t) | 353 | (ada-reread-prj-file t) |
| 353 | ) | 354 | ) |
| 354 | 355 | ||
| 355 | ;; ------ Handling the project file ----------------------------- | ||
| 356 | |||
| 357 | (defun ada-replace-substring (cmd-string search-for replace-with) | 356 | (defun ada-replace-substring (cmd-string search-for replace-with) |
| 358 | "Replace all instances of SEARCH-FOR with REPLACE-WITH in | 357 | "Replace all instances of SEARCH-FOR with REPLACE-WITH in CMD-STRING." |
| 359 | string CMD-STRING" | ||
| 360 | (while (string-match search-for cmd-string) | 358 | (while (string-match search-for cmd-string) |
| 361 | (setq cmd-string (replace-match replace-with t t cmd-string))) | 359 | (setq cmd-string (replace-match replace-with t t cmd-string))) |
| 362 | cmd-string) | 360 | cmd-string) |
| 363 | 361 | ||
| 364 | (defun ada-treat-cmd-string (cmd-string) | 362 | (defun ada-treat-cmd-string (cmd-string) |
| 365 | "Replace meta-sequences like ${...} with the appropriate value in CMD-STRING. | 363 | "Replace meta-sequences like ${...} in CMD-STRING with the appropriate value. |
| 366 | The current buffer must be the one where all local variable are definied (that | 364 | The current buffer must be the one where all local variable are defined (that |
| 367 | is the ada source)" | 365 | is the ada source)" |
| 368 | |||
| 369 | (if ( my-local-variable-if-set-p 'ada-prj-src-dir (current-buffer)) | 366 | (if ( my-local-variable-if-set-p 'ada-prj-src-dir (current-buffer)) |
| 370 | (if (string-match "\\(-[^-\$I]*I\\)\${src_dir}" cmd-string) | 367 | (if (string-match "\\(-[^-\$I]*I\\)\${src_dir}" cmd-string) |
| 371 | (progn | 368 | (progn |
| @@ -417,14 +414,14 @@ is the ada source)" | |||
| 417 | 414 | ||
| 418 | 415 | ||
| 419 | (defun ada-prj-find-prj-file (&optional no-user-question) | 416 | (defun ada-prj-find-prj-file (&optional no-user-question) |
| 420 | "Find the prj file associated with the current buffer | 417 | "Find the prj file associated with the current buffer. |
| 421 | The rules are the following ones : | 418 | The rules are the following ones : |
| 422 | - If the buffer is already associated with a prj file, use this one | 419 | - If the buffer is already associated with a prj file, use this one |
| 423 | - else if there's a default prj file for the same directory use it | 420 | - else if there's a default prj file for the same directory use it |
| 424 | - else if a prj file with the same filename exists, use it | 421 | - else if a prj file with the same filename exists, use it |
| 425 | - else if there's only one prj file in the directory, use it | 422 | - else if there's only one prj file in the directory, use it |
| 426 | - else if there are more than one prj file, ask the user | 423 | - else if there are more than one prj file, ask the user |
| 427 | - else if there is no prj file and no-user-question is nil, ask the user | 424 | - else if there is no prj file and NO-USER-QUESTION is nil, ask the user |
| 428 | for the project file to use." | 425 | for the project file to use." |
| 429 | (let* ((current-file (buffer-file-name)) | 426 | (let* ((current-file (buffer-file-name)) |
| 430 | (first-choice (concat | 427 | (first-choice (concat |
| @@ -501,7 +498,8 @@ The rules are the following ones : | |||
| 501 | 498 | ||
| 502 | 499 | ||
| 503 | (defun ada-parse-prj-file (prj-file) | 500 | (defun ada-parse-prj-file (prj-file) |
| 504 | "Reads and parses the PRJ-FILE file if it was found. | 501 | "Reads and parses the project file PRJ-FILE. |
| 502 | Does nothing if PRJ-FILE was not found. | ||
| 505 | The current buffer should be the ada-file buffer" | 503 | The current buffer should be the ada-file buffer" |
| 506 | 504 | ||
| 507 | (let ((tmp-src-dir nil) | 505 | (let ((tmp-src-dir nil) |
| @@ -664,8 +662,8 @@ The current buffer should be the ada-file buffer" | |||
| 664 | 662 | ||
| 665 | 663 | ||
| 666 | (defun ada-find-references (&optional pos) | 664 | (defun ada-find-references (&optional pos) |
| 667 | "Find every references to the entity under POS | 665 | "Find all references to the entity under POS. |
| 668 | Calls gnatfind to find every references" | 666 | Calls gnatfind to find the references." |
| 669 | (interactive "") | 667 | (interactive "") |
| 670 | (unless pos | 668 | (unless pos |
| 671 | (set 'pos (point))) | 669 | (set 'pos (point))) |
| @@ -689,7 +687,8 @@ Calls gnatfind to find every references" | |||
| 689 | ) | 687 | ) |
| 690 | 688 | ||
| 691 | (defun ada-find-any-references (entity &optional file line column) | 689 | (defun ada-find-any-references (entity &optional file line column) |
| 692 | "Search for references to any entity" | 690 | "Search for references to any entity whose name is ENTITY. |
| 691 | ENTITY was first found the location given by FILE, LINE and COLUMN." | ||
| 693 | (interactive "sEntity name: ") | 692 | (interactive "sEntity name: ") |
| 694 | (ada-require-project-file) | 693 | (ada-require-project-file) |
| 695 | 694 | ||
| @@ -702,9 +701,7 @@ Calls gnatfind to find every references" | |||
| 702 | (if (my-local-variable-if-set-p 'ada-prj-prj-file (current-buffer)) | 701 | (if (my-local-variable-if-set-p 'ada-prj-prj-file (current-buffer)) |
| 703 | (setq command (concat command " -p" ada-prj-prj-file))) | 702 | (setq command (concat command " -p" ada-prj-prj-file))) |
| 704 | 703 | ||
| 705 | (compile-internal command | 704 | (compile-internal command "No more references" "gnatfind") |
| 706 | "No more references" | ||
| 707 | "gnatfind") | ||
| 708 | 705 | ||
| 709 | ;; Hide the "Compilation" menu | 706 | ;; Hide the "Compilation" menu |
| 710 | (save-excursion | 707 | (save-excursion |
| @@ -714,7 +711,7 @@ Calls gnatfind to find every references" | |||
| 714 | ) | 711 | ) |
| 715 | 712 | ||
| 716 | (defun ada-buffer-list () | 713 | (defun ada-buffer-list () |
| 717 | "Display a buffer with all the ada-mode buffers and their associated prj file" | 714 | "Display a buffer with all the Ada buffers and their associated project." |
| 718 | (interactive) | 715 | (interactive) |
| 719 | (save-excursion | 716 | (save-excursion |
| 720 | (set-buffer (get-buffer-create "*Buffer List*")) | 717 | (set-buffer (get-buffer-create "*Buffer List*")) |
| @@ -765,7 +762,7 @@ directories and project file. It has the format : ((directory_1 . project_file1) | |||
| 765 | ) | 762 | ) |
| 766 | 763 | ||
| 767 | (defun ada-change-prj (filename) | 764 | (defun ada-change-prj (filename) |
| 768 | "Change the project file associated with the current buffer" | 765 | "Set FILENAME to be the project file for current buffer." |
| 769 | (interactive "fproject file:") | 766 | (interactive "fproject file:") |
| 770 | 767 | ||
| 771 | ;; make sure we are using an Ada file | 768 | ;; make sure we are using an Ada file |
| @@ -779,22 +776,19 @@ directories and project file. It has the format : ((directory_1 . project_file1) | |||
| 779 | ;; ask the user for the new file name | 776 | ;; ask the user for the new file name |
| 780 | (setq ada-prj-prj-file filename) | 777 | (setq ada-prj-prj-file filename) |
| 781 | 778 | ||
| 782 | ;; force emacs to reread the prj file next-time | 779 | ;; force Emacs to reread the prj file next-time |
| 783 | (ada-reread-prj-file) | 780 | (ada-reread-prj-file) |
| 784 | ) | 781 | ) |
| 785 | 782 | ||
| 786 | (defun ada-change-default-prj (filename) | 783 | (defun ada-change-default-prj (filename) |
| 787 | "Change the default project file used for all ada files from the | 784 | "Set FILENAME to be the default project file for the current directory." |
| 788 | current directory" | ||
| 789 | (interactive "ffile name:") | 785 | (interactive "ffile name:") |
| 790 | (let ((dir (file-name-directory (buffer-file-name))) | 786 | (let ((dir (file-name-directory (buffer-file-name))) |
| 791 | (prj (expand-file-name filename))) | 787 | (prj (expand-file-name filename))) |
| 792 | 788 | ||
| 793 | ;; If the directory is already associated with a project file | 789 | ;; Associate the directory with a project file |
| 794 | (if (assoc dir ada-xref-default-prj-file) | 790 | (if (assoc dir ada-xref-default-prj-file) |
| 795 | |||
| 796 | (setcdr (assoc dir ada-xref-default-prj-file) prj) | 791 | (setcdr (assoc dir ada-xref-default-prj-file) prj) |
| 797 | ;; Else create a new element in the list | ||
| 798 | (add-to-list 'ada-xref-default-prj-file (list dir prj))) | 792 | (add-to-list 'ada-xref-default-prj-file (list dir prj))) |
| 799 | 793 | ||
| 800 | ;; Reparse the project file | 794 | ;; Reparse the project file |
| @@ -833,8 +827,8 @@ current directory" | |||
| 833 | ;; ----- Identifier Completion -------------------------------------------- | 827 | ;; ----- Identifier Completion -------------------------------------------- |
| 834 | (defun ada-complete-identifier (pos) | 828 | (defun ada-complete-identifier (pos) |
| 835 | "Tries to complete the identifier around POS. | 829 | "Tries to complete the identifier around POS. |
| 836 | The feature is only available if the files where compiled not using the -gnatx | 830 | The feature is only available if the files where not compiled using the -gnatx |
| 837 | option" | 831 | option." |
| 838 | (interactive "d") | 832 | (interactive "d") |
| 839 | (ada-require-project-file) | 833 | (ada-require-project-file) |
| 840 | 834 | ||
| @@ -878,8 +872,9 @@ option" | |||
| 878 | (ada-goto-declaration (point))) | 872 | (ada-goto-declaration (point))) |
| 879 | 873 | ||
| 880 | (defun ada-goto-declaration (pos) | 874 | (defun ada-goto-declaration (pos) |
| 881 | "Displays the declaration of the identifier around POS. | 875 | "Display the declaration of the identifier around POS. |
| 882 | The declaration is shown in another buffer if `ada-xref-other-buffer' is non-nil" | 876 | The declaration is shown in another buffer if `ada-xref-other-buffer' is |
| 877 | non-nil." | ||
| 883 | (interactive "d") | 878 | (interactive "d") |
| 884 | (ada-require-project-file) | 879 | (ada-require-project-file) |
| 885 | (push-mark pos) | 880 | (push-mark pos) |
| @@ -887,8 +882,8 @@ The declaration is shown in another buffer if `ada-xref-other-buffer' is non-nil | |||
| 887 | (ada-find-in-ali (ada-read-identifier pos))) | 882 | (ada-find-in-ali (ada-read-identifier pos))) |
| 888 | 883 | ||
| 889 | (defun ada-goto-declaration-other-frame (pos) | 884 | (defun ada-goto-declaration-other-frame (pos) |
| 890 | "Displays the declaration of the identifier around point. | 885 | "Display the declaration of the identifier around POS. |
| 891 | The declation is shown in another frame if `ada-xref-other-buffer' is non-nil" | 886 | The declation is shown in another frame if `ada-xref-other-buffer' is non-nil." |
| 892 | (interactive "d") | 887 | (interactive "d") |
| 893 | (ada-require-project-file) | 888 | (ada-require-project-file) |
| 894 | (push-mark pos) | 889 | (push-mark pos) |
| @@ -896,9 +891,7 @@ The declation is shown in another frame if `ada-xref-other-buffer' is non-nil" | |||
| 896 | (ada-find-in-ali (ada-read-identifier pos) t)) | 891 | (ada-find-in-ali (ada-read-identifier pos) t)) |
| 897 | 892 | ||
| 898 | (defun ada-compile (command) | 893 | (defun ada-compile (command) |
| 899 | "Start a compilation, on the machine specified in the project file, | 894 | "Start COMMAND on the machine specified in the project file." |
| 900 | using command COMMAND" | ||
| 901 | |||
| 902 | (if (and (my-local-variable-if-set-p 'ada-prj-remote-machine (current-buffer)) | 895 | (if (and (my-local-variable-if-set-p 'ada-prj-remote-machine (current-buffer)) |
| 903 | (not (string= ada-prj-remote-machine ""))) | 896 | (not (string= ada-prj-remote-machine ""))) |
| 904 | (set 'command | 897 | (set 'command |
| @@ -907,7 +900,7 @@ using command COMMAND" | |||
| 907 | (compile command)) | 900 | (compile command)) |
| 908 | 901 | ||
| 909 | (defun ada-compile-application () | 902 | (defun ada-compile-application () |
| 910 | "Compiles the whole application, using the command find in the gnat.prj file" | 903 | "Compiles the application, using the command found in the project file." |
| 911 | (interactive) | 904 | (interactive) |
| 912 | (ada-require-project-file) | 905 | (ada-require-project-file) |
| 913 | 906 | ||
| @@ -920,7 +913,7 @@ using command COMMAND" | |||
| 920 | ) | 913 | ) |
| 921 | 914 | ||
| 922 | (defun ada-compile-current () | 915 | (defun ada-compile-current () |
| 923 | "Recompile the current file" | 916 | "Recompile the current file." |
| 924 | (interactive) | 917 | (interactive) |
| 925 | (ada-require-project-file) | 918 | (ada-require-project-file) |
| 926 | 919 | ||
| @@ -934,7 +927,7 @@ using command COMMAND" | |||
| 934 | ) | 927 | ) |
| 935 | 928 | ||
| 936 | (defun ada-check-current () | 929 | (defun ada-check-current () |
| 937 | "Recompile the current file" | 930 | "Recompile the current file." |
| 938 | (interactive) | 931 | (interactive) |
| 939 | (ada-require-project-file) | 932 | (ada-require-project-file) |
| 940 | 933 | ||
| @@ -948,7 +941,7 @@ using command COMMAND" | |||
| 948 | 941 | ||
| 949 | 942 | ||
| 950 | (defun ada-run-application () | 943 | (defun ada-run-application () |
| 951 | "Run the application" | 944 | "Run the application." |
| 952 | (interactive) | 945 | (interactive) |
| 953 | (ada-require-project-file) | 946 | (ada-require-project-file) |
| 954 | 947 | ||
| @@ -988,7 +981,7 @@ using command COMMAND" | |||
| 988 | 981 | ||
| 989 | 982 | ||
| 990 | (defun ada-gdb-application () | 983 | (defun ada-gdb-application () |
| 991 | "Run the application" | 984 | "Start the debugger on the application." |
| 992 | (interactive) | 985 | (interactive) |
| 993 | 986 | ||
| 994 | (require 'gud) | 987 | (require 'gud) |
| @@ -1025,10 +1018,10 @@ using command COMMAND" | |||
| 1025 | 1018 | ||
| 1026 | 1019 | ||
| 1027 | (defun ada-reread-prj-file (&optional for-all-buffer) | 1020 | (defun ada-reread-prj-file (&optional for-all-buffer) |
| 1028 | "Forces emacs to read the project file again. | 1021 | "Forces Emacs to read the project file again. |
| 1029 | Otherwise, this file is only read once, and never read again | 1022 | Otherwise, this file is only read once, and never read again |
| 1030 | If `for-all-buffer' is non-nil, or the function was called with \C-u prefix, | 1023 | If FOR-ALL-BUFFER is non-nil, or the function was called with \C-u prefix, |
| 1031 | then do this for every opened buffer" | 1024 | then do this for every opened buffer." |
| 1032 | (interactive "P") | 1025 | (interactive "P") |
| 1033 | (if for-all-buffer | 1026 | (if for-all-buffer |
| 1034 | 1027 | ||
| @@ -1056,10 +1049,8 @@ then do this for every opened buffer" | |||
| 1056 | ;; ------ Private routines | 1049 | ;; ------ Private routines |
| 1057 | 1050 | ||
| 1058 | (defun ada-xref-current (file &optional ali-file-name) | 1051 | (defun ada-xref-current (file &optional ali-file-name) |
| 1059 | "Creates a new ali file from the FILE source file, | 1052 | "Update the cross-references for FILE. |
| 1060 | assuming the ali file will be called ALI-FILE-NAME. | 1053 | This in fact recompiles FILE to create ALI-FILE-NAME." |
| 1061 | Uses the function `compile' to execute the commands | ||
| 1062 | defined in the project file." | ||
| 1063 | ;; kill old buffer | 1054 | ;; kill old buffer |
| 1064 | (if (and ali-file-name | 1055 | (if (and ali-file-name |
| 1065 | (get-file-buffer ali-file-name)) | 1056 | (get-file-buffer ali-file-name)) |
| @@ -1076,7 +1067,7 @@ defined in the project file." | |||
| 1076 | ) | 1067 | ) |
| 1077 | 1068 | ||
| 1078 | (defun ada-first-non-nil (list) | 1069 | (defun ada-first-non-nil (list) |
| 1079 | "Returns the first non-nil element of the list" | 1070 | "Returns the first non-nil element of the LIST" |
| 1080 | (cond | 1071 | (cond |
| 1081 | ((not list) nil) | 1072 | ((not list) nil) |
| 1082 | ((car list) (car list)) | 1073 | ((car list) (car list)) |
| @@ -1085,8 +1076,8 @@ defined in the project file." | |||
| 1085 | 1076 | ||
| 1086 | 1077 | ||
| 1087 | (defun ada-find-ali-file-in-dir (file) | 1078 | (defun ada-find-ali-file-in-dir (file) |
| 1088 | "Search for FILE in obj_dir | 1079 | "Search for FILE in obj_dir. |
| 1089 | The current buffer must be the Ada file" | 1080 | The current buffer must be the Ada file." |
| 1090 | (ada-first-non-nil | 1081 | (ada-first-non-nil |
| 1091 | (mapcar (lambda (x) | 1082 | (mapcar (lambda (x) |
| 1092 | (if (file-exists-p (concat (file-name-directory x) | 1083 | (if (file-exists-p (concat (file-name-directory x) |
| @@ -1097,9 +1088,9 @@ The current buffer must be the Ada file" | |||
| 1097 | ) | 1088 | ) |
| 1098 | 1089 | ||
| 1099 | (defun ada-get-ali-file-name (file) | 1090 | (defun ada-get-ali-file-name (file) |
| 1100 | "create the ali file name for the ada-file FILE | 1091 | "Create the ali file name for the ada-file FILE. |
| 1101 | The file is searched for in every directory shown in the | 1092 | The file is searched for in every directory shown in the obj_dir lines of |
| 1102 | obj_dir lines of the project file" | 1093 | the project file." |
| 1103 | 1094 | ||
| 1104 | ;; This function has to handle the special case of non-standard | 1095 | ;; This function has to handle the special case of non-standard |
| 1105 | ;; file names (i.e. not .adb or .ads) | 1096 | ;; file names (i.e. not .adb or .ads) |
| @@ -1176,9 +1167,9 @@ obj_dir lines of the project file" | |||
| 1176 | )) | 1167 | )) |
| 1177 | 1168 | ||
| 1178 | (defun ada-get-ada-file-name (file original-file) | 1169 | (defun ada-get-ada-file-name (file original-file) |
| 1179 | "Create the complete file name (+directory) for FILE | 1170 | "Create the complete file name (+directory) for FILE. |
| 1180 | The original file (where the user was) is ORIGINAL-FILE. | 1171 | The original file (where the user was) is ORIGINAL-FILE. Search in project |
| 1181 | Search in project file for possible paths" | 1172 | file for possible paths." |
| 1182 | 1173 | ||
| 1183 | (save-excursion | 1174 | (save-excursion |
| 1184 | (set-buffer (get-file-buffer original-file)) | 1175 | (set-buffer (get-file-buffer original-file)) |
| @@ -1202,7 +1193,7 @@ Search in project file for possible paths" | |||
| 1202 | ))) | 1193 | ))) |
| 1203 | 1194 | ||
| 1204 | (defun ada-find-file-number-in-ali (file) | 1195 | (defun ada-find-file-number-in-ali (file) |
| 1205 | "Returns the file number for FILE in the associated ali file" | 1196 | "Returns the file number for FILE in the associated ali file." |
| 1206 | (set-buffer (ada-get-ali-buffer file)) | 1197 | (set-buffer (ada-get-ali-buffer file)) |
| 1207 | (goto-char (point-min)) | 1198 | (goto-char (point-min)) |
| 1208 | 1199 | ||
| @@ -1212,7 +1203,7 @@ Search in project file for possible paths" | |||
| 1212 | (count-lines begin (point)))) | 1203 | (count-lines begin (point)))) |
| 1213 | 1204 | ||
| 1214 | (defun ada-read-identifier (pos) | 1205 | (defun ada-read-identifier (pos) |
| 1215 | "Returns the identlist around POS and switch to the .ali buffer" | 1206 | "Returns the identlist around POS and switch to the .ali buffer." |
| 1216 | 1207 | ||
| 1217 | ;; If there's a compilation in progress, it's probably because the | 1208 | ;; If there's a compilation in progress, it's probably because the |
| 1218 | ;; .ali file didn't exist. So we should wait... | 1209 | ;; .ali file didn't exist. So we should wait... |
| @@ -1268,8 +1259,8 @@ Search in project file for possible paths" | |||
| 1268 | )) | 1259 | )) |
| 1269 | 1260 | ||
| 1270 | (defun ada-get-all-references (identlist) | 1261 | (defun ada-get-all-references (identlist) |
| 1271 | "Completes and returns the identlist with the information extracted | 1262 | "Completes and returns the IDENTLIST with the information extracted |
| 1272 | from the ali file (definition file and places where it is referenced)" | 1263 | from the ali file (definition file and places where it is referenced)." |
| 1273 | 1264 | ||
| 1274 | (let ((ali-buffer (ada-get-ali-buffer (ada-file-of identlist))) | 1265 | (let ((ali-buffer (ada-get-ali-buffer (ada-file-of identlist))) |
| 1275 | declaration-found) | 1266 | declaration-found) |
| @@ -1386,7 +1377,7 @@ from the ali file (definition file and places where it is referenced)" | |||
| 1386 | "Find the matching position for IDENTLIST in the current ali buffer. | 1377 | "Find the matching position for IDENTLIST in the current ali buffer. |
| 1387 | This function is only called when the file was not up-to-date, so we need | 1378 | This function is only called when the file was not up-to-date, so we need |
| 1388 | to make some guesses. | 1379 | to make some guesses. |
| 1389 | This function is disabled for operators, and only works for identifiers" | 1380 | This function is disabled for operators, and only works for identifiers." |
| 1390 | 1381 | ||
| 1391 | (unless (= (string-to-char (ada-name-of identlist)) ?\") | 1382 | (unless (= (string-to-char (ada-name-of identlist)) ?\") |
| 1392 | (progn | 1383 | (progn |
| @@ -1469,9 +1460,9 @@ This function is disabled for operators, and only works for identifiers" | |||
| 1469 | 1460 | ||
| 1470 | 1461 | ||
| 1471 | (defun ada-find-in-ali (identlist &optional other-frame) | 1462 | (defun ada-find-in-ali (identlist &optional other-frame) |
| 1472 | "Look in the .ali file for the definition of the identifier | 1463 | "Look in the .ali file for the definition of the identifier in IDENTLIST. |
| 1473 | if OTHER-FRAME is non nil, and `ada-xref-other-buffer' is non nil, | 1464 | If OTHER-FRAME is non nil, and `ada-xref-other-buffer' is non nil, |
| 1474 | opens a new window to show the declaration" | 1465 | opens a new window to show the declaration." |
| 1475 | 1466 | ||
| 1476 | (ada-get-all-references identlist) | 1467 | (ada-get-all-references identlist) |
| 1477 | (let ((ali-line (ada-references-of identlist)) | 1468 | (let ((ali-line (ada-references-of identlist)) |
| @@ -1519,7 +1510,8 @@ opens a new window to show the declaration" | |||
| 1519 | "Select and display FILE, at LINE and COLUMN. The new file is | 1510 | "Select and display FILE, at LINE and COLUMN. The new file is |
| 1520 | associated with the same project file as the one for IDENTLIST. | 1511 | associated with the same project file as the one for IDENTLIST. |
| 1521 | If we do not end on the same identifier as IDENTLIST, find the closest | 1512 | If we do not end on the same identifier as IDENTLIST, find the closest |
| 1522 | match. Kills the .ali buffer at the end" | 1513 | match. Kills the .ali buffer at the end. |
| 1514 | If OTHER-FRAME is non-nil, creates a new frame to show the file." | ||
| 1523 | 1515 | ||
| 1524 | (let (prj-file | 1516 | (let (prj-file |
| 1525 | declaration-buffer | 1517 | declaration-buffer |
| @@ -1607,7 +1599,7 @@ It returns the position of the declaration in the buffer or nil if not found." | |||
| 1607 | 1599 | ||
| 1608 | ;; Find the parent library file of the current file | 1600 | ;; Find the parent library file of the current file |
| 1609 | (defun ada-goto-parent () | 1601 | (defun ada-goto-parent () |
| 1610 | "go to the parent library file" | 1602 | "Go to the parent library file." |
| 1611 | (interactive) | 1603 | (interactive) |
| 1612 | (ada-require-project-file) | 1604 | (ada-require-project-file) |
| 1613 | 1605 | ||
| @@ -1657,9 +1649,8 @@ It returns the position of the declaration in the buffer or nil if not found." | |||
| 1657 | )) | 1649 | )) |
| 1658 | 1650 | ||
| 1659 | (defun ada-make-filename-from-adaname (adaname) | 1651 | (defun ada-make-filename-from-adaname (adaname) |
| 1660 | "Determine the filename of a package/procedure from its own Ada name." | 1652 | "Determine the filename in which ADANAME is found. |
| 1661 | ;; this is done simply by calling `gnatkr', when we work with GNAT. It | 1653 | This is a GNAT specific function that uses gnatkrunch." |
| 1662 | ;; must be a more complex function in other compiler environments. | ||
| 1663 | (let (krunch-buf) | 1654 | (let (krunch-buf) |
| 1664 | (setq krunch-buf (generate-new-buffer "*gkrunch*")) | 1655 | (setq krunch-buf (generate-new-buffer "*gkrunch*")) |
| 1665 | (save-excursion | 1656 | (save-excursion |