aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2006-11-11 16:13:41 +0000
committerJuanma Barranquero2006-11-11 16:13:41 +0000
commitdc786b8afdba9af780c2194b7a550a9be42862b0 (patch)
tree7e612ac4ec29b8f82e15119ca2238750bfaddc19
parent28a62ecb9b11254d64e0f070f13a47acd72ded72 (diff)
downloademacs-dc786b8afdba9af780c2194b7a550a9be42862b0.tar.gz
emacs-dc786b8afdba9af780c2194b7a550a9be42862b0.zip
Delete `eval-and-compile' around `require'.
Delete commented out code for old Emacs versions. Autoloading of "ada-xref", "ada-prj" is useful even if compiler is not GNAT. (ada-mode-version): Bump version number. (ada-95-string-keywords, ada-2005-string-keywords, ada-2005-keywords, ada-name-regexp): New constant. (ada-language-version, ada-procedure-start-regexp, ada-mode, ada-font-lock-keywords): Add support for Ada 2005 keywords. (ada-package-start-regexp): Support private packages, include package name (for ada-set-point-accordingly). (ada-next-procedure, ada-previous-procedure, ada-which-function-are-we-in): Match changes to ada-procedure-start-regexp. (ada-make-body): Make non-interactive; not a user function. (ada-make-subprogram-body): Improve doc string.
-rw-r--r--lisp/ChangeLog18
-rw-r--r--lisp/progmodes/ada-mode.el169
2 files changed, 113 insertions, 74 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6a5667cb356..0cd138355ae 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,21 @@
12006-11-11 Stephen Leake <stephen_leake@stephe-leake.org>
2
3 * progmodes/ada-mode.el: Delete `eval-and-compile' around `require'.
4 Delete commented out code for old Emacs versions. Autoloading of
5 "ada-xref", "ada-prj" is useful even if compiler is not GNAT.
6 (ada-mode-version): Bump version number.
7 (ada-95-string-keywords, ada-2005-string-keywords)
8 (ada-2005-keywords, ada-name-regexp): New constant.
9 (ada-language-version, ada-procedure-start-regexp, ada-mode)
10 (ada-font-lock-keywords): Add support for Ada 2005 keywords.
11 (ada-package-start-regexp): Support private packages, include package
12 name (for ada-set-point-accordingly).
13 (ada-next-procedure, ada-previous-procedure)
14 (ada-which-function-are-we-in): Match changes to
15 ada-procedure-start-regexp.
16 (ada-make-body): Make non-interactive; not a user function.
17 (ada-make-subprogram-body): Improve doc string.
18
12006-11-11 Romain Francoise <romain@orebokech.com> 192006-11-11 Romain Francoise <romain@orebokech.com>
2 20
3 * progmodes/cperl-mode.el (cperl-mode): Before adding to it, make 21 * progmodes/cperl-mode.el (cperl-mode): Before adding to it, make
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index 7015a24ac01..68da6689b4e 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -125,12 +125,15 @@
125;;; `abbrev-mode': Provides the capability to define abbreviations, which 125;;; `abbrev-mode': Provides the capability to define abbreviations, which
126;;; are automatically expanded when you type them. See the Emacs manual. 126;;; are automatically expanded when you type them. See the Emacs manual.
127 127
128(eval-when-compile 128(condition-case nil
129 (require 'ispell nil t) 129 ;; ispell searches for the ispell executable when loaded; may not exist on some systems
130 (require 'find-file nil t) 130 (require 'ispell nil t)
131 (require 'align nil t) 131 (error nil))
132 (require 'which-func nil t) 132
133 (require 'compile nil t)) 133(require 'find-file nil t)
134(require 'align nil t)
135(require 'which-func nil t)
136(require 'compile nil t)
134 137
135(defvar compile-auto-highlight) 138(defvar compile-auto-highlight)
136(defvar skeleton-further-elements) 139(defvar skeleton-further-elements)
@@ -148,16 +151,10 @@ If IS-XEMACS is non-nil, check for XEmacs instead of Emacs."
148 (and (= emacs-major-version major) 151 (and (= emacs-major-version major)
149 (>= emacs-minor-version minor))))))) 152 (>= emacs-minor-version minor)))))))
150 153
151
152;; This call should not be made in the release that is done for the
153;; official Emacs, since it does nothing useful for the latest version
154;;(if (not (ada-check-emacs-version 21 1))
155;; (require 'ada-support))
156
157(defun ada-mode-version () 154(defun ada-mode-version ()
158 "Return Ada mode version." 155 "Return Ada mode version."
159 (interactive) 156 (interactive)
160 (let ((version-string "3.5")) 157 (let ((version-string "3.6w"))
161 (if (interactive-p) 158 (if (interactive-p)
162 (message version-string) 159 (message version-string)
163 version-string))) 160 version-string)))
@@ -366,8 +363,8 @@ This is also used for <<..>> labels"
366 :type 'integer :group 'ada) 363 :type 'integer :group 'ada)
367 364
368(defcustom ada-language-version 'ada95 365(defcustom ada-language-version 'ada95
369 "*Do we program in `ada83' or `ada95'?" 366 "*Ada language version; one of `ada83', `ada95', `ada05'."
370 :type '(choice (const ada83) (const ada95)) :group 'ada) 367 :type '(choice (const ada83) (const ada95) (const ada05)) :group 'ada)
371 368
372(defcustom ada-move-to-declaration nil 369(defcustom ada-move-to-declaration nil
373 "*Non-nil means `ada-move-to-start' moves to the subprogram declaration, not to 'begin'." 370 "*Non-nil means `ada-move-to-start' moves to the subprogram declaration, not to 'begin'."
@@ -489,8 +486,20 @@ The extensions should include a `.' if needed.")
489 "procedure" "raise" "range" "record" "rem" "renames" "return" 486 "procedure" "raise" "range" "record" "rem" "renames" "return"
490 "reverse" "select" "separate" "subtype" "task" "terminate" "then" 487 "reverse" "select" "separate" "subtype" "task" "terminate" "then"
491 "type" "use" "when" "while" "with" "xor") 488 "type" "use" "when" "while" "with" "xor")
492 "List of Ada keywords. 489 "List of Ada 83 keywords.
493This variable is used to define `ada-83-keywords' and `ada-95-keywords'.")) 490Used to define `ada-*-keywords'."))
491
492(eval-when-compile
493 (defconst ada-95-string-keywords
494 '("abstract" "aliased" "protected" "requeue" "tagged" "until")
495 "List of keywords new in Ada 95.
496Used to define `ada-*-keywords'."))
497
498(eval-when-compile
499 (defconst ada-2005-string-keywords
500 '("interface" "overriding" "synchronized")
501 "List of keywords new in Ada 2005.
502Used to define `ada-*-keywords.'"))
494 503
495(defvar ada-ret-binding nil 504(defvar ada-ret-binding nil
496 "Variable to save key binding of RET when casing is activated.") 505 "Variable to save key binding of RET when casing is activated.")
@@ -566,29 +575,38 @@ This variable defines several rules to use to align different lines.")
566(defconst ada-83-keywords 575(defconst ada-83-keywords
567 (eval-when-compile 576 (eval-when-compile
568 (concat "\\<" (regexp-opt ada-83-string-keywords t) "\\>")) 577 (concat "\\<" (regexp-opt ada-83-string-keywords t) "\\>"))
569 "Regular expression for looking at Ada83 keywords.") 578 "Regular expression matching Ada83 keywords.")
570 579
571(defconst ada-95-keywords 580(defconst ada-95-keywords
572 (eval-when-compile 581 (eval-when-compile
573 (concat "\\<" (regexp-opt 582 (concat "\\<" (regexp-opt
574 (append 583 (append
575 '("abstract" "aliased" "protected" "requeue" 584 ada-95-string-keywords
576 "tagged" "until")
577 ada-83-string-keywords) t) "\\>")) 585 ada-83-string-keywords) t) "\\>"))
578 "Regular expression for looking at Ada95 keywords.") 586 "Regular expression matching Ada95 keywords.")
579 587
580(defvar ada-keywords ada-95-keywords 588(defconst ada-2005-keywords
581 "Regular expression for looking at Ada keywords.") 589 (eval-when-compile
590 (concat "\\<" (regexp-opt
591 (append
592 ada-2005-string-keywords
593 ada-83-string-keywords
594 ada-95-string-keywords) t) "\\>"))
595 "Regular expression matching Ada2005 keywords.")
596
597(defvar ada-keywords ada-2005-keywords
598 "Regular expression matching Ada keywords.")
599;; FIXME: make this customizable
582 600
583(defconst ada-ident-re 601(defconst ada-ident-re
584 "\\(\\sw\\|[_.]\\)+" 602 "\\(\\sw\\|[_.]\\)+"
585 "Regexp matching Ada (qualified) identifiers.") 603 "Regexp matching Ada (qualified) identifiers.")
586 604
587;; "with" needs to be included in the regexp, so that we can insert new lines 605;; "with" needs to be included in the regexp, to match generic subprogram parameters
588;; after the declaration of the parameter for a generic. 606;; Similarly, we put '[not] overriding' on the same line with 'procedure' etc.
589(defvar ada-procedure-start-regexp 607(defvar ada-procedure-start-regexp
590 (concat 608 (concat
591 "^[ \t]*\\(with[ \t]+\\)?\\(procedure\\|function\\|task\\)[ \t\n]+" 609 "^[ \t]*\\(with[ \t]+\\)?\\(\\(not[ \t]+\\)?overriding[ \t]+\\)?\\(procedure\\|function\\|task\\)[ \t\n]+"
592 610
593 ;; subprogram name: operator ("[+/=*]") 611 ;; subprogram name: operator ("[+/=*]")
594 "\\(" 612 "\\("
@@ -598,12 +616,17 @@ This variable defines several rules to use to align different lines.")
598 "\\|" 616 "\\|"
599 "\\(\\(\\sw\\|[_.]\\)+\\)" 617 "\\(\\(\\sw\\|[_.]\\)+\\)"
600 "\\)") 618 "\\)")
601 "Regexp used to find Ada procedures/functions.") 619 "Regexp matching Ada subprogram start.
620The actual start is at (match-beginning 4). The name is in (match-string 5).")
602 621
603(defvar ada-package-start-regexp 622(defconst ada-name-regexp
604 "^[ \t]*\\(package\\)" 623 "\\([a-zA-Z][a-zA-Z0-9_\\.\\']*[a-zA-Z0-9]\\)"
605 "Regexp used to find Ada packages.") 624 "Regexp matching a fully qualified name (including attribute).")
606 625
626(defconst ada-package-start-regexp
627 (concat "^[ \t]*\\(private[ \t]+\\)?\\(package\\)[ \t\n]+\\(body[ \t]*\\)?" ada-name-regexp)
628 "Regexp matching start of package.
629The package name is in (match-string 4).")
607 630
608;;; ---- regexps for indentation functions 631;;; ---- regexps for indentation functions
609 632
@@ -1379,7 +1402,9 @@ If you use ada-xref.el:
1379 (cond ((eq ada-language-version 'ada83) 1402 (cond ((eq ada-language-version 'ada83)
1380 (setq ada-keywords ada-83-keywords)) 1403 (setq ada-keywords ada-83-keywords))
1381 ((eq ada-language-version 'ada95) 1404 ((eq ada-language-version 'ada95)
1382 (setq ada-keywords ada-95-keywords))) 1405 (setq ada-keywords ada-95-keywords))
1406 ((eq ada-language-version 'ada05)
1407 (setq ada-keywords ada-2005-keywords)))
1383 1408
1384 (if ada-auto-case 1409 (if ada-auto-case
1385 (ada-activate-keys-for-case))) 1410 (ada-activate-keys-for-case)))
@@ -4430,7 +4455,7 @@ Moves to 'begin' if in a declarative part."
4430 (interactive) 4455 (interactive)
4431 (end-of-line) 4456 (end-of-line)
4432 (if (re-search-forward ada-procedure-start-regexp nil t) 4457 (if (re-search-forward ada-procedure-start-regexp nil t)
4433 (goto-char (match-beginning 2)) 4458 (goto-char (match-beginning 4))
4434 (error "No more functions/procedures/tasks"))) 4459 (error "No more functions/procedures/tasks")))
4435 4460
4436(defun ada-previous-procedure () 4461(defun ada-previous-procedure ()
@@ -4438,7 +4463,7 @@ Moves to 'begin' if in a declarative part."
4438 (interactive) 4463 (interactive)
4439 (beginning-of-line) 4464 (beginning-of-line)
4440 (if (re-search-backward ada-procedure-start-regexp nil t) 4465 (if (re-search-backward ada-procedure-start-regexp nil t)
4441 (goto-char (match-beginning 2)) 4466 (goto-char (match-beginning 4))
4442 (error "No more functions/procedures/tasks"))) 4467 (error "No more functions/procedures/tasks")))
4443 4468
4444(defun ada-next-package () 4469(defun ada-next-package ()
@@ -4958,13 +4983,14 @@ or the spec otherwise."
4958 4983
4959(defun ada-which-function-are-we-in () 4984(defun ada-which-function-are-we-in ()
4960 "Return the name of the function whose definition/declaration point is in. 4985 "Return the name of the function whose definition/declaration point is in.
4961Redefines the function `ff-which-function-are-we-in'." 4986Used in `ff-pre-load-hook'."
4962 (setq ff-function-name nil) 4987 (setq ff-function-name nil)
4963 (save-excursion 4988 (save-excursion
4964 (end-of-line);; make sure we get the complete name 4989 (end-of-line);; make sure we get the complete name
4965 (if (or (re-search-backward ada-procedure-start-regexp nil t) 4990 (or (if (re-search-backward ada-procedure-start-regexp nil t)
4966 (re-search-backward ada-package-start-regexp nil t)) 4991 (setq ff-function-name (match-string 5)))
4967 (setq ff-function-name (match-string 0))) 4992 (if (re-search-backward ada-package-start-regexp nil t)
4993 (setq ff-function-name (match-string 4))))
4968 )) 4994 ))
4969 4995
4970 4996
@@ -5162,11 +5188,11 @@ Return nil if no body was found."
5162 '("abort" "abs" "abstract" "accept" "access" "aliased" "all" 5188 '("abort" "abs" "abstract" "accept" "access" "aliased" "all"
5163 "and" "array" "at" "begin" "case" "declare" "delay" "delta" 5189 "and" "array" "at" "begin" "case" "declare" "delay" "delta"
5164 "digits" "do" "else" "elsif" "entry" "exception" "exit" "for" 5190 "digits" "do" "else" "elsif" "entry" "exception" "exit" "for"
5165 "generic" "if" "in" "is" "limited" "loop" "mod" "not" 5191 "generic" "if" "in" "interface" "is" "limited" "loop" "mod" "not"
5166 "null" "or" "others" "private" "protected" "raise" 5192 "null" "or" "others" "overriding" "private" "protected" "raise"
5167 "range" "record" "rem" "renames" "requeue" "return" "reverse" 5193 "range" "record" "rem" "renames" "requeue" "return" "reverse"
5168 "select" "separate" "tagged" "task" "terminate" "then" "until" 5194 "select" "separate" "synchronized" "tagged" "task" "terminate"
5169 "when" "while" "with" "xor") t) 5195 "then" "until" "when" "while" "with" "xor") t)
5170 "\\>") 5196 "\\>")
5171 ;; 5197 ;;
5172 ;; Anything following end and not already fontified is a body name. 5198 ;; Anything following end and not already fontified is a body name.
@@ -5324,10 +5350,8 @@ for `ada-procedure-start-regexp'."
5324 5350
5325(defun ada-make-body () 5351(defun ada-make-body ()
5326 "Create an Ada package body in the current buffer. 5352 "Create an Ada package body in the current buffer.
5327The potential old buffer contents is deleted first, then we copy the 5353The spec must be the previously visited buffer.
5328spec buffer in here and modify it to make it a body.
5329This function typically is to be hooked into `ff-file-created-hooks'." 5354This function typically is to be hooked into `ff-file-created-hooks'."
5330 (interactive)
5331 (delete-region (point-min) (point-max)) 5355 (delete-region (point-min) (point-max))
5332 (insert-buffer-substring (car (cdr (buffer-list)))) 5356 (insert-buffer-substring (car (cdr (buffer-list))))
5333 (goto-char (point-min)) 5357 (goto-char (point-min))
@@ -5358,7 +5382,7 @@ This function typically is to be hooked into `ff-file-created-hooks'."
5358 5382
5359 5383
5360(defun ada-make-subprogram-body () 5384(defun ada-make-subprogram-body ()
5361 "Make one dummy subprogram body from spec surrounding point." 5385 "Create a dummy subprogram body in package body file from spec surrounding point."
5362 (interactive) 5386 (interactive)
5363 (let* ((found (re-search-backward ada-procedure-start-regexp nil t)) 5387 (let* ((found (re-search-backward ada-procedure-start-regexp nil t))
5364 (spec (match-beginning 0)) 5388 (spec (match-beginning 0))
@@ -5417,35 +5441,32 @@ This function typically is to be hooked into `ff-file-created-hooks'."
5417(ada-case-read-exceptions) 5441(ada-case-read-exceptions)
5418 5442
5419;; Setup auto-loading of the other Ada mode files. 5443;; Setup auto-loading of the other Ada mode files.
5420(if (equal ada-which-compiler 'gnat) 5444(autoload 'ada-change-prj "ada-xref" nil t)
5421 (progn 5445(autoload 'ada-check-current "ada-xref" nil t)
5422 (autoload 'ada-change-prj "ada-xref" nil t) 5446(autoload 'ada-compile-application "ada-xref" nil t)
5423 (autoload 'ada-check-current "ada-xref" nil t) 5447(autoload 'ada-compile-current "ada-xref" nil t)
5424 (autoload 'ada-compile-application "ada-xref" nil t) 5448(autoload 'ada-complete-identifier "ada-xref" nil t)
5425 (autoload 'ada-compile-current "ada-xref" nil t) 5449(autoload 'ada-find-file "ada-xref" nil t)
5426 (autoload 'ada-complete-identifier "ada-xref" nil t) 5450(autoload 'ada-find-any-references "ada-xref" nil t)
5427 (autoload 'ada-find-file "ada-xref" nil t) 5451(autoload 'ada-find-src-file-in-dir "ada-xref" nil t)
5428 (autoload 'ada-find-any-references "ada-xref" nil t) 5452(autoload 'ada-find-local-references "ada-xref" nil t)
5429 (autoload 'ada-find-src-file-in-dir "ada-xref" nil t) 5453(autoload 'ada-find-references "ada-xref" nil t)
5430 (autoload 'ada-find-local-references "ada-xref" nil t) 5454(autoload 'ada-gdb-application "ada-xref" nil t)
5431 (autoload 'ada-find-references "ada-xref" nil t) 5455(autoload 'ada-goto-declaration "ada-xref" nil t)
5432 (autoload 'ada-gdb-application "ada-xref" nil t) 5456(autoload 'ada-goto-declaration-other-frame "ada-xref" nil t)
5433 (autoload 'ada-goto-declaration "ada-xref" nil t) 5457(autoload 'ada-goto-parent "ada-xref" nil t)
5434 (autoload 'ada-goto-declaration-other-frame "ada-xref" nil t) 5458(autoload 'ada-make-body-gnatstub "ada-xref" nil t)
5435 (autoload 'ada-goto-parent "ada-xref" nil t) 5459(autoload 'ada-point-and-xref "ada-xref" nil t)
5436 (autoload 'ada-make-body-gnatstub "ada-xref" nil t) 5460(autoload 'ada-reread-prj-file "ada-xref" nil t)
5437 (autoload 'ada-point-and-xref "ada-xref" nil t) 5461(autoload 'ada-run-application "ada-xref" nil t)
5438 (autoload 'ada-reread-prj-file "ada-xref" nil t) 5462(autoload 'ada-set-default-project-file "ada-xref" nil nil)
5439 (autoload 'ada-run-application "ada-xref" nil t) 5463(autoload 'ada-set-default-project-file "ada-xref" nil t)
5440 (autoload 'ada-set-default-project-file "ada-xref" nil nil) 5464(autoload 'ada-xref-goto-previous-reference "ada-xref" nil t)
5441 (autoload 'ada-set-default-project-file "ada-xref" nil t) 5465
5442 (autoload 'ada-xref-goto-previous-reference "ada-xref" nil t) 5466(autoload 'ada-customize "ada-prj" nil t)
5443 5467(autoload 'ada-prj-edit "ada-prj" nil t)
5444 (autoload 'ada-customize "ada-prj" nil t) 5468(autoload 'ada-prj-new "ada-prj" nil t)
5445 (autoload 'ada-prj-edit "ada-prj" nil t) 5469(autoload 'ada-prj-save "ada-prj" nil t)
5446 (autoload 'ada-prj-new "ada-prj" nil t)
5447 (autoload 'ada-prj-save "ada-prj" nil t)
5448 ))
5449 5470
5450(autoload 'ada-array "ada-stmt" nil t) 5471(autoload 'ada-array "ada-stmt" nil t)
5451(autoload 'ada-case "ada-stmt" nil t) 5472(autoload 'ada-case "ada-stmt" nil t)