emacs-devel
[Top][All Lists]
Advanced

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

Re: Please try Pmail


From: Stefan Monnier
Subject: Re: Please try Pmail
Date: Tue, 20 Jan 2009 21:37:49 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> /* 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;
> }

Duh! I tested saving, and checked that the file's contents was right,
but never noticed this.  It turns out that this code is used by
format-annotate-function, so there's a good reason for it to be there.

We should try to find a way to get both cases working right (and even
the case where build_annotations switched buffers more than once,
ideally).

The cleanest solution is to let build_annotations_unwind run some
buffer-local hook function (e.g. write-region-post-annotate-function),
which can either run kill-buffer, and/or re-narrow the buffer, and/or
kill previous buffers.  The current code already allows it via
kill-buffer-hook, but using that is ugly and will lead to
other surprises.


        Stefan




reply via email to

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