aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/ada-mode.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index 76c9be93d03..fd6a2b0b2da 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -4519,6 +4519,7 @@ Moves to `begin' if in a declarative part."
4519 (define-key ada-mode-map "\C-c\C-n" 'ada-make-subprogram-body) 4519 (define-key ada-mode-map "\C-c\C-n" 'ada-make-subprogram-body)
4520 4520
4521 ;; Use predefined function of Emacs19 for comments (RE) 4521 ;; Use predefined function of Emacs19 for comments (RE)
4522 ;; FIXME: Made redundant with Emacs-21's standard comment-dwim binding on M-;
4522 (define-key ada-mode-map "\C-c;" 'comment-region) 4523 (define-key ada-mode-map "\C-c;" 'comment-region)
4523 (define-key ada-mode-map "\C-c:" 'ada-uncomment-region) 4524 (define-key ada-mode-map "\C-c:" 'ada-uncomment-region)
4524 4525
@@ -4756,16 +4757,17 @@ Moves to `begin' if in a declarative part."
4756;; function for justifying the comments. 4757;; function for justifying the comments.
4757;; ------------------------------------------------------- 4758;; -------------------------------------------------------
4758 4759
4759(defadvice comment-region (before ada-uncomment-anywhere disable) 4760(when (or (<= emacs-major-version 20) (featurep 'xemacs))
4760 (if (and (consp arg) ;; a prefix with \C-u is of the form '(4), whereas 4761 (defadvice comment-region (before ada-uncomment-anywhere disable)
4761 ;; \C-u 2 sets arg to '2' (fixed by S.Leake) 4762 (if (and (consp arg) ;; a prefix with \C-u is of the form '(4), whereas
4762 (derived-mode-p 'ada-mode)) 4763 ;; \C-u 2 sets arg to '2' (fixed by S.Leake)
4763 (save-excursion 4764 (derived-mode-p 'ada-mode))
4764 (let ((cs (concat "^[ \t]*" (regexp-quote comment-start)))) 4765 (save-excursion
4765 (goto-char beg) 4766 (let ((cs (concat "^[ \t]*" (regexp-quote comment-start))))
4766 (while (re-search-forward cs end t) 4767 (goto-char beg)
4767 (replace-match comment-start)) 4768 (while (re-search-forward cs end t)
4768 )))) 4769 (replace-match comment-start))
4770 )))))
4769 4771
4770(defun ada-uncomment-region (beg end &optional arg) 4772(defun ada-uncomment-region (beg end &optional arg)
4771 "Uncomment region BEG .. END. 4773 "Uncomment region BEG .. END.