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

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

Re: Obtaining a Lisp form from a file


From: John Mastro
Subject: Re: Obtaining a Lisp form from a file
Date: Tue, 25 Jul 2017 10:31:46 -0700

Udyant Wig <udyant.wig@gmail.com> wrote:
> Is there a better way to write this?
>
> (let ((foo-buffer (get-buffer-create "*foo*"))
>       foo-form)
>   (with-current-buffer foo-buffer
>     (insert-file-contents foo-file))
>   (setq foo-form (read foo-buffer))
>   (kill-buffer foo-buffer)
>   foo-form)

(with-temp-buffer
  (insert-file-contents file)
  (read (current-buffer)))

Hope that helps

        John



reply via email to

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