Unison + notmuch?

2013-06-14 Thread Amadeusz Żołnowski
James Vasile  writes:

> I'm tempted to see if unison can keep two notmuch databases in sync.
> Before I play with this concept, I was wondering if anybody with unison
> experience had already tried this.  I didn't see anything in the list
> archive/wiki/web.

I use Unison and notmuch and I obey the rule: before doing anything with
mails on another machine, first sync with the first one.  I don't think
Unison can help here.


Regards,

-- 
Amadeusz ?o?nowski
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20130614/54f11355/attachment.pgp>


[PATCH v3 2/2] contrib: pick: thread tagging (including archiving) implemented

2013-06-14 Thread Mark Walters
Previously pick had no actions based on the entire thread: this adds
some. Note in this version '*' is bound to `tag thread' which is not
consistent with search or show. However it still might be the most
natural thing (as it is similar to running * in the show pane).
---
 contrib/notmuch-pick/notmuch-pick.el |   27 +++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el 
b/contrib/notmuch-pick/notmuch-pick.el
index af117ba..eeb86d9 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -179,6 +179,7 @@
 (define-key map "q" 'notmuch-pick-quit)
 (define-key map "x" 'notmuch-pick-quit)
 (define-key map "?" 'notmuch-help)
+(define-key map "A" 'notmuch-pick-archive-thread)
 (define-key map "a" 'notmuch-pick-archive-message-then-next)
 (define-key map "=" 'notmuch-pick-refresh-view)
 (define-key map "s" 'notmuch-pick-to-search)
@@ -194,6 +195,7 @@
 (define-key map "|" 'notmuch-pick-pipe-message)
 (define-key map "-" 'notmuch-pick-remove-tag)
 (define-key map "+" 'notmuch-pick-add-tag)
+(define-key map "*" 'notmuch-pick-tag-thread)
 (define-key map " " 'notmuch-pick-scroll-or-next)
 (define-key map "b" 'notmuch-pick-scroll-message-window-back)
 map))
@@ -604,6 +606,31 @@ than only the current message."
 (notmuch-pick-thread-mapcar 'notmuch-pick-get-message-id)
 " or "))

+(defun notmuch-pick-tag-thread ( tag-changes)
+  "Tag all messages in the current thread"
+  (interactive)
+  (when (notmuch-pick-get-message-properties)
+(let ((tag-changes (notmuch-tag 
(notmuch-pick-get-messages-ids-thread-search) tag-changes)))
+  (notmuch-pick-thread-mapcar
+   (lambda () (notmuch-pick-tag-update-display tag-changes))
+
+(defun notmuch-pick-archive-thread ( unarchive)
+  "Archive each message in thread.
+
+Archive each message currently shown by applying the tag changes
+in `notmuch-archive-tags' to each. If a prefix argument is given,
+the messages will be \"unarchived\", i.e. the tag changes in
+`notmuch-archive-tags' will be reversed.
+
+Note: This command is safe from any race condition of new messages
+being delivered to the same thread. It does not archive the
+entire thread, but only the messages shown in the current
+buffer."
+  (interactive "P")
+  (when notmuch-archive-tags
+(notmuch-pick-tag-thread
+ (notmuch-tag-change-list notmuch-archive-tags unarchive
+
 ;; Functions below here display the pick buffer itself.

 (defun notmuch-pick-clean-address (address)
-- 
1.7.9.1



[PATCH v3 1/2] contrib: pick: add thread based utility functions

2013-06-14 Thread Mark Walters
Previously notmuch-pick had no thread based functionality. This adds a
macro to iterate through all messages in a thread. To simplify this it
adds a text-property marker to the first message of each thread.
---
 contrib/notmuch-pick/notmuch-pick.el |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el 
b/contrib/notmuch-pick/notmuch-pick.el
index 10a2bf7..af117ba 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -583,6 +583,29 @@ than only the current message."
  (message (format "Command '%s' exited abnormally with code %d"
   shell-command exit-code)))

+(defun notmuch-pick-thread-top ()
+  (when (notmuch-pick-get-message-properties)
+(while (not (or (notmuch-pick-get-prop :first) (eobp)))
+  (forward-line -1
+
+(defun notmuch-pick-thread-mapcar (function)
+  "Iterate through all messages in the current thread
+ and call FUNCTION for side effects."
+  (save-excursion
+(notmuch-pick-thread-top)
+(loop collect (funcall function)
+ do (forward-line)
+ while (and (notmuch-pick-get-message-properties)
+(not (notmuch-pick-get-prop :first))
+
+(defun notmuch-pick-get-messages-ids-thread-search ()
+  "Return a search string for all message ids of messages in the current 
thread."
+  (mapconcat 'identity
+(notmuch-pick-thread-mapcar 'notmuch-pick-get-message-id)
+" or "))
+
+;; Functions below here display the pick buffer itself.
+
 (defun notmuch-pick-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return
 AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return
@@ -680,6 +703,7 @@ unchanged ADDRESS if parsing fails."
(push "?" tree-status)))

   (push (concat (if replies "?" "?") "?") tree-status)
+  (plist-put msg :first (and first (eq 0 depth)))
   (notmuch-pick-goto-and-insert-msg (plist-put msg :tree-status 
tree-status))
   (pop tree-status)
   (pop tree-status)
-- 
1.7.9.1



[PATCH v3 0/2] Add some thread based actions to pick

2013-06-14 Thread Mark Walters
Version 2 of this series
id:1371166618-27196-1-git-send-email-markwalters1009 at gmail.com has an
error in my rebasing (I forgot to fold a bugfix in and had not
commited one part). Version 1 which had some review is at 
id:1354970914-18342-1-git-send-email-markwalters1009 at gmail.com

The changes from version 1: rebase on to current master, fix the macro
to be a function, change the mapc into the more natural mapcar which
removes the need for one auxillary function, removed the unnecessary
funcall, tweaked the docstring, changed a setq to a let.

Finally the rebase error (which was a bugfix from v1) is that we make
sure notmuch-pick-thread-top does not go into an infinite loop if
applied to an empty buffer.

Best wishes

Mark

Mark Walters (2):
  contrib: pick: add thread based utility functions
  contrib: pick: thread tagging (including archiving) implemented

 contrib/notmuch-pick/notmuch-pick.el |   51 ++
 1 files changed, 51 insertions(+), 0 deletions(-)

-- 
1.7.9.1



[PATCH v2 0/2] Add some thread based actions to pick

2013-06-14 Thread Mark Walters
Please ignore this version: it has a rebase bug. I will post a
corrected version tomorrow.

Sorry about that

Mark

On 14 June 2013 00:36, Mark Walters  wrote:
>
> This is version 2 of this patch set. Version 1 is at
> id:1354970914-18342-1-git-send-email-markwalters1009 at gmail.com
>
> The changes from version 1: rebase on to current master, fix the macro
> to be a function, change the mapc into the more natural mapcar which
> removes the need for one auxillary function, removed the unnecessary
> funcall and tweaked the docstring.
>
> Best wishes
>
> Mark
>
>
> Mark Walters (2):
>   contrib: pick: add thread based utility functions
>   contrib: pick: thread tagging (including archiving) implemented
>
>  contrib/notmuch-pick/notmuch-pick.el |   50
> ++
>  1 files changed, 50 insertions(+), 0 deletions(-)
>
> --
> 1.7.9.1
>


[PATCH v2 2/2] contrib: pick: thread tagging (including archiving) implemented

2013-06-14 Thread Mark Walters
Previously pick had no actions based on the entire thread: this adds
some. Note in this version '*' is bound to `tag thread' which is not
consistent with search or show. However it still might be the most
natural thing (as it is similar to running * in the show pane).
---
 contrib/notmuch-pick/notmuch-pick.el |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el 
b/contrib/notmuch-pick/notmuch-pick.el
index 8030842..642db79 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -179,6 +179,7 @@
 (define-key map "q" 'notmuch-pick-quit)
 (define-key map "x" 'notmuch-pick-quit)
 (define-key map "?" 'notmuch-help)
+(define-key map "A" 'notmuch-pick-archive-thread)
 (define-key map "a" 'notmuch-pick-archive-message-then-next)
 (define-key map "=" 'notmuch-pick-refresh-view)
 (define-key map "s" 'notmuch-pick-to-search)
@@ -194,6 +195,7 @@
 (define-key map "|" 'notmuch-pick-pipe-message)
 (define-key map "-" 'notmuch-pick-remove-tag)
 (define-key map "+" 'notmuch-pick-add-tag)
+(define-key map "*" 'notmuch-pick-tag-thread)
 (define-key map " " 'notmuch-pick-scroll-or-next)
 (define-key map "b" 'notmuch-pick-scroll-message-window-back)
 map))
@@ -604,6 +606,30 @@ than only the current message."
 (notmuch-pick-thread-mapcar 'notmuch-pick-get-message-id)
 " or "))

+(defun notmuch-pick-tag-thread ( tag-changes)
+  "Tag all messages in the current thread"
+  (interactive)
+  (setq tag-changes (notmuch-tag (notmuch-pick-get-messages-ids-thread-search) 
tag-changes))
+  (notmuch-pick-thread-mapcar
+   (lambda () (notmuch-pick-tag-update-display tag-changes
+
+(defun notmuch-pick-archive-thread ( unarchive)
+  "Archive each message in thread.
+
+Archive each message currently shown by applying the tag changes
+in `notmuch-archive-tags' to each. If a prefix argument is given,
+the messages will be \"unarchived\", i.e. the tag changes in
+`notmuch-archive-tags' will be reversed.
+
+Note: This command is safe from any race condition of new messages
+being delivered to the same thread. It does not archive the
+entire thread, but only the messages shown in the current
+buffer."
+  (interactive "P")
+  (when notmuch-archive-tags
+(notmuch-pick-tag-thread
+ (notmuch-tag-change-list notmuch-archive-tags unarchive
+
 ;; Functions below here display the pick buffer itself.

 (defun notmuch-pick-clean-address (address)
-- 
1.7.9.1



[PATCH v2 1/2] contrib: pick: add thread based utility functions

2013-06-14 Thread Mark Walters
Previously notmuch-pick had no thread based functionality. This adds a
macro to iterate through all messages in a thread. To simplify this it
adds a text-property marker to the first message of each thread.
---
 contrib/notmuch-pick/notmuch-pick.el |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/contrib/notmuch-pick/notmuch-pick.el 
b/contrib/notmuch-pick/notmuch-pick.el
index 10a2bf7..8030842 100644
--- a/contrib/notmuch-pick/notmuch-pick.el
+++ b/contrib/notmuch-pick/notmuch-pick.el
@@ -583,6 +583,29 @@ than only the current message."
  (message (format "Command '%s' exited abnormally with code %d"
   shell-command exit-code)))

+(defun notmuch-pick-thread-top ()
+  (interactive)
+  (while (not (notmuch-pick-get-prop :first))
+(forward-line -1)))
+
+(defun notmuch-pick-thread-mapcar (function)
+  "Iterate through all messages in the current thread
+ and call FUNCTION for side effects."
+  (save-excursion
+(notmuch-pick-thread-top)
+(loop collect (funcall function)
+ do (forward-line)
+ while (and (notmuch-pick-get-message-properties)
+(not (notmuch-pick-get-prop :first))
+
+(defun notmuch-pick-get-messages-ids-thread-search ()
+  "Return a search string for all message ids of messages in the current 
thread."
+  (mapconcat 'identity
+(notmuch-pick-thread-mapcar 'notmuch-pick-get-message-id)
+" or "))
+
+;; Functions below here display the pick buffer itself.
+
 (defun notmuch-pick-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return
 AUTHOR_NAME if present, otherwise return AUTHOR_EMAIL. Return
@@ -680,6 +703,7 @@ unchanged ADDRESS if parsing fails."
(push "?" tree-status)))

   (push (concat (if replies "?" "?") "?") tree-status)
+  (plist-put msg :first (and first (eq 0 depth)))
   (notmuch-pick-goto-and-insert-msg (plist-put msg :tree-status 
tree-status))
   (pop tree-status)
   (pop tree-status)
-- 
1.7.9.1



[PATCH v2 0/2] Add some thread based actions to pick

2013-06-14 Thread Mark Walters
This is version 2 of this patch set. Version 1 is at
id:1354970914-18342-1-git-send-email-markwalters1009 at gmail.com

The changes from version 1: rebase on to current master, fix the macro
to be a function, change the mapc into the more natural mapcar which
removes the need for one auxillary function, removed the unnecessary
funcall and tweaked the docstring.

Best wishes

Mark


Mark Walters (2):
  contrib: pick: add thread based utility functions
  contrib: pick: thread tagging (including archiving) implemented

 contrib/notmuch-pick/notmuch-pick.el |   50 ++
 1 files changed, 50 insertions(+), 0 deletions(-)

-- 
1.7.9.1