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

2011-11-24 Thread Jani Nikula
Signed-off-by: Jani Nikula 
---
 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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


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

2011-11-23 Thread Jani Nikula
Signed-off-by: Jani Nikula 
---
 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