unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Synchronize tags across machines without a mail server
@ 2019-03-19 10:20 Pierre Neidhardt
  2019-03-19 17:15 ` Ralph Seichter
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Neidhardt @ 2019-03-19 10:20 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]

Hi,

I know this has been asked a couple of times, and it seems that the
current solutions are:

- nmbug
  (http://notmuch.198994.n3.nabble.com/multiple-machine-tagging-td831812.html#a4031973
  http://notmuch.198994.n3.nabble.com/PATCH-v4-nmbug-Add-an-init-command-td4032972.html)
  It seems that "nmbug init" has not been merged yet.  Using the patch
  above I wasn't able to add an "upstream".  Am I missing the obvious?

- muchsync (http://www.muchsync.org/): Requires our own mail server if I
  understand correctly.


What I want is sync the `notmuch dump' of non-automatic tags across my
systems, considering I don't run my own webserver.

So far, I came up with the following:

--8<---------------cut here---------------start------------->8---
(require 'seq)

(unless (boundp 'notmuch-command)
  ;; So that this file can be use in external scripts without require
  ;; notmuch.el.
  (setq notmuch-command "notmuch"))

(defun notmuch-all-tags ()
  (split-string
   (with-output-to-string
     (with-current-buffer standard-output
       (call-process notmuch-command nil t
                     nil "search" "--output=tags" "--exclude=false" "*")))))

(defvar notmuch-unimportant-tags '("attachment" "deleted" "draft" "encrypted"
                                   "flagged" "inbox" "passed" "replied" "sent"
                                   "signed" "unread"))
(defvar notmuch-dump-file (expand-file-name "~/personal/mail/notmuch.dump"))

(defun notmuch-dump-important-tags (&optional file)
  "Dump notmuch tag database to `notmuch-dump-file'.
Messages with only `notmuch-unimportant-tags' are ignored."
  (interactive)
  (setq file (or file notmuch-dump-file))
  (let* ((important-tags (seq-difference (notmuch-all-tags) notmuch-unimportant-tags))
         (tags-arg (cons (concat "tag:" (car important-tags))
                         (cl-loop for tag in (cdr important-tags)
                                  append (list "or" (concat "tag:" tag))))))
    (apply 'call-process notmuch-command nil `(:file ,file) nil
           "dump" tags-arg)))
--8<---------------cut here---------------end--------------->8---

This will save all non-trivial / non-automated tags.  I can call
`notmuch-dump-important-tags' manually from Emacs or automatically
(e.g. mcron job or similar sync script) with

	emacs --quick --batch --load=$HOME/.emacs.d/lisp/init-notmuch-sync.el \
				-f notmuch-dump-important-tags

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Synchronize tags across machines without a mail server
  2019-03-19 10:20 Synchronize tags across machines without a mail server Pierre Neidhardt
@ 2019-03-19 17:15 ` Ralph Seichter
  2019-03-19 18:23   ` Dan Čermák
  0 siblings, 1 reply; 4+ messages in thread
From: Ralph Seichter @ 2019-03-19 17:15 UTC (permalink / raw)
  To: notmuch

* Pierre Neidhardt:

> muchsync (http://www.muchsync.org/): Requires our own mail server if I
> understand correctly.

No. If you have a machine A with notmuch already set up, and want to
sync to machine B, you only need SSH access from B to A (plus notmuch
and muchsync installed on B).

-Ralph

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Synchronize tags across machines without a mail server
  2019-03-19 17:15 ` Ralph Seichter
@ 2019-03-19 18:23   ` Dan Čermák
  2019-03-19 18:45     ` Ralph Seichter
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Čermák @ 2019-03-19 18:23 UTC (permalink / raw)
  To: Ralph Seichter, notmuch

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

Ralph Seichter <abbot@monksofcool.net> writes:

> * Pierre Neidhardt:
>
>> muchsync (http://www.muchsync.org/): Requires our own mail server if I
>> understand correctly.
>
> No. If you have a machine A with notmuch already set up, and want to
> sync to machine B, you only need SSH access from B to A (plus notmuch
> and muchsync installed on B).

That's correct if you are fine with machine B only syncing with machine
A via muchsync and no longer with your mail servers via IMAP (or at
least I don't know a way how to make that work).

>
> -Ralph
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Synchronize tags across machines without a mail server
  2019-03-19 18:23   ` Dan Čermák
@ 2019-03-19 18:45     ` Ralph Seichter
  0 siblings, 0 replies; 4+ messages in thread
From: Ralph Seichter @ 2019-03-19 18:45 UTC (permalink / raw)
  To: notmuch

* Dan Čermák:

> Ralph Seichter <abbot@monksofcool.net> writes:
>
>> * Pierre Neidhardt:
>>
>>> muchsync (http://www.muchsync.org/): Requires our own mail server if I
>>> understand correctly.
>>
>> No. If you have a machine A with notmuch already set up, and want to
>> sync to machine B, you only need SSH access from B to A (plus notmuch
>> and muchsync installed on B).
>
> That's correct if you are fine with machine B only syncing with machine
> A via muchsync and no longer with your mail servers via IMAP (or at
> least I don't know a way how to make that work).

Sorry for quoting the whole history here, but I don't see how your
comment relates to me stating that muchsync does not require a "mail
server"? If the MTA can deliver into Maildir (like Postfix can), one
does not need an IMAP server at all.

Muchsync can perform both content and metadata synchronisation, which
takes care of my needs. I run it as a background job on my notebook. An
IMAP server can be in the mix somewhere, but is not needed. That's all I
am trying to say.

-Ralph

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-19 18:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 10:20 Synchronize tags across machines without a mail server Pierre Neidhardt
2019-03-19 17:15 ` Ralph Seichter
2019-03-19 18:23   ` Dan Čermák
2019-03-19 18:45     ` Ralph Seichter

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).