all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carsten Burstedde <bursted@iam.uni-bonn.de>
Subject: Re: C-mode electric braces
Date: Wed, 11 Sep 2002 17:07:11 +0200	[thread overview]
Message-ID: <3D7F5C1F.2020507@iam.uni-bonn.de> (raw)
In-Reply-To: 20020911141602.25522.35321.Mailman@monty-python.gnu.org

 > So, what you can do is something like follows:

,----
| (local-set-key (kbd "C-7") #'(lambda ()
|                               (interactive)
|                               ;; inserting the first electric { with
|                               ;; behavior as customized with cc-mode
|                               ;; options
|                               (execute-kbd-macro "{")
|                               (save-excursion
|                                 ;; inserting a temporary ; so the 
following
|                                 ;; closing brace is working correctly
|                                 (execute-kbd-macro ";")
|                                 ;; inserting the closing electric } with
|                                 ;; behavior as customized with cc-mode
|                                 ;; options
|                                 (execute-kbd-macro "}"))
|                               ;; now we remove the temp. inserted ;
|                               (delete-char 1)))
`----

Thanks, this does precisely what I wanted!

Just curious: How do I make execute-kbd-macro simulate a return press? I 
made several tries, but it did not work. And what does the # in front of 
the '(lambda ?

Carsten

       reply	other threads:[~2002-09-11 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20020911141602.25522.35321.Mailman@monty-python.gnu.org>
2002-09-11 15:07 ` Carsten Burstedde [this message]
     [not found] ` <mailman.1031756888.28531.help-gnu-emacs@gnu.org>
2002-09-11 15:46   ` C-mode electric braces Klaus Berndl
     [not found] <20020910141602.24672.83238.Mailman@monty-python.gnu.org>
2002-09-11  9:37 ` Carsten Burstedde
     [not found] ` <mailman.1031737090.30427.help-gnu-emacs@gnu.org>
2002-09-11 11:45   ` Klaus Berndl
2002-09-11 17:54   ` Alan Mackenzie
     [not found] <mailman.1031651288.3988.help-gnu-emacs@gnu.org>
2002-09-10 12:11 ` Kai Großjohann
2002-09-10  9:47 Carsten Burstedde

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=3D7F5C1F.2020507@iam.uni-bonn.de \
    --to=bursted@iam.uni-bonn.de \
    /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.