]> git.notmuchmail.org Git - notmuch/commitdiff
notmuch show: Switch to control character to mark sections of output
authorCarl Worth <cworth@cworth.org>
Tue, 3 Nov 2009 05:13:19 +0000 (21:13 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 3 Nov 2009 05:13:19 +0000 (21:13 -0800)
We were previously using things like "%message{" which were not
guaranteed to never appear in an email message. Using a control
character (^L or '\f' instead of '%') gives us better assurance that
our delimiter doesn't show up in an original email message.

This still isn't entirely safe since we're decoding encoded text in
the body of the email message so almost all bets are off really.

notmuch.c
notmuch.el

index 30b3bbac9d9ed53dc9404e6f8635f9c091f24f23..581592c4f926aa1c391438a0c2d65fb766da3c95 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -952,18 +952,18 @@ show_message_part (GMimeObject *part, int *part_count)
        const char *filename = g_mime_part_get_filename (GMIME_PART (part));
        content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
 
        const char *filename = g_mime_part_get_filename (GMIME_PART (part));
        content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
 
-       printf ("%%attachment{ ID: %d, Content-type: %s, ",
+       printf ("\fattachment{ ID: %d, Content-type: %s, ",
                *part_count,
                g_mime_content_type_to_string (content_type));
        printf ("Filename: %s ", filename);
                *part_count,
                g_mime_content_type_to_string (content_type));
        printf ("Filename: %s ", filename);
-       printf ("%%attachment}\n");
+       printf ("\fattachment}\n");
 
        return;
     }
 
     content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
 
 
        return;
     }
 
     content_type = g_mime_object_get_content_type (GMIME_OBJECT (part));
 
-    printf ("%%part{ ID: %d, Content-type: %s\n",
+    printf ("\fpart{ ID: %d, Content-type: %s\n",
            *part_count,
            g_mime_content_type_to_string (content_type));
 
            *part_count,
            g_mime_content_type_to_string (content_type));
 
@@ -978,7 +978,7 @@ show_message_part (GMimeObject *part, int *part_count)
            g_mime_data_wrapper_write_to_stream (wrapper, stream);
     }
 
            g_mime_data_wrapper_write_to_stream (wrapper, stream);
     }
 
-    printf ("%%part}\n");
+    printf ("\fpart}\n");
 
     g_object_unref (stream);
 }
 
     g_object_unref (stream);
 }
@@ -1081,9 +1081,9 @@ show_command (void *ctx, unused (int argc), unused (char *argv[]))
     {
        message = notmuch_messages_get (messages);
 
     {
        message = notmuch_messages_get (messages);
 
-       printf ("%%message{\n");
+       printf ("\fmessage{\n");
 
 
-       printf ("%%header{\n");
+       printf ("\fheader{\n");
 
        printf ("%s\n", _get_one_line_summary (local, message));
 
 
        printf ("%s\n", _get_one_line_summary (local, message));
 
@@ -1094,11 +1094,11 @@ show_command (void *ctx, unused (int argc), unused (char *argv[]))
                printf ("%s: %s\n", name, value);
        }
 
                printf ("%s: %s\n", name, value);
        }
 
-       printf ("%%header}\n");
+       printf ("\fheader}\n");
 
        show_message_body (notmuch_message_get_filename (message));
 
 
        show_message_body (notmuch_message_get_filename (message));
 
-       printf ("%%message}\n");
+       printf ("\fmessage}\n");
 
        notmuch_message_destroy (message);
     }
 
        notmuch_message_destroy (message);
     }
index 9c3c1e065c870bf9f9fe24c5139d08183c775861..00a03c0ed7c1ea979f417ecc8a346b0a064bd2ef 100644 (file)
@@ -41,7 +41,7 @@
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
 
   "Keymap for \"notmuch show\" buffers.")
 (fset 'notmuch-show-mode-map notmuch-show-mode-map)
 
-(defvar notmuch-show-message-begin-regexp "%message{")
+(defvar notmuch-show-message-begin-regexp "\fmessage{")
 
 (defun notmuch-show-next-message ()
   "Advance point to the beginning of the next message in the buffer."
 
 (defun notmuch-show-next-message ()
   "Advance point to the beginning of the next message in the buffer."