From: Mark Walters Date: Fri, 30 Nov 2012 08:21:31 +0000 (+0000) Subject: [PATCH 5/5] emacs: show tag completion X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=4c14f9d2b847759c30a9cf5b9b7d67db45a37477;p=notmuch-archives.git [PATCH 5/5] emacs: show tag completion --- diff --git a/a9/97c9f9425a1a0acef60817208656a609fe8b12 b/a9/97c9f9425a1a0acef60817208656a609fe8b12 new file mode 100644 index 000000000..d454854b5 --- /dev/null +++ b/a9/97c9f9425a1a0acef60817208656a609fe8b12 @@ -0,0 +1,138 @@ +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 E01ED431FD9 + for ; Fri, 30 Nov 2012 00:23:44 -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 BcPPxPnFZjD1 for ; + Fri, 30 Nov 2012 00:23:43 -0800 (PST) +Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com + [74.125.82.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 890B1429E2F for ; Fri, 30 Nov 2012 00:23:28 -0800 + (PST) +Received: by mail-wg0-f47.google.com with SMTP id dq11so77771wgb.2 + for ; Fri, 30 Nov 2012 00:23:27 -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=9HqEC0BEnsSKkk4YUs6e8JVAZluwmFRZErzAeRmkf6A=; + b=hDAPu1dkQNSvGhxD7hBXQ0QgDMU1IlLMf/sqfgTjIpA71qBlqAxMnBeZhHmhzE5KAa + VI7iQo20LCtOzKWLEQEALTsLU9YHJeE09yCQl//inKfdOMjkaR9QawdEiYTtCmQ76lnJ + 3xvHTpVisPTMIKf2w9MCidj1mxD3rBzwEJdXzqBowLjw2gZNzway+S4ZnaGTkWyJsURO + WM96bvwIJi5U1TuzI2e9BmM2laYcb54e5iScwQLIIXTkQ/qgf3bbynBanhorZCfcV9Bm + WhrDyBJDtYkROCnY2W7X6gOVnDb76mRC7MGfQwzzXaUCBQD8ACXi6UMO+xCS4GoUS2aq + Z/oA== +Received: by 10.180.87.39 with SMTP id u7mr42399506wiz.6.1354263807247; + Fri, 30 Nov 2012 00:23:27 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id s12sm14297513wik.11.2012.11.30.00.23.25 + (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 30 Nov 2012 00:23:26 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 5/5] emacs: show tag completion +Date: Fri, 30 Nov 2012 08:21:31 +0000 +Message-Id: <1354263691-19715-6-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:45 -0000 + +From: markwalters1009 + +This makes tagging in show mode pass the list of tags that it believes +occur to the tag completion function. This means that tag-completion +will complete to any tag that the user can see (even if it is no +longer present). +--- +The function to get all tags for a thread was taken from Damien's +notmuch-labeler series. + + emacs/notmuch-show.el | 32 +++++++++++++++++++++++++------- + 1 files changed, 25 insertions(+), 7 deletions(-) + +diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el +index 489e32c..c2fef7b 100644 +--- a/emacs/notmuch-show.el ++++ b/emacs/notmuch-show.el +@@ -1439,6 +1439,16 @@ current thread." + "Return the tags of the current message." + (notmuch-show-get-prop :tags)) + ++(defun notmuch-show-thread-tags () ++ "Return the list of tags for the current thread." ++ (let ((tags (list))) ++ (notmuch-show-mapc (lambda () ++ (mapcar (lambda (elt) ++ ;; Avoid adding duplicate tags ++ (add-to-list 'tags elt)) ++ (notmuch-show-get-tags)))) ++ tags)) ++ + (defun notmuch-show-message-visible-p () + "Is the current message visible?" + (notmuch-show-get-prop :message-visible)) +@@ -1730,9 +1740,13 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'." + + See `notmuch-tag' for information on the format of TAG-CHANGES." + (interactive) +- (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))) ++ (let ((current-tags (notmuch-show-get-tags)) ++ (new-tags)) ++ (setq tag-changes (funcall 'notmuch-tag ++ (notmuch-show-get-message-id) ++ tag-changes ++ current-tags)) ++ (setq new-tags (notmuch-update-tags current-tags tag-changes)) + (unless (equal current-tags new-tags) + (notmuch-show-set-tags new-tags)))) + +@@ -1741,13 +1755,17 @@ See `notmuch-tag' for information on the format of 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 ((existing-tags (notmuch-show-thread-tags))) ++ (setq tag-changes (funcall 'notmuch-tag ++ (notmuch-show-get-messages-ids-search) ++ tag-changes ++ existing-tags)) ++ (notmuch-show-mapc ++ (lambda () + (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)))))) ++ (notmuch-show-set-tags new-tags))))))) + + (defun notmuch-show-add-tag () + "Same as `notmuch-show-tag' but sets initial input to '+'." +-- +1.7.9.1 +