]> git.notmuchmail.org Git - notmuch/blobdiff - test/test-lib.el
man: add references to maildir flag synchronization
[notmuch] / test / test-lib.el
index bc75f06e3ab8294e39416c73acd5e84a79823892..6271da22de4b97c2dbca1d37957a3b437af4833f 100644 (file)
@@ -51,16 +51,19 @@ FILENAME is OUTPUT."
     (with-temp-file (or filename "OUTPUT") (insert text))))
 
 (defun visible-buffer-string ()
-  "Same as `buffer-string', but excludes invisible text."
+  "Same as `buffer-string', but excludes invisible text and
+removes any text properties."
   (visible-buffer-substring (point-min) (point-max)))
 
 (defun visible-buffer-substring (start end)
-  "Same as `buffer-substring', but excludes invisible text."
+  "Same as `buffer-substring-no-properties', but excludes
+invisible text."
   (let (str)
     (while (< start end)
       (let ((next-pos (next-char-property-change start end)))
        (when (not (invisible-p start))
-         (setq str (concat str (buffer-substring start next-pos))))
+         (setq str (concat str (buffer-substring-no-properties
+                                start next-pos))))
        (setq start next-pos)))
     str))
 
@@ -89,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)))