help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inserting standard text


From: james
Subject: Re: Inserting standard text
Date: 26 Apr 2007 12:28:36 -0700
User-agent: G2/1.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]