Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 9510A6DE1B8C for ; Sun, 5 Apr 2015 16:02:13 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.545 X-Spam-Level: X-Spam-Status: No, score=0.545 tagged_above=-999 required=5 tests=[AWL=0.535, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r4w-LzeliZbN for ; Sun, 5 Apr 2015 16:02:11 -0700 (PDT) Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net [87.98.215.224]) by arlo.cworth.org (Postfix) with ESMTPS id 610DA6DE1B9D for ; Sun, 5 Apr 2015 16:02:09 -0700 (PDT) Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim 4.80) (envelope-from ) id 1YetXj-0002p8-NY; Sun, 05 Apr 2015 23:01:27 +0000 Received: (nullmailer pid 2255 invoked by uid 1000); Sun, 05 Apr 2015 22:59:25 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [WIP2 10/12] emacs: convert notmuch-search to format-version 3 Date: Mon, 6 Apr 2015 07:59:12 +0900 Message-Id: <1428274754-1698-11-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1428274754-1698-1-git-send-email-david@tethera.net> References: <1428274754-1698-1-git-send-email-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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, 05 Apr 2015 23:02:13 -0000 XXX this checks every result to see if it is metadata. This might or might not be innefficient XXX This ignores the actual metadata from the query. Should it do something useful? --- emacs/notmuch-query.el | 5 +++++ emacs/notmuch.el | 15 ++++++++------- test/T310-emacs.sh | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el index d1daffc..bfef22c 100644 --- a/emacs/notmuch-query.el +++ b/emacs/notmuch-query.el @@ -34,6 +34,11 @@ is a possibly empty forest of replies. (setq args (append args search-terms)) (apply #'notmuch-call-notmuch-sexp args))) + +(defun notmuch-query-metadata-p (result) + "Determine if the result is a \"metadata\" object (format-version 3)" + (plist-get result :query_type)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Mapping functions across collections of messages. diff --git a/emacs/notmuch.el b/emacs/notmuch.el index ab00454..87caee4 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -793,12 +793,13 @@ non-authors is found, assume that all of the authors match." This is only called when a result is first inserted so it also sets the :orig-tag property." - (let ((new-result (plist-put result :orig-tags (plist-get result :tags))) - (pos (point-max))) - (notmuch-search-show-result new-result pos) - (when (string= (plist-get result :thread) notmuch-search-target-thread) - (setq notmuch-search-target-thread "found") - (goto-char pos)))) + (unless (notmuch-query-metadata-p result) + (let ((new-result (plist-put result :orig-tags (plist-get result :tags))) + (pos (point-max))) + (notmuch-search-show-result new-result pos) + (when (string= (plist-get result :thread) notmuch-search-target-thread) + (setq notmuch-search-target-thread "found") + (goto-char pos))))) (defun notmuch-search-process-filter (proc string) "Process and filter the output of \"notmuch search\"" @@ -935,7 +936,7 @@ the configured default sort order." (save-excursion (let ((proc (notmuch-start-notmuch "notmuch-search" buffer #'notmuch-search-process-sentinel - "search" "--format=sexp" "--format-version=2" + "search" "--format=sexp" "--format-version=3" (if oldest-first "--sort=oldest-first" "--sort=newest-first") diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index d72799b..f460923 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -897,7 +897,7 @@ YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details) === ERROR === [XXX] YYY/notmuch_fail exited with status 1 -command: YYY/notmuch_fail search --format\=sexp --format-version\=2 --sort\=newest-first tag\:inbox +command: YYY/notmuch_fail search --format\=sexp --format-version\=3 --sort\=newest-first tag\:inbox exit status: 1" test_begin_subtest "Search handles subprocess warnings" -- 2.1.4