mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-04 06:31:13 -08:00
* lisp/progmodes/ada-mode.el (comment-region): Avoid defadvice
Don't load 'advice' if it won't be used!
This commit is contained in:
parent
628102f6f4
commit
e6380c4333
1 changed files with 12 additions and 10 deletions
|
|
@ -4519,6 +4519,7 @@ Moves to `begin' if in a declarative part."
|
|||
(define-key ada-mode-map "\C-c\C-n" 'ada-make-subprogram-body)
|
||||
|
||||
;; Use predefined function of Emacs19 for comments (RE)
|
||||
;; FIXME: Made redundant with Emacs-21's standard comment-dwim binding on M-;
|
||||
(define-key ada-mode-map "\C-c;" 'comment-region)
|
||||
(define-key ada-mode-map "\C-c:" 'ada-uncomment-region)
|
||||
|
||||
|
|
@ -4756,16 +4757,17 @@ Moves to `begin' if in a declarative part."
|
|||
;; function for justifying the comments.
|
||||
;; -------------------------------------------------------
|
||||
|
||||
(defadvice comment-region (before ada-uncomment-anywhere disable)
|
||||
(if (and (consp arg) ;; a prefix with \C-u is of the form '(4), whereas
|
||||
;; \C-u 2 sets arg to '2' (fixed by S.Leake)
|
||||
(derived-mode-p 'ada-mode))
|
||||
(save-excursion
|
||||
(let ((cs (concat "^[ \t]*" (regexp-quote comment-start))))
|
||||
(goto-char beg)
|
||||
(while (re-search-forward cs end t)
|
||||
(replace-match comment-start))
|
||||
))))
|
||||
(when (or (<= emacs-major-version 20) (featurep 'xemacs))
|
||||
(defadvice comment-region (before ada-uncomment-anywhere disable)
|
||||
(if (and (consp arg) ;; a prefix with \C-u is of the form '(4), whereas
|
||||
;; \C-u 2 sets arg to '2' (fixed by S.Leake)
|
||||
(derived-mode-p 'ada-mode))
|
||||
(save-excursion
|
||||
(let ((cs (concat "^[ \t]*" (regexp-quote comment-start))))
|
||||
(goto-char beg)
|
||||
(while (re-search-forward cs end t)
|
||||
(replace-match comment-start))
|
||||
)))))
|
||||
|
||||
(defun ada-uncomment-region (beg end &optional arg)
|
||||
"Uncomment region BEG .. END.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue