From a4994c957699c0d0d450f7453d78a021a27b3629 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 30 Jan 2012 18:02:29 +1900 Subject: [PATCH] Re: [PATCH 6/6] emacs: separate history for operations which accept single and multiple tags --- b6/8564f491c35a02d7463171259ce6f4de9e4a11 | 134 ++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 b6/8564f491c35a02d7463171259ce6f4de9e4a11 diff --git a/b6/8564f491c35a02d7463171259ce6f4de9e4a11 b/b6/8564f491c35a02d7463171259ce6f4de9e4a11 new file mode 100644 index 000000000..1faad702f --- /dev/null +++ b/b6/8564f491c35a02d7463171259ce6f4de9e4a11 @@ -0,0 +1,134 @@ +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 51BCF431E64 + for ; Sun, 29 Jan 2012 15:03:20 -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 aV2Kvyi+RVyy for ; + Sun, 29 Jan 2012 15:03:19 -0800 (PST) +Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU + [18.7.68.37]) + by olra.theworths.org (Postfix) with ESMTP id B6F8D429E4C + for ; Sun, 29 Jan 2012 15:03:19 -0800 (PST) +X-AuditID: 12074425-b7f4a6d0000008e0-b3-4f25d0371852 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP + id 40.BD.02272.730D52F4; Sun, 29 Jan 2012 18:03:19 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q0TN3I1x023922; + Sun, 29 Jan 2012 18:03:19 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0TN3HoV022913 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sun, 29 Jan 2012 18:03:18 -0500 (EST) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1RrdlV-000086-MR; Sun, 29 Jan 2012 18:02:29 -0500 +Date: Sun, 29 Jan 2012 18:02:29 -0500 +From: Austin Clements +To: Dmitry Kurochkin +Subject: Re: [PATCH 6/6] emacs: separate history for operations which accept + single and multiple tags +Message-ID: <20120129230229.GI17991@mit.edu> +References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com> + <1327725684-5887-6-git-send-email-dmitry.kurochkin@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1327725684-5887-6-git-send-email-dmitry.kurochkin@gmail.com> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IR4hTV1jW/oOpv0PFR1OLq1n52i+s3ZzI7 + MHnsnHWX3ePZqlvMAUxRXDYpqTmZZalF+nYJXBkHrl1mLVgiXLHzbwNzA+Mz/i5GTg4JAROJ + mw0P2SBsMYkL99YD2VwcQgL7GCUaHl5ignA2MEocbP8KlTnJJHFndwcLhLOEUaJ3xVVmkH4W + AVWJf8fXgdlsAhoS2/YvZwSxRQQMJW5dfAUWZxaQlvj2u5kJxBYWSJfoePwRLM4roCNx8eob + RoihnYwS8/Z3skMkBCVOznzCAtGsJXHj30ugZg6wQcv/cYCEOQW8JN7PXQY2U1RARWLKyW1s + ExiFZiHpnoWkexZC9wJG5lWMsim5Vbq5iZk5xanJusXJiXl5qUW6Fnq5mSV6qSmlmxhBoc3u + orqDccIhpUOMAhyMSjy8OytU/YVYE8uKK3MPMUpyMCmJ8racAQrxJeWnVGYkFmfEF5XmpBYf + YpTgYFYS4Z2zDCjHm5JYWZValA+TkuZgURLn1dR65yckkJ5YkpqdmlqQWgSTleHgUJLgnXse + qFGwKDU9tSItM6cEIc3EwQkynAdo+H6QGt7igsTc4sx0iPwpRkUpcd5GkIQASCKjNA+uF5Z6 + XjGKA70izNsEUsUDTFtw3a+ABjMBDX7OADa4JBEhJdXAOKVQbMKejVnZcx7Hcczb+e+0+foJ + x2z2cCau02pfNLv9l1F3zKp4XrH9k6otHI5OtznyZl/r57YC3SU73i7J2RS1c+nHpO159ops + z2uiJJsvr7l/69mhfLPv1TcXLgq3+PZqi45q4da3NyUvq4b1LXmetmHh3snJk5vl1zJEsr2Q + C07gL99bIafEUpyRaKjFXFScCAAOml0aGAMAAA== +Cc: notmuch@notmuchmail.org +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, 29 Jan 2012 23:03:20 -0000 + +Quoth Dmitry Kurochkin on Jan 28 at 8:41 am: +> Some tag-related operations accept a single tag without prefix +> (`notmuch-select-tag-with-completion'), others accept multiple tags +> prefixed with '+' or '-' (`notmuch-select-tags-with-completion'). +> Before the change, both functions used a single default minibuffer +> history. This is inconvenient because you have to skip options with +> incompatible format when going through the history. The patch adds +> separate history lists for the two functions. Note that functions +> that accept the same input format (e.g. "+", "-", "*") share the +> history list as before. +> --- +> emacs/notmuch.el | 12 ++++++++++-- +> 1 files changed, 10 insertions(+), 2 deletions(-) +> +> diff --git a/emacs/notmuch.el b/emacs/notmuch.el +> index 24b0ea3..9813e0a 100644 +> --- a/emacs/notmuch.el +> +++ b/emacs/notmuch.el +> @@ -76,6 +76,14 @@ For example: +> (defvar notmuch-query-history nil +> "Variable to store minibuffer history for notmuch queries") +> +> +(defvar notmuch-select-tag-history nil +> + "Variable to store notmuch tag history for +> + `notmuch-select-tag-with-completion'.") +> + +> +(defvar notmuch-select-tags-history nil +> + "Variable to store notmuch tags history for +> + `notmuch-select-tags-with-completion'.") +> + + +Really these are minibuffer or input histories, not "notmuch tag +history". Also, the second line shouldn't be indented. (Definitely +nits, but if you roll a new version, you might as well fix these.) + +> (defun notmuch-tag-completions (&optional search-terms) +> (split-string +> (with-output-to-string +> @@ -86,7 +94,7 @@ For example: +> +> (defun notmuch-select-tag-with-completion (prompt &rest search-terms) +> (let ((tag-list (notmuch-tag-completions search-terms))) +> - (completing-read prompt tag-list))) +> + (completing-read prompt tag-list nil nil nil 'notmuch-select-tag-history))) +> +> (defun notmuch-select-tags-with-completion (&optional initial-input &rest search-terms) +> (let* ((add-tag-list (mapcar (apply-partially 'concat "+") +> @@ -105,7 +113,7 @@ For example: +> map))) +> (delete "" (completing-read-multiple +> "Operations (+add -drop): notmuch tag " tag-list nil +> - nil initial-input)))) +> + nil initial-input 'notmuch-select-tags-history)))) +> +> (defun notmuch-update-tags (current-tags changed-tags) +> "Update `current-tags' with `changed-tags' and return the result. -- 2.26.2