[WIP PATCH 4/4] emacs: search: add key binding for marking a thread
authorMark Walters <markwalters1009@gmail.com>
Tue, 22 Apr 2014 20:11:50 +0000 (21:11 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:01:51 +0000 (10:01 -0800)
0a/8f693b79af3a45883c99c51d8cc476261cfd3a [new file with mode: 0644]

diff --git a/0a/8f693b79af3a45883c99c51d8cc476261cfd3a b/0a/8f693b79af3a45883c99c51d8cc476261cfd3a
new file mode 100644 (file)
index 0000000..93db647
--- /dev/null
@@ -0,0 +1,114 @@
+Return-Path: <markwalters1009@gmail.com>\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 19AD4431FDB\r
+       for <notmuch@notmuchmail.org>; Tue, 22 Apr 2014 13:12:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] 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 9oPQVgQ+99+D for <notmuch@notmuchmail.org>;\r
+       Tue, 22 Apr 2014 13:12:14 -0700 (PDT)\r
+Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com\r
+ [74.125.82.41])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 1A82D431FC4   for <notmuch@notmuchmail.org>; Tue, 22 Apr 2014 13:12:11 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f41.google.com with SMTP id n12so4364317wgh.0\r
+       for <notmuch@notmuchmail.org>; Tue, 22 Apr 2014 13:12:11 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+       bh=bXlCxWOYpCW3sb2mo6EqwQIsMdINYSI0oXyw4MKecWM=;\r
+       b=UO9b/d+1w1qiawwLhUP61wt05kHszI8H4dzXvVKUmiAXka40GHofr6nUsu2G6rhsM6\r
+       qr1dh6Vp21dwsrrlMNDz4SxwxYoCjoOCmjNO0cArMWRwTIx7DD9kNsZ3O7Kk2Jo8NMey\r
+       /3RRQ4kkwjKiUlXm6cO9mDDbeBo3ZiJVnnRFTUxUTjD1TtWFEeyC9fzFeF7fhbIQZmvW\r
+       4RGZZWC2psBH+ZEK4kcHp7C0SUAx9D/rBgi0Sin3AOUYyO7NKcTG7S2ADa/xdr58GQmF\r
+       oMmLQOTNVwFsVc3mXq6JTzaFV6pV8tggjCVY/5udSSY0jVZxOMeU8PVOqr+996OpJN3j\r
+       tWgQ==\r
+X-Received: by 10.180.211.207 with SMTP id ne15mr20279169wic.31.1398197531041;\r
+       Tue, 22 Apr 2014 13:12:11 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+       by mx.google.com with ESMTPSA id\r
+       lj15sm24553091wic.13.2014.04.22.13.12.10 for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Tue, 22 Apr 2014 13:12:10 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [WIP PATCH 4/4] emacs: search: add key binding for marking a thread\r
+Date: Tue, 22 Apr 2014 21:11:50 +0100\r
+Message-Id: <1398197510-28224-5-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1398197510-28224-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1398197510-28224-1-git-send-email-markwalters1009@gmail.com>\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: Tue, 22 Apr 2014 20:12:18 -0000\r
+\r
+Add a function for toggling the mark on a thread, by default bound to\r
+",".  Also make a marked thread clearly visible: this uses inverse\r
+video as being a bit like selecting. Perhaps actually using the same\r
+face (mainly backgorund colour) as a selection would make sense?\r
+---\r
+ emacs/notmuch.el |   15 +++++++++++++++\r
+ 1 file changed, 15 insertions(+)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index e1ece47..4976f0a 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -179,6 +179,7 @@ (defvar notmuch-search-mode-map\r
+     (define-key map "+" 'notmuch-search-add-tag)\r
+     (define-key map (kbd "RET") 'notmuch-search-show-thread)\r
+     (define-key map "Z" 'notmuch-tree-from-search-current-query)\r
++    (define-key map "," 'notmuch-search-mark-thread)\r
+     map)\r
+   "Keymap for \"notmuch search\" buffers.")\r
+ (fset 'notmuch-search-mode-map notmuch-search-mode-map)\r
+@@ -604,6 +605,17 @@ (defun notmuch-search-archive-thread (&optional unarchive beg end thread-list)\r
+      (notmuch-tag-change-list notmuch-archive-tags unarchive) beg end thread-list))\r
+   (notmuch-search-next-thread))\r
\r
++(defun notmuch-search-mark-thread ()\r
++  "Toggle the mark on the currently selected thread."\r
++  (interactive)\r
++  (let ((thread (notmuch-search-find-thread-id)))\r
++    (if (member thread notmuch-search-marked-threads)\r
++      (setq notmuch-search-marked-threads\r
++            (delete thread notmuch-search-marked-threads))\r
++      (push (notmuch-search-find-thread-id) notmuch-search-marked-threads)))\r
++  (notmuch-search-update-result (notmuch-search-get-result))\r
++  (notmuch-search-next-thread))\r
++\r
+ (defun notmuch-search-update-result (result &optional pos)\r
+   "Replace the result object of the thread at POS (or point) by\r
+ RESULT and redraw it.\r
+@@ -806,6 +818,9 @@ (defun notmuch-search-show-result (result pos)\r
+       (dolist (spec notmuch-search-result-format)\r
+       (notmuch-search-insert-field (car spec) (cdr spec) result))\r
+       (insert "\n")\r
++      (when (member (concat "thread:" (plist-get result :thread))\r
++                  notmuch-search-marked-threads)\r
++      (notmuch-apply-face nil '(:inverse-video t) nil pos (point)))\r
+       (notmuch-search-color-line pos (point) (plist-get result :tags))\r
+       (put-text-property pos (point) 'notmuch-search-result result))))\r
\r
+-- \r
+1.7.10.4\r
+\r