all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Automatic matching parenthesis
Date: Mon, 16 Mar 2009 11:36:46 +0000 (UTC)	[thread overview]
Message-ID: <gpldke$2259$1@colin2.muc.de> (raw)
In-Reply-To: cc03c0bc-477c-4012-bf2f-dd219da0f8eb@p20g2000yqi.googlegroups.com

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).



      parent reply	other threads:[~2009-03-16 11:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-15 23:31 Automatic matching parenthesis christopher.morris.cm
2009-03-16 10:24 ` Andy Stewart
     [not found] ` <mailman.3311.1237199154.31690.help-gnu-emacs@gnu.org>
2009-03-16 11:02   ` christopher.morris.cm
2009-03-16 11:24     ` Alan Mackenzie
2009-03-18  4:05     ` Kevin Rodgers
2009-03-16 11:36 ` Alan Mackenzie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='gpldke$2259$1@colin2.muc.de' \
    --to=acm@muc.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.