From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Please try Pmail Date: Tue, 20 Jan 2009 09:20:38 -0500 Message-ID: <87eiyyvz2h.fsf@cyd.mit.edu> References: <87r6303c31.fsf@cyd.mit.edu> <87ljt83svc.fsf@cyd.mit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1232461666 3283 80.91.229.12 (20 Jan 2009 14:27:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Jan 2009 14:27:46 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 20 15:28:58 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LPHb2-00019c-Je for ged-emacs-devel@m.gmane.org; Tue, 20 Jan 2009 15:28:55 +0100 Original-Received: from localhost ([127.0.0.1]:47502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPHZj-0003zA-Be for ged-emacs-devel@m.gmane.org; Tue, 20 Jan 2009 09:27:31 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPHSl-000095-Ig for emacs-devel@gnu.org; Tue, 20 Jan 2009 09:20:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPHSj-00007w-VX for emacs-devel@gnu.org; Tue, 20 Jan 2009 09:20:19 -0500 Original-Received: from [199.232.76.173] (port=53433 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPHSj-00007q-M2 for emacs-devel@gnu.org; Tue, 20 Jan 2009 09:20:17 -0500 Original-Received: from cyd.mit.edu ([18.115.2.24]:58714) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPHSh-0005jK-R9; Tue, 20 Jan 2009 09:20:15 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 981E357E21E; Tue, 20 Jan 2009 09:20:38 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Mon, 19 Jan 2009 23:57:08 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:108013 Archived-At: After further investigation, I tracked down the problem with using write-region-annotate-functions in pmail. Actually, calling `widen' in the annotation function causes the file to be saved correctly; the reason pmail is unable to recover its state after saving is not that the restrictions in the swapped buffer are wrong. The problem is that swapping to a different buffer in an annotation function causes that buffer to be killed! The docstring to write-region-annotate-functions does not say that swapping to a different buffer causes that buffer to be killed afterwards. What is the purpose of this? Here is the relevant code from build_annotations_unwind (fileio.c:4256): /* If build_annotations switched buffers, switch back to BUF. Kill the temporary buffer that was selected in the meantime. Since this kill only the last temporary buffer, some buffers remain not killed if build_annotations switched buffers more than once. -- K.Handa */ static Lisp_Object build_annotations_unwind (buf) Lisp_Object buf; { Lisp_Object tembuf; if (XBUFFER (buf) == current_buffer) return Qnil; tembuf = Fcurrent_buffer (); Fset_buffer (buf); Fkill_buffer (tembuf); return Qnil; }