[Top][All Lists]

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

Re: Missing `with' macro?

From: Richard Stallman
Subject: Re: Missing `with' macro?
Date: Mon, 24 Jul 2006 14:22:39 -0400

    I am currently optimizing some defuns in tumme.el and found that I do
    the following repeatdely:

     (setq buf (find-file tumme-db-file))
     ;; do a lot of stuff in it
     (save-buffer) ;; optionally
     (kill-buffer buf)

We don't usually call find-file for such temporary purposes.
We usually use code like this:

       (insert-file-contents file)
       operate on the file)

except that if the file's already visited in a buffer,
it is more efficient to use that buffer (and not kill it).

To develop a general macro for this would be useful.  It is not a
trivial thing.  Please start working on it if you want.  The case of
just examining a file without altering it, since that is more common,
and easier.  I suspect that we may need two totally different macros
for the read-only case and the case of altering the file.

reply via email to

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