From: David Hansen <david.hansen@gmx.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Efficiently checking the initial contents of a file
Date: Fri, 16 May 2008 13:12:58 +0200 [thread overview]
Message-ID: <873aoi5wp1.fsf@localhorst.mine.nu> (raw)
In-Reply-To: 5f8b772a-e2ed-468c-89b3-2d9e40ed132b@m3g2000hsc.googlegroups.com
On Fri, 16 May 2008 03:16:13 -0700 (PDT) Nordlöw wrote:
> How can I efficiently using pure emacs-lisp (without calling any
> external process) investigate the first bytes of a file?
>
> My guess is
> - Open parts of the file into a buffer or string.
> - Alt 1. Switch to the buffer and do things.
(with-temp-buffer
;; Read the first 42 characters (not bytes) into the temp buffer.
(insert-file-contents filename nil 0 42)
;; Do whatever you want to do here.
)
David
next prev parent reply other threads:[~2008-05-16 11:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-16 10:16 Efficiently checking the initial contents of a file Nordlöw
2008-05-16 11:08 ` Juanma Barranquero
2008-05-16 11:12 ` David Hansen [this message]
2008-05-16 11:15 ` Eli Zaretskii
[not found] ` <mailman.11680.1210937109.18990.help-gnu-emacs@gnu.org>
2008-05-16 12:52 ` Nordlöw
2008-05-16 14:03 ` Juanma Barranquero
[not found] ` <mailman.11696.1210946594.18990.help-gnu-emacs@gnu.org>
2008-05-19 7:20 ` Nordlöw
2008-05-22 16:58 ` Thien-Thi Nguyen
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=873aoi5wp1.fsf@localhorst.mine.nu \
--to=david.hansen@gmx.net \
--cc=help-gnu-emacs@gnu.org \
/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.