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

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

Re: Something like read-file-into-string needed


From: Leo
Subject: Re: Something like read-file-into-string needed
Date: Fri, 05 Jan 2007 20:06:39 +0000
User-agent: Gnus v5.11, Emacs/23.0.0.1 (2007-01-01), Fedora 6 gnu/linux

* 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)





reply via email to

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