From 2178b3678f065e5c6fa1f25d55225d8cdbf2a185 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Tue, 3 Apr 2012 01:20:50 +1700 Subject: [PATCH] [PATCH 3/6] emacs: modify notmuch-search-tag to not prompt if tags provided as argument --- ed/c596e0448f8875dacfd2cbf1b8e9c980910d8b | 98 +++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 ed/c596e0448f8875dacfd2cbf1b8e9c980910d8b diff --git a/ed/c596e0448f8875dacfd2cbf1b8e9c980910d8b b/ed/c596e0448f8875dacfd2cbf1b8e9c980910d8b new file mode 100644 index 000000000..0f6fa7e1f --- /dev/null +++ b/ed/c596e0448f8875dacfd2cbf1b8e9c980910d8b @@ -0,0 +1,98 @@ +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 5EBCC431FC2 + for ; Mon, 2 Apr 2012 01:21:02 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] 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 fplpA12xpdVs for ; + Mon, 2 Apr 2012 01:21:01 -0700 (PDT) +Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu + [131.215.239.19]) + by olra.theworths.org (Postfix) with ESMTP id 0A9A7431FD6 + for ; Mon, 2 Apr 2012 01:21:01 -0700 (PDT) +Received: from earth-doxen.imss.caltech.edu (localhost [127.0.0.1]) + by earth-doxen-postvirus (Postfix) with ESMTP id C10B966E00EF + for ; Mon, 2 Apr 2012 01:20:58 -0700 (PDT) +X-Spam-Scanned: at Caltech-IMSS on earth-doxen by amavisd-new +Received: from finestructure.net (unknown [76.89.193.65]) + (Authenticated sender: jrollins) + by earth-doxen-submit (Postfix) with ESMTP id EBDB966E00E4 + for ; Mon, 2 Apr 2012 01:20:56 -0700 (PDT) +Received: by finestructure.net (Postfix, from userid 1000) + id 94FF019C4; Mon, 2 Apr 2012 01:20:56 -0700 (PDT) +From: Jameson Graef Rollins +To: Notmuch Mail +Subject: [PATCH 3/6] emacs: modify notmuch-search-tag to not prompt if tags + provided as argument +Date: Mon, 2 Apr 2012 01:20:50 -0700 +Message-Id: <1333354853-25729-4-git-send-email-jrollins@finestructure.net> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1333354853-25729-3-git-send-email-jrollins@finestructure.net> +References: <1333354853-25729-1-git-send-email-jrollins@finestructure.net> + <1333354853-25729-2-git-send-email-jrollins@finestructure.net> + <1333354853-25729-3-git-send-email-jrollins@finestructure.net> +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: Mon, 02 Apr 2012 08:21:02 -0000 + +If the argument is a full string or a list, the function will assume +this is a tag string or list and will not prompt the user. If the +argument is nil or the exact strings "-" or "+" then the user will be +prompted. + +The function doc is updated accordingly. +--- + emacs/notmuch.el | 16 ++++++++++++---- + 1 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 0ab8fc2..3b78584 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -646,13 +646,21 @@ added or removed for all threads in the region from BEG to END." + (notmuch-update-tags (notmuch-search-get-tags) tag-changes)) + (forward-line)))))) + +-(defun notmuch-search-tag (&optional initial-input) +- "Change tags for the currently selected thread or region." ++(defun notmuch-search-tag (&optional tags) ++ "Change tags for the currently selected thread or region. ++ ++If TAGS is a string or list it will be interpreted as tags to ++apply to the selected messages. If TAGS is nil or either of the ++strings `-' or `+' the user will be prompted to enter tags (with ++tab completion)." + (interactive) + (let* ((beg (if (region-active-p) (region-beginning) (point))) + (end (if (region-active-p) (region-end) (point))) +- (search-string (notmuch-search-find-thread-id-region-search beg end)) +- (tags (notmuch-read-tag-changes initial-input search-string))) ++ (search-string (notmuch-search-find-thread-id-region-search beg end))) ++ (if (string-or-null-p tags) ++ (if (or (string= tags "-") (string= tags "+") (eq tags nil)) ++ (setq tags (notmuch-read-tag-changes tags search-string)) ++ (setq tags (list tags)))) + (apply 'notmuch-search-tag-region beg end tags))) + + (defun notmuch-search-add-tag () +-- +1.7.9.1 + -- 2.26.2