unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Automatic matching parenthesis
Date: Tue, 17 Mar 2009 22:05:09 -0600	[thread overview]
Message-ID: <gpprt8$au8$1@ger.gmane.org> (raw)
In-Reply-To: <92d4e18b-c878-4be0-b3ef-0e07c7a77a10@d19g2000yqb.googlegroups.com>

christopher.morris.cm@googlemail.com wrote:
> On 16 Mrz., 11:24, Andy Stewart <lazycat.mana...@gmail.com> wrote:
>> "christopher.morris...@googlemail.com"
>>
>> <christopher.morris...@googlemail.com> writes:
>>> 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?
>> Why not use paredit.el?
>> Athttp://www.emacswiki.org/emacs/ParEdit
>>
>> It can complete your parenthesis, it won't complete paranthesis when you
>> type in comment.
>>
>> I think paredit.el is very nice for parenthesis completion.
>>
>> Regards,
>>
>>   -- Andy
> 
> Thanks alot. But I cant figure out, how to enable paredit alway in c-
> mode. I tried:
> (add-hook c-mode-hook (lambda () (paredit-mode +1))). I get an error
> message starting up emacs. Any idea?

emacs --debug-init will show you the error, and then you can show us so
we don't have to guess.

But one thing is apparent: add-hook is a function, so all its arguments
are evaluated, so you need to quote the c-mode-hook symbol:

(add-hook 'c-mode-hook (lambda () (paredit-mode +1)))

-- 
Kevin Rodgers
Denver, Colorado, USA





  parent reply	other threads:[~2009-03-18  4:05 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 [this message]
2009-03-16 11:36 ` Alan Mackenzie

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='gpprt8$au8$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).