From: Jameson Graef Rollins Date: Sat, 14 Apr 2012 18:52:53 +0000 (+1700) Subject: [PATCH 4/5] emacs: modify show tag functions to use new notmuch-tag interface X-Git-Url: http://git.tremily.us/?p=notmuch-archives.git;a=commitdiff_plain;h=abb17f401091fd6ca60dce8dd45d6db512058c46 [PATCH 4/5] emacs: modify show tag functions to use new notmuch-tag interface --- diff --git a/02/ba944aeceabe4ede874bfc4e0c9046e52c060b b/02/ba944aeceabe4ede874bfc4e0c9046e52c060b new file mode 100644 index 000000000..289056d78 --- /dev/null +++ b/02/ba944aeceabe4ede874bfc4e0c9046e52c060b @@ -0,0 +1,109 @@ +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 CAAEF431FD0 + for ; Sat, 14 Apr 2012 11:53:08 -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 E+OSpVY-GIdW for ; + Sat, 14 Apr 2012 11:53:05 -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 9ABB6431FAE + for ; Sat, 14 Apr 2012 11:53:05 -0700 (PDT) +Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1]) + by fire-doxen-postvirus (Postfix) with ESMTP id 591982E50D6C + for ; Sat, 14 Apr 2012 11:53:03 -0700 (PDT) +X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new +Received: from finestructure.net (unknown [76.89.193.65]) + (Authenticated sender: jrollins) + by fire-doxen-submit (Postfix) with ESMTP id 8CB492E50D6E + for ; Sat, 14 Apr 2012 11:53:01 -0700 (PDT) +Received: by finestructure.net (Postfix, from userid 1000) + id 319AC698; Sat, 14 Apr 2012 11:53:01 -0700 (PDT) +From: Jameson Graef Rollins +To: Notmuch Mail +Subject: [PATCH 4/5] emacs: modify show tag functions to use new notmuch-tag + interface +Date: Sat, 14 Apr 2012 11:52:53 -0700 +Message-Id: <1334429574-12918-5-git-send-email-jrollins@finestructure.net> +X-Mailer: git-send-email 1.7.9.5 +In-Reply-To: <1334429574-12918-4-git-send-email-jrollins@finestructure.net> +References: <1333845338-22960-1-git-send-email-jrollins@finestructure.net> + <1334429574-12918-1-git-send-email-jrollins@finestructure.net> + <1334429574-12918-2-git-send-email-jrollins@finestructure.net> + <1334429574-12918-3-git-send-email-jrollins@finestructure.net> + <1334429574-12918-4-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: Sat, 14 Apr 2012 18:53:09 -0000 + +The main change here is to modify argument parsing so as to not force +tag-changes to be a list, and to let notmuch-tag handle prompting the +user when required. doc strings are also updated and cleaned up. +--- + emacs/notmuch-show.el | 26 +++++++++++++++----------- + 1 file changed, 15 insertions(+), 11 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index a4c313d..69bca02 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1641,22 +1641,26 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'." + (let* ((current-tags (notmuch-show-get-tags)) + (new-tags (notmuch-update-tags current-tags tag-changes))) + (unless (equal current-tags new-tags) +- (apply 'notmuch-tag (notmuch-show-get-message-id) tag-changes) ++ (funcall 'notmuch-tag (notmuch-show-get-message-id) tag-changes) + (notmuch-show-set-tags new-tags)))) + +-(defun notmuch-show-tag (&optional initial-input) +- "Change tags for the current message, read input from the minibuffer." ++(defun notmuch-show-tag (&optional tag-changes) ++ "Change tags for the current message. ++ ++See `notmuch-tag' for information on the format of TAG-CHANGES." + (interactive) +- (let ((tag-changes (notmuch-read-tag-changes +- initial-input (notmuch-show-get-message-id)))) +- (apply 'notmuch-show-tag-message tag-changes))) ++ (setq tag-changes (funcall 'notmuch-tag (notmuch-show-get-message-id) tag-changes)) ++ (let* ((current-tags (notmuch-show-get-tags)) ++ (new-tags (notmuch-update-tags current-tags tag-changes))) ++ (unless (equal current-tags new-tags) ++ (notmuch-show-set-tags new-tags)))) + +-(defun notmuch-show-tag-all (&rest tag-changes) +- "Change tags for all messages in the current buffer. ++(defun notmuch-show-tag-all (&optional tag-changes) ++ "Change tags for all messages in the current show buffer. + +-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) ++See `notmuch-tag' for information on the format of TAG-CHANGES." ++ (interactive) ++ (setq tag-changes (funcall 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)) + (notmuch-show-mapc + (lambda () + (let* ((current-tags (notmuch-show-get-tags)) +-- +1.7.9.5 +