unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: james <james.kingston@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Inserting standard text
Date: 26 Apr 2007 12:28:36 -0700	[thread overview]
Message-ID: <1177615716.041743.18660@r30g2000prh.googlegroups.com> (raw)
In-Reply-To: <1177579177.662475.118650@n15g2000prd.googlegroups.com>

Google Groups has been brutally slow to update, so this may have been
answered already by people with real usenet providers.

If your needs are as simple as you imply, you could do something like:
(add-hook 'c-mode-common-hook
 '(lambda ()
 (local-set-key (kbd "<f7>")
  '(lambda ()
   (interactive)
   (insert "#ifdef DEBUG\nprintf(\"TRACE:%s:%d\\n\",__FILE__,__LINE__);
\n#endif\n")))))

But for keyboard lightning I prefer msf-abbrev.el, which takes emacs'
built in support for abbrevs, and adds tabbing between fields, choice
lists, and executing elisp.  To do something like the above,  you
could set it up so that if you type "dx" then a space, it would expand
in place to the three lines in the insert statement above.

Check out the demo:  http://www.bloomington.in.us/~brutt/msf-abbrev.html

jk

  parent reply	other threads:[~2007-04-26 19:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-26  9:19 Inserting standard text anders
2007-04-26 13:05 ` B. T. Raven
2007-04-26 19:28 ` james [this message]
2007-04-26 23:51 ` Tim X
2007-04-27  4:33   ` Drew Adams
2007-04-27  6:17 ` Maciej Katafiasz
2007-04-27  7:40 ` roodwriter

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=1177615716.041743.18660@r30g2000prh.googlegroups.com \
    --to=james.kingston@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).