[RFC PATCH 2/2] emacs: a couple of example functions that might be useful with saved searches

Subject: [RFC PATCH 2/2] emacs: a couple of example functions that might be useful with saved searches

Date: Wed, 23 Nov 2011 23:08:37 +0200

To: notmuch@notmuchmail.org

Cc:

From: Jani Nikula


Signed-off-by: Jani Nikula <jani@nikula.org>
---
 emacs/notmuch-hello.el |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index ad3ae74..f03e4b9 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -26,6 +26,24 @@
 (require 'notmuch-lib)
 (require 'notmuch-mua)
 
+(defun notmuch-no-saved-search-match (this)
+  (mapconcat (lambda (arg) (concat "(not ("
+				   (if (functionp (cdr arg))
+				       (funcall (cdr arg) arg)
+				     (cdr arg)) "))"))
+	     (loop for elem in notmuch-saved-searches
+		   if (not (equal (car this) (car elem)))
+		   collect elem)
+	     " and "))
+
+(defun notmuch-get-saved-search (name)
+  (let ((elem (assoc name notmuch-saved-searches)))
+    (if elem
+	(if (functionp (cdr elem))
+	    (funcall (cdr elem) elem)
+	  (cdr elem))
+      "")))
+
 (declare-function notmuch-search "notmuch" (query &optional oldest-first target-thread target-line continuation))
 (declare-function notmuch-poll "notmuch" ())
 
-- 
1.7.5.4


Thread: