[PATCH 3/5] emacs: modify search tag functions to use new notmuch-tag interface
authorJameson Graef Rollins <jrollins@finestructure.net>
Sat, 14 Apr 2012 18:52:52 +0000 (11:52 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:22 +0000 (09:46 -0800)
8d/57fcf347730457deece7ac9997e138b47be23b [new file with mode: 0644]

diff --git a/8d/57fcf347730457deece7ac9997e138b47be23b b/8d/57fcf347730457deece7ac9997e138b47be23b
new file mode 100644 (file)
index 0000000..cdf215c
--- /dev/null
@@ -0,0 +1,131 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 71A04431FDE\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 11:53:10 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id pcG8IrppLR5i for <notmuch@notmuchmail.org>;\r
+       Sat, 14 Apr 2012 11:53:08 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id DD057431FC9\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 11:53:05 -0700 (PDT)\r
+Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by earth-doxen-postvirus (Postfix) with ESMTP id 8EAC966E00E4\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 11:53:03 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.193.65])\r
+       (Authenticated sender: jrollins)\r
+       by earth-doxen-submit (Postfix) with ESMTP id 7AEBE66E00A7\r
+       for <notmuch@notmuchmail.org>; Sat, 14 Apr 2012 11:53:01 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id 2E589620; Sat, 14 Apr 2012 11:53:01 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 3/5] emacs: modify search tag functions to use new notmuch-tag\r
+       interface\r
+Date: Sat, 14 Apr 2012 11:52:52 -0700\r
+Message-Id: <1334429574-12918-4-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <1334429574-12918-3-git-send-email-jrollins@finestructure.net>\r
+References: <1333845338-22960-1-git-send-email-jrollins@finestructure.net>\r
+       <1334429574-12918-1-git-send-email-jrollins@finestructure.net>\r
+       <1334429574-12918-2-git-send-email-jrollins@finestructure.net>\r
+       <1334429574-12918-3-git-send-email-jrollins@finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 14 Apr 2012 18:53:10 -0000\r
+\r
+The main change here is to modify argument parsing so as to not force\r
+tag-changes to be a list, and to let notmuch-tag handle prompting the\r
+user when required.  doc strings are also updated and cleaned up.\r
+---\r
+ emacs/notmuch.el |   36 +++++++++++++-----------------------\r
+ 1 file changed, 13 insertions(+), 23 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 9aec96d..a03a526 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -523,13 +523,10 @@ and will also appear in a buffer named \"*Notmuch errors*\"."\r
+ See `notmuch-search-tag-region' for details."\r
+   (apply 'notmuch-search-tag-region (point) (point) tag-changes))\r
\r
+-(defun notmuch-search-tag-region (beg end &rest tag-changes)\r
+-  "Change tags for threads in the given region.\r
+-\r
+-TAGS is a list of tag operations for `notmuch-tag'.  The tags are\r
+-added or removed for all threads in the region from BEG to END."\r
++(defun notmuch-search-tag-region (beg end &optional tag-changes)\r
++  "Change tags for threads in the given region."\r
+   (let ((search-string (notmuch-search-find-thread-id-region-search beg end)))\r
+-    (apply 'notmuch-tag search-string tag-changes)\r
++    (setq tag-changes (funcall 'notmuch-tag search-string tag-changes))\r
+     (save-excursion\r
+       (let ((last-line (line-number-at-pos end))\r
+           (max-line (- (line-number-at-pos (point-max)) 2)))\r
+@@ -539,14 +536,14 @@ added or removed for all threads in the region from BEG to END."\r
+          (notmuch-update-tags (notmuch-search-get-tags) tag-changes))\r
+         (forward-line))))))\r
\r
+-(defun notmuch-search-tag (&optional initial-input)\r
+-  "Change tags for the currently selected thread or region."\r
++(defun notmuch-search-tag (&optional tag-changes)\r
++  "Change tags for the currently selected thread or region.\r
++\r
++See `notmuch-tag' for information on the format of TAG-CHANGES."\r
+   (interactive)\r
+   (let* ((beg (if (region-active-p) (region-beginning) (point)))\r
+-       (end (if (region-active-p) (region-end) (point)))\r
+-       (search-string (notmuch-search-find-thread-id-region-search beg end))\r
+-       (tags (notmuch-read-tag-changes initial-input search-string)))\r
+-    (apply 'notmuch-search-tag-region beg end tags)))\r
++       (end (if (region-active-p) (region-end) (point))))\r
++    (funcall 'notmuch-search-tag-region beg end tag-changes)))\r
\r
+ (defun notmuch-search-add-tag ()\r
+   "Same as `notmuch-search-tag' but sets initial input to '+'."\r
+@@ -790,18 +787,11 @@ non-authors is found, assume that all of the authors match."\r
+             (goto-char found-target)))\r
+       (delete-process proc))))\r
\r
+-(defun notmuch-search-tag-all (&rest tag-changes)\r
+-  "Add/remove tags from all matching messages.\r
++(defun notmuch-search-tag-all (&optional tag-changes)\r
++  "Add/remove tags from all messages in current search buffer.\r
\r
+-This command adds or removes tags from all messages matching the\r
+-current search terms. When called interactively, this command\r
+-will prompt for tags to be added or removed. Tags prefixed with\r
+-'+' will be added and tags prefixed with '-' will be removed.\r
+-\r
+-Each character of the tag name may consist of alphanumeric\r
+-characters as well as `_.+-'.\r
+-"\r
+-  (interactive (notmuch-read-tag-changes))\r
++See `notmuch-tag' for information on the format of TAG-CHANGES."\r
++  (interactive)\r
+   (apply 'notmuch-tag notmuch-search-query-string tag-changes))\r
\r
+ (defun notmuch-search-buffer-title (query)\r
+-- \r
+1.7.9.5\r
+\r