[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Automatically Close Brace in C++ Mode
From: |
Stefan Monnier |
Subject: |
Re: Automatically Close Brace in C++ Mode |
Date: |
09 Jun 2003 09:42:15 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
>>>>> "shawshank" == shawshank <schung@sprint.ca> writes:
> Is there a way to make emacs print a closing brace as soon as the
> opening brace is typed?
(setq skeleton-pair t)
(global-set-key "(" 'skeleton-pair-insert-maybe)
(global-set-key "[" 'skeleton-pair-insert-maybe)
(global-set-key "{" 'skeleton-pair-insert-maybe)
But since C++ mode rebinds most of these keys, you need to overrule
those bindings with your own:
(add-hook 'c-common-mode-hook
(lambda ()
(local-set-key "(" 'skeleton-pair-insert-maybe)
(local-set-key "[" 'skeleton-pair-insert-maybe)
(local-set-key "{" 'skeleton-pair-insert-maybe)))
-- Stefan