From 6da620bf9f736137f8543acf38b7d063f8225924 Mon Sep 17 00:00:00 2001 From: Pieter Praet Date: Fri, 24 Feb 2012 00:09:13 +0100 Subject: [PATCH] [PATCH 5/6] emacs: simplify `notmuch-show-get-messages-ids{, -search}' --- 6b/881e0fe08f2abb220608ccd73ff393269c62cb | 125 ++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 6b/881e0fe08f2abb220608ccd73ff393269c62cb diff --git a/6b/881e0fe08f2abb220608ccd73ff393269c62cb b/6b/881e0fe08f2abb220608ccd73ff393269c62cb new file mode 100644 index 000000000..28c036e8f --- /dev/null +++ b/6b/881e0fe08f2abb220608ccd73ff393269c62cb @@ -0,0 +1,125 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id AA67C431FC3 + for ; Thu, 23 Feb 2012 15:11:47 -0800 (PST) +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 rMUCIBvov826 for ; + Thu, 23 Feb 2012 15:11:46 -0800 (PST) +Received: from mail-we0-f181.google.com (mail-we0-f181.google.com + [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 06400431FCB + for ; Thu, 23 Feb 2012 15:11:40 -0800 (PST) +Received: by mail-we0-f181.google.com with SMTP id p13so1249384wer.26 + for ; Thu, 23 Feb 2012 15:11:40 -0800 (PST) +Received-SPF: pass (google.com: domain of pieter@praet.org designates + 10.180.106.67 as permitted sender) client-ip=10.180.106.67; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of pieter@praet.org + designates 10.180.106.67 as permitted sender) + smtp.mail=pieter@praet.org +Received: from mr.google.com ([10.180.106.67]) + by 10.180.106.67 with SMTP id gs3mr809222wib.7.1330038700727 (num_hops + = 1); Thu, 23 Feb 2012 15:11:40 -0800 (PST) +MIME-Version: 1.0 +Received: by 10.180.106.67 with SMTP id gs3mr650758wib.7.1330038700667; + Thu, 23 Feb 2012 15:11:40 -0800 (PST) +Received: from localhost ([109.131.181.26]) + by mx.google.com with ESMTPS id fw5sm7421493wib.0.2012.02.23.15.11.39 + (version=TLSv1/SSLv3 cipher=OTHER); + Thu, 23 Feb 2012 15:11:40 -0800 (PST) +From: Pieter Praet +To: David Bremner , + Dmitry Kurochkin +Subject: [PATCH 5/6] emacs: simplify `notmuch-show-get-messages-ids{, + -search}' +Date: Fri, 24 Feb 2012 00:09:13 +0100 +Message-Id: <1330038554-10347-5-git-send-email-pieter@praet.org> +X-Mailer: git-send-email 1.7.8.1 +In-Reply-To: <878vjtqhcg.fsf@praet.org> +References: <878vjtqhcg.fsf@praet.org> +X-Gm-Message-State: + ALoCoQlK1I/msSO+rKBg3S63pxV88eRxeaJ6AF9MWIeW2cM9NVxlnbRWFalfn5YRbNkHvBQmkNDj +Cc: Notmuch Mail +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: Thu, 23 Feb 2012 23:11:48 -0000 + +* emacs/notmuch-show.el + + (notmuch-show-get-messages-ids): + If provided with optional arg SEPARATOR, return a string consisting + of all Message-Id's, separated by SEPARATOR. Also improve original + docstring wrt default return value. + + (notmuch-show-get-messages-ids-search): + Removed, as its functionality is now in `notmuch-show-get-messages-ids'. + + (notmuch-show-tag-all): + Call `notmuch-show-get-messages-ids' with SEPARATOR arg instead of + `notmuch-show-get-messages-ids-search'. +--- + emacs/notmuch-show.el | 18 +++++++++--------- + 1 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 5fc0e43..4b37c77 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1334,17 +1334,17 @@ (defun notmuch-show-get-message-id () + "Return the message id of the current message." + (concat "id:\"" (notmuch-show-get-prop :id) "\"")) + +-(defun notmuch-show-get-messages-ids () +- "Return all message ids of messages in the current thread." ++(defun notmuch-show-get-messages-ids (&optional separator) ++ "Return a list of Message-Id's of all messages in the current buffer. ++ ++If provided with optional argument SEPARATOR, return a string ++instead, consisting of all Message-Id's separated by SEPARATOR." + (let ((message-ids)) + (notmuch-show-mapc t + (lambda () (push (notmuch-show-get-message-id) message-ids))) +- message-ids)) +- +-(defun notmuch-show-get-messages-ids-search () +- "Return a search string for all message ids of messages in the +-current thread." +- (mapconcat 'identity (notmuch-show-get-messages-ids) " or ")) ++ (if separator ++ (mapconcat 'identity message-ids separator) ++ message-ids))) + + ;; dme: Would it make sense to use a macro for many of these? + +@@ -1633,7 +1633,7 @@ (defun notmuch-show-tag-all (&rest tag-changes) + + TAG-CHANGES is a list of tag operations for `notmuch-tag'." + (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id)) +- (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes) ++ (apply 'notmuch-tag (notmuch-show-get-messages-ids " or ") tag-changes) + (notmuch-show-mapc t + (lambda () + (let* ((current-tags (notmuch-show-get-tags)) +-- +1.7.8.1 + -- 2.26.2