unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/4 v3] test: `notmuch-test-run' should protect against buffer switching.
Date: Thu, 26 Jan 2012 07:19:38 +0000	[thread overview]
Message-ID: <1327562380-12894-3-git-send-email-dme@dme.org> (raw)
In-Reply-To: <1327562380-12894-1-git-send-email-dme@dme.org>

The body of the test may cause the current buffer to change. Ensure
that the output goes to the correct buffer by switching back before
inserting it.
---
 test/test-lib.el |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 5b32e0a..6271da2 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -92,7 +92,9 @@ nothing."
 (defmacro notmuch-test-run (&rest body)
   "Evaluate a BODY of test expressions and output the result."
   `(with-temp-buffer
-     (let ((result (progn ,@body)))
+     (let ((buffer (current-buffer))
+	   (result (progn ,@body)))
+       (switch-to-buffer buffer)
        (insert (if (stringp result)
 		   result
 		 (prin1-to-string result)))
-- 
1.7.8.3

  parent reply	other threads:[~2012-01-26  7:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 15:05 [PATCH 1/1] emacs: Take more care when hiding regions with buttons David Edmondson
2012-01-25 15:10 ` Dmitry Kurochkin
2012-01-25 15:18   ` David Edmondson
2012-01-25 15:45 ` [PATCH 0/4 v2] " David Edmondson
2012-01-25 15:45   ` [PATCH 1/4 v2] test: `visible-buffer-substring' should not return text properties David Edmondson
2012-01-25 17:35     ` Dmitry Kurochkin
2012-01-25 15:45   ` [PATCH 2/4 v2] test: `notmuch-test-run' should protect against buffer switching David Edmondson
2012-01-25 17:36     ` Dmitry Kurochkin
2012-01-25 15:45   ` [PATCH 3/4 v2] test: Add test for Original Message hiding at point-min David Edmondson
2012-01-25 17:53     ` Dmitry Kurochkin
2012-01-26  7:22       ` David Edmondson
2012-01-25 15:45   ` [PATCH 4/4 v2] emacs: Take more care when hiding regions with buttons David Edmondson
2012-01-25 17:53     ` Dmitry Kurochkin
2012-01-26  7:19 ` [PATCH 0/4 v3] " David Edmondson
2012-01-26  7:19   ` [PATCH 1/4 v3] test: `visible-buffer-substring' should not return text properties David Edmondson
2012-01-26  7:19   ` David Edmondson [this message]
2012-01-26  7:19   ` [PATCH 3/4 v3] test: Add test for Original Message hiding at point-min David Edmondson
2012-01-26  7:19   ` [PATCH 4/4 v3] emacs: Take more care when hiding regions with buttons David Edmondson
2012-01-26 12:40   ` [PATCH 0/4 v3] " David Bremner
2012-01-30 12:27   ` Dmitry Kurochkin

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://notmuchmail.org/

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

  git send-email \
    --in-reply-to=1327562380-12894-3-git-send-email-dme@dme.org \
    --to=dme@dme.org \
    --cc=notmuch@notmuchmail.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://yhetil.org/notmuch.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).