From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: Re: Automatic matching parenthesis Date: Mon, 16 Mar 2009 11:36:46 +0000 (UTC) Organization: muc.de e.V. Message-ID: References: NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1237203703 4480 80.91.229.12 (16 Mar 2009 11:41:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Mar 2009 11:41:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 16 12:43:00 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LjBDX-0003W0-7Z for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Mar 2009 12:42:51 +0100 Original-Received: from localhost ([127.0.0.1]:59188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LjBCB-0007dW-2m for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Mar 2009 07:41:27 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!ecngs!feeder.ecngs.de!news.osn.de!diablo2.news.osn.de!news.space.net!news.muc.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: marvin.muc.de Original-X-Trace: colin2.muc.de 1237203406 67753 2001:608:1000::2 (16 Mar 2009 11:36:46 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: Mon, 16 Mar 2009 11:36:46 +0000 (UTC) User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (FreeBSD/4.11-RELEASE (i386)) Original-Xref: news.stanford.edu gnu.emacs.help:167676 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:62971 Archived-At: 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).