* Automatically Close Brace in C++ Mode
@ 2003-06-09 2:00 shawshank
2003-06-09 9:06 ` Tim X
2003-06-09 13:42 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: shawshank @ 2003-06-09 2:00 UTC (permalink / raw)
Hi Folks,
Is there a way to make emacs print a closing brace as soon as the
opening brace is typed?
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Automatically Close Brace in C++ Mode
2003-06-09 2:00 Automatically Close Brace in C++ Mode shawshank
@ 2003-06-09 9:06 ` Tim X
2003-06-09 13:42 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Tim X @ 2003-06-09 9:06 UTC (permalink / raw)
>>>>> "shawshank" == shawshank <schung@sprint.ca> writes:
shawshank> Hi Folks, Is there a way to make emacs print a closing
shawshank> brace as soon as the opening brace is typed?
Its been a while since I've done any C/C++, but I think one of the
"electric" options for the mode will do this. Check out the
customize-group for the mode and enable some of the electric stuff.
Tim
--
Tim Cross
The e-mail address on this message is FALSE (obviously!). My real e-mail is
to a company in Australia called rapttech and my login is tcross - if you
really need to send mail, you should be able to work it out!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Automatically Close Brace in C++ Mode
2003-06-09 2:00 Automatically Close Brace in C++ Mode shawshank
2003-06-09 9:06 ` Tim X
@ 2003-06-09 13:42 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2003-06-09 13:42 UTC (permalink / raw)
>>>>> "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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-09 13:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-09 2:00 Automatically Close Brace in C++ Mode shawshank
2003-06-09 9:06 ` Tim X
2003-06-09 13:42 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.