From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: with-temp-buffer, insert-file-content and errors Date: Tue, 19 Jul 2005 10:34:50 -0400 Message-ID: <87fyuag90y.fsf-monnier+emacs@gnu.org> References: <87k6jn90bh.fsf@tuxtanker.mwolson.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1121785052 17528 80.91.229.2 (19 Jul 2005 14:57:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 19 Jul 2005 14:57:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 19 16:57:30 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DutVv-0005Hl-Hn for ged-emacs-devel@m.gmane.org; Tue, 19 Jul 2005 16:56:07 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DutXs-0000No-VW for ged-emacs-devel@m.gmane.org; Tue, 19 Jul 2005 10:58:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DutUH-0007nA-Hf for emacs-devel@gnu.org; Tue, 19 Jul 2005 10:54:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DutTm-0007g8-2C for emacs-devel@gnu.org; Tue, 19 Jul 2005 10:54:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DutTi-0007Yd-PO for emacs-devel@gnu.org; Tue, 19 Jul 2005 10:53:50 -0400 Original-Received: from [209.226.175.4] (helo=tomts16-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DutKX-0005Jg-Cg; Tue, 19 Jul 2005 10:44:21 -0400 Original-Received: from alfajor ([67.68.217.253]) by tomts16-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050719143451.LJMX27508.tomts16-srv.bellnexxia.net@alfajor>; Tue, 19 Jul 2005 10:34:51 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id C1285D7571; Tue, 19 Jul 2005 10:34:50 -0400 (EDT) Original-To: Michael Olson In-Reply-To: <87k6jn90bh.fsf@tuxtanker.mwolson.org> (Michael Olson's message of "Mon, 18 Jul 2005 18:11:30 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:41074 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41074 > 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