From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Gordon Beaton Newsgroups: gmane.emacs.help Subject: Re: a function to enter string Date: 20 Feb 2007 08:30:19 GMT Organization: - Message-ID: <45dab19b$0$24616$8404b019@news.wineasy.se> References: NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1171960943 4378 80.91.229.12 (20 Feb 2007 08:42:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 20 Feb 2007 08:42:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 20 09:42:17 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HJQZk-0000rt-Pk for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Feb 2007 09:42:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HJQZk-0002ht-2q for geh-help-gnu-emacs@m.gmane.org; Tue, 20 Feb 2007 03:42:16 -0500 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newsfeed.media.kyoto-u.ac.jp!news.cc.tut.fi!fi.sn.net!newsfeed1.fi.sn.net!news.song.fi!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: slrn/0.9.7.4 (Linux) Original-Lines: 27 Original-NNTP-Posting-Host: cube.smaltan.org Original-X-Trace: 1171960219 news.wineasy.se 24616 195.42.215.17:63841 Original-X-Complaints-To: abuse@tdcsong.se Original-Xref: shelby.stanford.edu gnu.emacs.help:145738 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:41343 Archived-At: On 20 Feb 2007 07:27:52 +1100, Gary Wessle wrote: > I have this key macro in my emacs which puts "#include " in > the first blank line in the buffer, also another key macro which > puts the string "std::string" at the point. Not really what you're asking, but I use the autoinsert package for things like that. Just create a template and it will be loaded whenever you create new files of the given type. (require 'autoinsert) (add-hook 'find-file-hooks 'auto-insert) (setq auto-insert-directory "~/.emacs.d/insert/") (define-auto-insert "\\.sh\\'" "sh-insert.sh") (define-auto-insert "\\.tex\\'" "tex-insert.tex") (define-auto-insert "\\.el\\'" "el-insert.el") (define-auto-insert "\\.c\\'" "c-insert.c") ;; With autoinsert you can insert dynamic content as well, for example when you create a Java file it can insert a correctly named class declaration based on the filename, and then leave the cursor where you want to start typing. /gordon -- [ don't email me support questions or followups ] g o r d o n + n e w s @ b a l d e r 1 3 . s e