Mercurial > emacs
comparison lisp/progmodes/ada-mode.el @ 10707:4a2ea4f52ea0
Add autoload cookie.
(ada-mode-map): Don't define C-m, M-a, M-e, M-q.
Don't define M-q.
(ada-mode): Set fill-paragraph-function locally.
(ada-fill-comment-paragraph): Return t.
(ada-gen-make-bodyfile): Add missing backslash.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 09 Feb 1995 00:17:31 +0000 |
parents | 3d356714b662 |
children | 7c5fe757600b |
comparison
equal
deleted
inserted
replaced
10706:918e43cfede6 | 10707:4a2ea4f52ea0 |
---|---|
22 | 22 |
23 ;;; This mode is a complete rewrite of a major mode for editing Ada 83 | 23 ;;; This mode is a complete rewrite of a major mode for editing Ada 83 |
24 ;;; and Ada 94 source code under Emacs-19. It contains completely new | 24 ;;; and Ada 94 source code under Emacs-19. It contains completely new |
25 ;;; indenting code and support for code browsing (see ada-xref). | 25 ;;; indenting code and support for code browsing (see ada-xref). |
26 | 26 |
27 | |
28 ;;; COMMENTARY | |
29 ;;; ========== | |
30 ;;; Put the ada-mode.el file in your load-path (for .el files) and | |
31 ;;; optionally byte compile it. It becomes a lot faster, if byte | |
32 ;;; compiled. Don't care about the warnings; they are harmless. | |
33 ;;; | |
34 ;;; To make emacs start up Ada Mode when loading a ada source, add | |
35 ;;; these lines to your .emacs: | |
36 ;;; | |
37 ;;; (autoload 'ada-mode "ada-mode" nil t) | |
38 ;;; (setq auto-mode-alist (cons '("\\.ad[abs]$" . ada-mode) | |
39 ;;; auto-mode-alist)) | |
40 | 27 |
41 ;;; USAGE | 28 ;;; USAGE |
42 ;;; ===== | 29 ;;; ===== |
43 ;;; If you have modified your startup file as described above, emacs | 30 ;;; If you have modified your startup file as described above, emacs |
44 ;;; should enter ada-mode when you load an ada source into emacs. | 31 ;;; should enter ada-mode when you load an ada source into emacs. |
120 | 107 |
121 | 108 |
122 ;;; LCD Archive Entry: | 109 ;;; LCD Archive Entry: |
123 ;;; ada-mode|Rolf Ebert|<ebert@inf.enst.fr> | 110 ;;; ada-mode|Rolf Ebert|<ebert@inf.enst.fr> |
124 ;;; |Major-mode for Ada | 111 ;;; |Major-mode for Ada |
125 ;;; |$Date: 1994/11/28 12:12:08 $|$Revision: 2.10 $| | 112 ;;; |$Date: 1995/02/09 00:01:34 $|$Revision: 1.1 $| |
126 | 113 |
127 | 114 |
128 (defconst ada-mode-version (substring "$Revision: 2.10 $" 11 -2) | 115 (defconst ada-mode-version (substring "$Revision: 1.1 $" 11 -2) |
129 "$Id: ada-mode.el,v 2.10 1994/11/28 12:12:08 re Exp $ | 116 "$Id: ada-mode.el,v 1.1 1995/02/09 00:01:34 rms Exp rms $ |
130 | 117 |
131 Report bugs to: Rolf Ebert <ebert@inf.enst.fr>") | 118 Report bugs to: Rolf Ebert <ebert@inf.enst.fr>") |
132 | 119 |
133 | 120 |
134 ;;;-------------------- | 121 ;;;-------------------- |
368 (modify-syntax-entry ?\( "()" ada-mode-syntax-table) | 355 (modify-syntax-entry ?\( "()" ada-mode-syntax-table) |
369 (modify-syntax-entry ?\) ")(" ada-mode-syntax-table) | 356 (modify-syntax-entry ?\) ")(" ada-mode-syntax-table) |
370 ) | 357 ) |
371 | 358 |
372 | 359 |
360 ;;;###autoload | |
373 (defun ada-mode () | 361 (defun ada-mode () |
374 "Ada Mode is the major mode for editing Ada code. | 362 "Ada Mode is the major mode for editing Ada code. |
375 | 363 |
376 Bindings are as follows: (Note: 'LFD' is control-j.) | 364 Bindings are as follows: (Note: 'LFD' is control-j.) |
377 | 365 |
447 (make-local-variable 'parse-sexp-ignore-comments) | 435 (make-local-variable 'parse-sexp-ignore-comments) |
448 (setq parse-sexp-ignore-comments t) | 436 (setq parse-sexp-ignore-comments t) |
449 | 437 |
450 (make-local-variable 'case-fold-search) | 438 (make-local-variable 'case-fold-search) |
451 (setq case-fold-search t) | 439 (setq case-fold-search t) |
440 | |
441 (make-local-variable 'fill-paragraph-function) | |
442 (setq fill-paragraph-function 'ada-fill-comment-paragraph) | |
452 | 443 |
453 (make-local-variable 'font-lock-defaults) | 444 (make-local-variable 'font-lock-defaults) |
454 (setq font-lock-defaults '(ada-font-lock-keywords nil t ((?\_ . "w")))) | 445 (setq font-lock-defaults '(ada-font-lock-keywords nil t ((?\_ . "w")))) |
455 | 446 |
456 (setq major-mode 'ada-mode) | 447 (setq major-mode 'ada-mode) |
638 (goto-char (1- end)) | 629 (goto-char (1- end)) |
639 (end-of-line) | 630 (end-of-line) |
640 (delete-char 1)) | 631 (delete-char 1)) |
641 | 632 |
642 (message "filling comment paragraph ... done") | 633 (message "filling comment paragraph ... done") |
643 (goto-char opos))) | 634 (goto-char opos)) |
635 t) | |
644 | 636 |
645 | 637 |
646 ;;;--------------------------------;;; | 638 ;;;--------------------------------;;; |
647 ;;; Call External Pretty Printer ;;; | 639 ;;; Call External Pretty Printer ;;; |
648 ;;;--------------------------------;;; | 640 ;;;--------------------------------;;; |
3393 (if (not ada-mode-map) | 3385 (if (not ada-mode-map) |
3394 (progn | 3386 (progn |
3395 (setq ada-mode-map (make-sparse-keymap)) | 3387 (setq ada-mode-map (make-sparse-keymap)) |
3396 | 3388 |
3397 ;; Indentation and Formatting | 3389 ;; Indentation and Formatting |
3398 (define-key ada-mode-map "\C-M" 'newline) | |
3399 (define-key ada-mode-map "\C-j" 'ada-indent-newline-indent) | 3390 (define-key ada-mode-map "\C-j" 'ada-indent-newline-indent) |
3400 (define-key ada-mode-map "\t" 'ada-tab) | 3391 (define-key ada-mode-map "\t" 'ada-tab) |
3401 (define-key ada-mode-map "\C-c\C-l" 'ada-indent-region) | 3392 (define-key ada-mode-map "\C-c\C-l" 'ada-indent-region) |
3402 ;; How do I write this for working with Lucid Emacs? | 3393 ;; How do I write this for working with Lucid Emacs? |
3403 (define-key ada-mode-map [S-tab] 'ada-untab) | 3394 (define-key ada-mode-map [S-tab] 'ada-untab) |
3404 (define-key ada-mode-map "\C-c\C-f" 'ada-format-paramlist) | 3395 (define-key ada-mode-map "\C-c\C-f" 'ada-format-paramlist) |
3405 (define-key ada-mode-map "\C-c\C-p" 'ada-call-pretty-printer) | 3396 (define-key ada-mode-map "\C-c\C-p" 'ada-call-pretty-printer) |
3406 (define-key ada-mode-map "\M-q" 'ada-fill-comment-paragraph) | 3397 ;;; We don't want to make meta-characters case-specific. |
3407 (define-key ada-mode-map "\M-Q" 'ada-fill-comment-paragraph-justify) | 3398 ;;; (define-key ada-mode-map "\M-Q" 'ada-fill-comment-paragraph-justify) |
3408 (define-key ada-mode-map "\M-\C-q" 'ada-fill-comment-paragraph-postfix) | 3399 (define-key ada-mode-map "\M-\C-q" 'ada-fill-comment-paragraph-postfix) |
3409 | 3400 |
3410 ;; Movement | 3401 ;; Movement |
3411 (define-key ada-mode-map "\M-e" 'ada-next-procedure) | 3402 ;;; It isn't good to redefine these. What should be done instead? -- rms. |
3412 (define-key ada-mode-map "\M-a" 'ada-previous-procedure) | 3403 ;;; (define-key ada-mode-map "\M-e" 'ada-next-procedure) |
3404 ;;; (define-key ada-mode-map "\M-a" 'ada-previous-procedure) | |
3413 (define-key ada-mode-map "\M-\C-e" 'ada-next-package) | 3405 (define-key ada-mode-map "\M-\C-e" 'ada-next-package) |
3414 (define-key ada-mode-map "\M-\C-a" 'ada-previous-package) | 3406 (define-key ada-mode-map "\M-\C-a" 'ada-previous-package) |
3415 (define-key ada-mode-map "\C-c\C-a" 'ada-move-to-start) | 3407 (define-key ada-mode-map "\C-c\C-a" 'ada-move-to-start) |
3416 (define-key ada-mode-map "\C-c\C-e" 'ada-move-to-end) | 3408 (define-key ada-mode-map "\C-c\C-e" 'ada-move-to-end) |
3417 | 3409 |
3713 ;; goto end of regex before last (= end of procname) | 3705 ;; goto end of regex before last (= end of procname) |
3714 (goto-char (match-end 0)) | 3706 (goto-char (match-end 0)) |
3715 ;; look for next non WS | 3707 ;; look for next non WS |
3716 (backward-char) | 3708 (backward-char) |
3717 (re-search-forward "[ ]*.") | 3709 (re-search-forward "[ ]*.") |
3718 (if (char-equal (char-after (match-end 0)) ?;) | 3710 (if (char-equal (char-after (match-end 0)) ?\;) |
3719 (delete-char 1) ;; delete the ';' | 3711 (delete-char 1) ;; delete the ';' |
3720 ;; else | 3712 ;; else |
3721 ;; find ');' or 'return <id> ;' | 3713 ;; find ');' or 'return <id> ;' |
3722 (re-search-forward | 3714 (re-search-forward |
3723 "\\()[ \t]*;\\)\\|\\(return[ \t]+[a-zA-Z0-9_]+[ \t]*;\\)" nil t) | 3715 "\\()[ \t]*;\\)\\|\\(return[ \t]+[a-zA-Z0-9_]+[ \t]*;\\)" nil t) |
3781 | 3773 |
3782 ;;; provide ourself | 3774 ;;; provide ourself |
3783 | 3775 |
3784 (provide 'ada-mode) | 3776 (provide 'ada-mode) |
3785 | 3777 |
3786 ;;; package ada-mode ends here | 3778 ;;; ada-mode.el ends here |
3787 | |
3788 |