From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AD8FF431FD6 for ; Sat, 7 Apr 2012 17:58:07 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MwBgVNUQTxfb for ; Sat, 7 Apr 2012 17:58:05 -0700 (PDT) Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU [18.7.68.36]) by olra.theworths.org (Postfix) with ESMTP id B8803431FDE for ; Sat, 7 Apr 2012 17:58:00 -0700 (PDT) X-AuditID: 12074424-b7fae6d000000906-a9-4f80e2987e10 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP id DD.C3.02310.892E08F4; Sat, 7 Apr 2012 20:58:00 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q380vxZh007776; Sat, 7 Apr 2012 20:57:59 -0400 Received: from drake.mit.edu (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q380vw6r002169 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 7 Apr 2012 20:57:59 -0400 (EDT) Received: from amthrax by drake.mit.edu with local (Exim 4.77) (envelope-from ) id 1SGgS6-0001SY-Cz; Sat, 07 Apr 2012 20:57:58 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 5/6] show: Support NULL values for message_set_{start, sep, end} Date: Sat, 7 Apr 2012 20:57:49 -0400 Message-Id: <1333846670-5356-6-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1333846670-5356-1-git-send-email-amdragon@mit.edu> References: <1333846670-5356-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsUixG6nrjvjUYO/Qf8XeYvrN2cyOzB6PFt1 izmAMYrLJiU1J7MstUjfLoEr4/zv12wFr4Qrfi9ZztjAeI6/i5GTQ0LAROLtxm2sELaYxIV7 69m6GLk4hAT2MUpM7utlgnDWM0r0tDSygFQJCdxjkrh8WhrCns8oMWFKBYjNJqAhsW3/ckYQ W0RAWmLn3dlAUzk4mAXUJP50qYCEhQX8JHbcncQGEmYRUJX4viwbJMwrYC/RfmopO8QNChLP 1h1nArE5BRwktrduZYbYZC+xdPFxxgmM/AsYGVYxyqbkVunmJmbmFKcm6xYnJ+blpRbpmuvl ZpbopaaUbmIEB4yLyg7G5kNKhxgFOBiVeHgtdzf4C7EmlhVX5h5ilORgUhLlffoAKMSXlJ9S mZFYnBFfVJqTWnyIUYKDWUmE9/5hoBxvSmJlVWpRPkxKmoNFSZxXQ+udn5BAemJJanZqakFq EUxWhoNDSYL39UOgRsGi1PTUirTMnBKENBMHJ8hwHqDhko9AhhcXJOYWZ6ZD5E8xKkqJ874A aRYASWSU5sH1wiL6FaM40CvCvN9BqniAyQCu+xXQYCagwTWv6kEGlyQipKQaGNO6dCbzZFhK Nddc/Vv6tjtVfpPwmm9OV6ycG1xKnzJlejUv6g2wSNqiEJHeONffZqvUz8i1We7JUuXzY2/k Htj1Q0M8qLjj8qIj5qZfD2h3KD3hFSxRmlC+MZXFd+kKW+68/nnHhW1105VeqOX+/Bqn/WRK YcYnYb2vvkacwRFcHxjdouWUWIozEg21mIuKEwGsnnjvwwIAAA== X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Apr 2012 00:58:08 -0000 Many formats don't need these, so it's more convenient if they don't have to set them at all. --- notmuch-show.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 5a71115..ef26ad2 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -844,17 +844,19 @@ show_messages (void *ctx, int next_indent; notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS; - fputs (format->message_set_start, stdout); + if (format->message_set_start) + fputs (format->message_set_start, stdout); for (; notmuch_messages_valid (messages); notmuch_messages_move_to_next (messages)) { - if (!first_set) + if (!first_set && format->message_set_sep) fputs (format->message_set_sep, stdout); first_set = 0; - fputs (format->message_set_start, stdout); + if (format->message_set_start) + fputs (format->message_set_start, stdout); message = notmuch_messages_get (messages); @@ -868,7 +870,7 @@ show_messages (void *ctx, res = status; next_indent = indent + 1; - if (!status) + if (!status && format->message_set_sep) fputs (format->message_set_sep, stdout); } @@ -882,10 +884,12 @@ show_messages (void *ctx, notmuch_message_destroy (message); - fputs (format->message_set_end, stdout); + if (format->message_set_end) + fputs (format->message_set_end, stdout); } - fputs (format->message_set_end, stdout); + if (format->message_set_end) + fputs (format->message_set_end, stdout); return res; } @@ -931,7 +935,8 @@ do_show (void *ctx, int first_toplevel = 1; notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS; - fputs (format->message_set_start, stdout); + if (format->message_set_start) + fputs (format->message_set_start, stdout); for (threads = notmuch_query_search_threads (query); notmuch_threads_valid (threads); @@ -945,7 +950,7 @@ do_show (void *ctx, INTERNAL_ERROR ("Thread %s has no toplevel messages.\n", notmuch_thread_get_thread_id (thread)); - if (!first_toplevel) + if (!first_toplevel && format->message_set_sep) fputs (format->message_set_sep, stdout); first_toplevel = 0; @@ -957,7 +962,8 @@ do_show (void *ctx, } - fputs (format->message_set_end, stdout); + if (format->message_set_end) + fputs (format->message_set_end, stdout); return res != NOTMUCH_STATUS_SUCCESS; } -- 1.7.9.1