[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Something like read-file-into-string needed
From: |
haws |
Subject: |
Re: Something like read-file-into-string needed |
Date: |
5 Jan 2007 12:41:31 -0800 |
User-agent: |
G2/1.0 |
Thank you very much!
And just learned two nice tricks!
Leo escreveu:
> * Haws (2007-01-05 10:57 -0800) said:
> ^^^^
> > Hello everyone!
> >
> > I've been trying out the snippet.el package which lets you insert
> > templates nicely. But now I have a "big" template (like 100 lines)
> > that I don't want to put inline in my lisp function. Instead, I'd
> > like to have it in a file, and read this file contents into a
> > string. Once in a string, I could use the regular command,
> > snippet-insert, to insert my template. I've found no way to do that
> > (only to insert the file into a buffer, which doesn't solve my
> > problem.)
> >
> > Any tips, ideas?
> >
> > Thanks in advance,
> >
> > Hugo
>
> (defun read-file-into-string (file)
> (interactive "f")
> (with-temp-buffer
> (insert-file-contents file)
> (buffer-string)))
>
> --
> Leo <sdl.web AT gmail.com> (GPG Key: 9283AA3F)