[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 23:09:11 -0400

    (defmacro with-file (file &rest body)
      "Run BODY in a buffer visiting FILE.
    If the buffer was not open before calling this macro, it's killed
      (let ((file-sym (make-symbol "file"))
            (existsp-sym (make-symbol "existsp"))
            (buf-sym (make-symbol "buf")))
        `(let* ((,file-sym ,file)
                (,existsp-sym (get-file-buffer ,file-sym))
                (,buf-sym (find-file-noselect ,file-sym)))

Using find-file-noselect could be the right thing in some cases,
but there are many cases (especially where you just read the file
or scan it quickly) where that is much too heavy.

reply via email to

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