From 89b3fb915b3dbe05c4c1fc8ebd6ece5893dbbe04 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Fri, 30 Nov 2012 08:21:27 +0000 Subject: [PATCH] [PATCH 1/5] emacs: move tag.el utility functions from lists to strings --- a4/0c156eb36ed7c542c95810a200bec9c12b761b | 116 ++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 a4/0c156eb36ed7c542c95810a200bec9c12b761b diff --git a/a4/0c156eb36ed7c542c95810a200bec9c12b761b b/a4/0c156eb36ed7c542c95810a200bec9c12b761b new file mode 100644 index 000000000..6857068af --- /dev/null +++ b/a4/0c156eb36ed7c542c95810a200bec9c12b761b @@ -0,0 +1,116 @@ +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 9CE58431FBC + for ; Fri, 30 Nov 2012 00:23:19 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 Y9P6zR9UJJn0 for ; + Fri, 30 Nov 2012 00:23:19 -0800 (PST) +Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com + [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 08DCD431FAF for ; Fri, 30 Nov 2012 00:23:18 -0800 + (PST) +Received: by mail-wg0-f41.google.com with SMTP id ds1so4340809wgb.2 + for ; Fri, 30 Nov 2012 00:23:17 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=GE+siC9KJnmiPylUu9WuR6TIRmrpgoCRJFhx0RwrNP4=; + b=waYPWb0ay63VhHLdMjybuQBmwTxP+kK2gfjt5dfoamNdf9A52hZe9nETInftRgCCFR + adVaLH9lkvI1GpvgDnlvnCNG3PY3ccgfErRGGDX8lLTACweT+7wPGSxrokAJOqU1QSzQ + 1FnBaPPMeRQWaQQw8Typ5Y5ciLFlnoDaDA304dPbudk4Ky5dSrg94MzFZq+rJuVxEWdV + afebV9Loe6cAWys6hW1pSI3X5uKmAw44J5NL39jzoPWS9p9vysT0V2CQG6PjZaBEcUyj + k2bvFUd234SlN/uLKazJWMSgb95hfHJQ/4DzAqImVDy8wxeGuHpy7xY6B0oqg5B7qWjV + DA5A== +Received: by 10.180.92.166 with SMTP id cn6mr661355wib.19.1354263797907; + Fri, 30 Nov 2012 00:23:17 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id g2sm5953472wiy.0.2012.11.30.00.23.16 + (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 30 Nov 2012 00:23:17 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 1/5] emacs: move tag.el utility functions from lists to + strings +Date: Fri, 30 Nov 2012 08:21:27 +0000 +Message-Id: <1354263691-19715-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1354263691-19715-1-git-send-email-markwalters1009@gmail.com> +References: <1354263691-19715-1-git-send-email-markwalters1009@gmail.com> +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: Fri, 30 Nov 2012 08:23:19 -0000 + +From: markwalters1009 + +The query for most of the notmuch-tag.el utility functions was a list +(or multiple arguments) (but not for the main calling point: +notmuch-tag). This patch moves them all to take the query as a string +instead. This makes it easier to add extra parameters in the next +patch. +--- + emacs/notmuch-tag.el | 16 ++++++++-------- + 1 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el +index 4fce3a9..1f3d8cf 100644 +--- a/emacs/notmuch-tag.el ++++ b/emacs/notmuch-tag.el +@@ -55,26 +55,26 @@ the messages that were tagged" + `notmuch-read-tag-changes' function.") + + (defun notmuch-tag-completions (&optional search-terms) +- (if (null search-terms) +- (setq search-terms (list "*"))) ++ (unless search-terms ++ (setq search-terms "*")) + (split-string + (with-output-to-string + (with-current-buffer standard-output +- (apply 'call-process notmuch-command nil t ++ (funcall 'call-process notmuch-command nil t + nil "search" "--output=tags" "--exclude=false" search-terms))) + "\n+" t)) + +-(defun notmuch-select-tag-with-completion (prompt &rest search-terms) ++(defun notmuch-select-tag-with-completion (prompt &optional search-terms) + (let ((tag-list (notmuch-tag-completions search-terms))) + (completing-read prompt tag-list nil nil nil 'notmuch-select-tag-history))) + +-(defun notmuch-read-tag-changes (&optional initial-input &rest search-terms) ++(defun notmuch-read-tag-changes (&optional initial-input search-terms) + (let* ((all-tag-list (notmuch-tag-completions)) + (add-tag-list (mapcar (apply-partially 'concat "+") all-tag-list)) + (remove-tag-list (mapcar (apply-partially 'concat "-") +- (if (null search-terms) +- all-tag-list +- (notmuch-tag-completions search-terms)))) ++ (if search-terms ++ (notmuch-tag-completions search-terms) ++ all-tag-list))) + (tag-list (append add-tag-list remove-tag-list)) + (crm-separator " ") + ;; By default, space is bound to "complete word" function. +-- +1.7.9.1 + -- 2.26.2