* Something like read-file-into-string needed
@ 2007-01-05 18:57 haws
2007-01-05 20:06 ` Leo
[not found] ` <mailman.2789.1168027612.2155.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 3+ messages in thread
From: haws @ 2007-01-05 18:57 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Something like read-file-into-string needed
2007-01-05 18:57 Something like read-file-into-string needed haws
@ 2007-01-05 20:06 ` Leo
[not found] ` <mailman.2789.1168027612.2155.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 3+ messages in thread
From: Leo @ 2007-01-05 20:06 UTC (permalink / raw)
* 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)
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.2789.1168027612.2155.help-gnu-emacs@gnu.org>]
* Re: Something like read-file-into-string needed
[not found] ` <mailman.2789.1168027612.2155.help-gnu-emacs@gnu.org>
@ 2007-01-05 20:41 ` haws
0 siblings, 0 replies; 3+ messages in thread
From: haws @ 2007-01-05 20:41 UTC (permalink / raw)
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-05 20:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-05 18:57 Something like read-file-into-string needed haws
2007-01-05 20:06 ` Leo
[not found] ` <mailman.2789.1168027612.2155.help-gnu-emacs@gnu.org>
2007-01-05 20:41 ` haws
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.