all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "haws" <hugows@gmail.com>
Subject: Re: Something like read-file-into-string needed
Date: 5 Jan 2007 12:41:31 -0800	[thread overview]
Message-ID: <1168029691.097537.81940@i15g2000cwa.googlegroups.com> (raw)
In-Reply-To: <mailman.2789.1168027612.2155.help-gnu-emacs@gnu.org>

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)

      parent reply	other threads:[~2007-01-05 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1168029691.097537.81940@i15g2000cwa.googlegroups.com \
    --to=hugows@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.