emacs-devel
[Top][All Lists]
Advanced

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

Re: with-temp-buffer, insert-file-content and errors


From: Stefan Monnier
Subject: Re: with-temp-buffer, insert-file-content and errors
Date: Tue, 19 Jul 2005 10:34:50 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> drkm was using code from my emacs-wiki program as an example for this.
> You're right in that using a non-nil VISIT argument was a bad idea.
> I've also worked around the "prompted to save a temp buffer" problem
> by making a macro called `emacs-wiki-with-temp-buffer' as follows.
> The condition-case call is mainly used for displaying diagnostic
> information, so it might not be generally useful.  A part of the
> cleanup code,

>          (when (buffer-live-p ,temp-buffer)
>            (with-current-buffer ,temp-buffer
>              (set-buffer-modified-p nil))
>            (... (kill-buffer ,temp-buffer)))

A temp buffer's buffer-file-name should be nil.  Otherwise, it doesn't
deserve the name "temporary".  So the above is a bad idea since it will hide
bugs like the one where you've set the VISIT arg to non-nil.


        Stefan




reply via email to

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