unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Lillibridge <mark.lillibridge@hp.com>
To: schwab@linux-m68k.org, emacs-devel@gnu.org
Subject: Re: need help tracking down a subtle bug with unrmail/mail-strip-quoted-names
Date: Mon, 27 Dec 2010 15:56:09 -0800	[thread overview]
Message-ID: <qmhpqsm93dy.fsf@hp.com> (raw)
In-Reply-To: <qmh39pn83e2.fsf@hp.com> (message from Mark Lillibridge on Fri, 24 Dec 2010 09:52:21 -0800)


    Ah!  I found the bug.  I will submit a bug report with a patch, but
for those curious, here's what the problem was:

unrmail starts with a with-temp-buffer, which switches to the buffer
" *temp*" because it does not yet exist:

  (defmacro with-temp-buffer (&rest body)
    "Create a temporary buffer, and evaluate BODY there like `progn'.
  See also `with-temp-file' and `with-output-to-string'."
    (declare (indent 0) (debug t))
    (let ((temp-buffer (make-symbol "temp-buffer")))
      `(let ((,temp-buffer (generate-new-buffer " *temp*")))
         ;; FIXME: kill-buffer can change current-buffer in some odd cases.
         (with-current-buffer ,temp-buffer
           (unwind-protect
  	     (progn ,@body)
             (and (buffer-name ,temp-buffer)
                  (kill-buffer ,temp-buffer)))))))

When mail-strip-quoted-names does the following:

	   (with-current-buffer (get-buffer-create " *temp*")
	     (erase-buffer)
	     ...

it erases that buffer!  The code above is simply wrong as it erases a
possibly existing buffer.  It should be:

	   (with-temp-buffer
	      ...

This will not step on any existing buffers and avoids the need for
erasing any buffers.

- Mark



      reply	other threads:[~2010-12-27 23:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-24  3:32 need help tracking down a subtle bug with unrmail/mail-strip-quoted-names Mark Lillibridge
2010-12-24  8:14 ` Andreas Schwab
2010-12-24 17:52   ` Mark Lillibridge
2010-12-27 23:56     ` Mark Lillibridge [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=qmhpqsm93dy.fsf@hp.com \
    --to=mark.lillibridge@hp.com \
    --cc=emacs-devel@gnu.org \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).