help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatic matching parenthesis


From: Alan Mackenzie
Subject: Re: Automatic matching parenthesis
Date: Mon, 16 Mar 2009 11:36:46 +0000 (UTC)
User-agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386))

christopher.morris.cm@googlemail.com <christopher.morris.cm@googlemail.com> 
wrote:
> Hi,

> added these lines to my .emacs-file, so that parenthesis are
> automatically matched:
> (setq skeleton-pair t)
> (global-set-key (kbd "(") 'skeleton-pair-insert-maybe)
> (global-set-key (kbd "{") 'skeleton-pair-insert-maybe)

> But it does not work in cc-mode. Any idea?

Yes.  You've bound these keys in the global keymap.  However, CC Mode has
bound these keys in its local keymaps, and these take precedence over the
global keymap.  This is explained (a bit) on page "Keymaps" in the Emacs
manual, and explained much more thoroughly on the page "Keymaps" in the
Elisp manual.

Be aware that the CC Mode bindings for '(' and '{' have "electric"
action: they optionally trigger things like (re)indentation of the
current line, when appropriate.  This is explained in the CC Mode manual
on the page "Electric Keys".  If you rebind these keys, you will lose
this electric action.

> Regards,

> Chris

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]