[Top][All Lists]

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

Re: Reading file in emacs

From: Dirk-Jan C . Binnema
Subject: Re: Reading file in emacs
Date: Wed, 23 Jun 2010 08:13:36 +0300
User-agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/24.0 Mule/6.0 (HANACHIRUSATO)

>>>>> On Tue, 22 Jun 2010 22:05:18 -0600, Qiang Guo ("QG") wrote:

  QG> Hi,
  QG> I'm wondering if there is a way to read the content of files, say, to a
  QG> variable rather than a buffer ? Of course, one way to do
  QG> this is first read file into buffer and then edit the
  QG> buffer. Here comes my second question, how to process file
  QG> in a byte-by-byte fashion, for instance, instead of editing
  QG> a line of text, I'd like to edit directly their binary
  QG> representations ?

I'd bet there are more elegant (elispy) ways to do this, but to read a file
into a variable, you could do something like:

    (setq filedata (shell-command-to-string "cat /foo/bar/myfile"))
Best wishes,

Dirk-Jan C. Binnema                  Helsinki, Finland 
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

reply via email to

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