unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Missing `with' macro?
@ 2006-07-24 10:17 Mathias Dahl
  2006-07-24 13:46 ` Stefan Monnier
  2006-07-24 18:22 ` Richard Stallman
  0 siblings, 2 replies; 18+ messages in thread
From: Mathias Dahl @ 2006-07-24 10:17 UTC (permalink / raw)


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)

I really like the different `with' macros that Emacs has and was
surprised there wasn't any `with-file' macro, that could be callable
like this:

(with-file tumme-db-file
  ;; do stuff)

It could have two modes, reading and writing as sometimes you just
want to use the information in the opened file, not write back to it.

I guess what I want is this, without the call to `insert-file-contents':

(with-temp-file tumme-db-file
  (insert-file-contents tumme-db-file)
  ;; do stuff)

What do others think? Is the with-temp-file + insert-file-contents combo enough?

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-08-17 15:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-24 10:17 Missing `with' macro? Mathias Dahl
2006-07-24 13:46 ` Stefan Monnier
2006-07-24 14:33   ` Mathias Dahl
2006-07-24 18:22 ` Richard Stallman
2006-07-24 20:55   ` Jorgen Schaefer
2006-07-25  3:09     ` Richard Stallman
2006-07-28  2:14   ` Stuart D. Herring
2006-07-28  2:23     ` Stuart D. Herring
2006-07-29 15:18     ` Richard Stallman
2006-08-01  1:06       ` Stuart D. Herring
2006-08-07  5:01         ` Richard Stallman
2006-08-07 21:38           ` Stuart D. Herring
2006-08-08 18:01             ` Richard Stallman
2006-08-08 18:32               ` Stuart D. Herring
2006-08-09  4:58                 ` Richard Stallman
2006-08-08 18:01             ` Richard Stallman
2006-08-16 19:59               ` Stuart D. Herring
2006-08-17 15:18                 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).