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

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

Re: a function to enter string


From: Gordon Beaton
Subject: Re: a function to enter string
Date: 20 Feb 2007 08:30:19 GMT
User-agent: slrn/0.9.7.4 (Linux)

On 20 Feb 2007 07:27:52 +1100, Gary Wessle wrote:
> I have this key macro in my emacs which puts "#include <string>" 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


reply via email to

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