IMAP with server deletion

classic Classic list List threaded Threaded
4 messages Options
Sam Halliday Sam Halliday
Reply | Threaded
Open this post in threaded view
|

IMAP with server deletion

Hello all,

I'm using emacs + notmuch + offlineimap + msmtp to manage my Gmail.

My gmail account is starting to get so big that an offline sync is time
consuming.

I'd like to delete messages on the server, but keep them locally. Is
that possible with IMAP?

There is one complicating factor that stops me from being able to use
fetch-only POP3: I'd like to keep files on the server if they have the
+flagged tag, which is equivalent to "starred" in the Gmail interface.

Has anybody got a setup similar to this?



--
Best regards,
Sam

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (199 bytes) Download Attachment
Dan Čermák Dan Čermák
Reply | Threaded
Open this post in threaded view
|

Re: IMAP with server deletion

Hi Sam,

I don't have exactly the same setup, but what might work for you is the
following:
move all messages without +flagged into a local Maildir (that is not
synchronized by offlineimap, i.e. "just a folder").

Notmuch will still be able to find your messages and your
synchronization time will go down significantly.


Hope that helps,

Dan

Sam Halliday <[hidden email]> writes:

> Hello all,
>
> I'm using emacs + notmuch + offlineimap + msmtp to manage my Gmail.
>
> My gmail account is starting to get so big that an offline sync is time
> consuming.
>
> I'd like to delete messages on the server, but keep them locally. Is
> that possible with IMAP?
>
> There is one complicating factor that stops me from being able to use
> fetch-only POP3: I'd like to keep files on the server if they have the
> +flagged tag, which is equivalent to "starred" in the Gmail interface.
>
> Has anybody got a setup similar to this?
>
>
> --
> Best regards,
> Sam
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (847 bytes) Download Attachment
Chris Coutinho Chris Coutinho
Reply | Threaded
Open this post in threaded view
|

Re: IMAP with server deletion

In reply to this post by Sam Halliday
Offlineimap has a 'sync_deletes' flag that defaults to 'yes' in both your local and remote repositories. You can elect to delete locally and keep remote, or delete remotely and keep locally.

See the short comment in the offlineimap configuration file on github:


One point that is not clear is how to flag a message locally to be deleted on the remote, without deleting the message locally. What you probably want to do is delete your messages using the GMail UI using a browser.

Remember to make a backup!

C

On Fri, 5 Jul 2019 at 15:22, Sam Halliday <[hidden email]> wrote:
Hello all,

I'm using emacs + notmuch + offlineimap + msmtp to manage my Gmail.

My gmail account is starting to get so big that an offline sync is time
consuming.

I'd like to delete messages on the server, but keep them locally. Is
that possible with IMAP?

There is one complicating factor that stops me from being able to use
fetch-only POP3: I'd like to keep files on the server if they have the
+flagged tag, which is equivalent to "starred" in the Gmail interface.

Has anybody got a setup similar to this?


--
Best regards,
Sam
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Tomas Nordin Tomas Nordin
Reply | Threaded
Open this post in threaded view
|

Re: IMAP with server deletion

In reply to this post by Sam Halliday
Sam Halliday <[hidden email]> writes:

> Hello all,

Hello Sam

> I'm using emacs + notmuch + offlineimap + msmtp to manage my Gmail.

I have that setup apart from Gmail, (I use Posteo).

>
> My gmail account is starting to get so big that an offline sync is
>time
> consuming.
>
> I'd like to delete messages on the server, but keep them locally. Is
> that possible with IMAP?

Yes. I keep a lot of mailing list mails locally but delete them from the
server. I have this to tag list mails

(define-key notmuch-show-mode-map "a"
  (lambda ()
    "Tag all messages in current buffer with `rfile'."
    (interactive)
    (notmuch-show-tag-all (list "+rfile" "-inbox"))
    (message "rfiled the thread")))

so they all get tagged "rfile", just a tag I made up at some point. Then
I have this to move those messages to a directory not synced by
offlineimap:

(defun tn-refile-rfiles ()
  "Move all messages thus tagged to archive folder.

See variable `tn-refile-tags' for message tags that mean to move
the message to archived folder.

Discard all messages already in the archive folder."
  (interactive)
  (let (file-to-move count)
    (setq count 0)
    (message "Moving messages...")
    (dolist (file-to-move
                 (apply 'process-lines (append
                                    '("notmuch" "search" "--output=files")
                                                    tn-refile-tags
                                                    '("AND NOT folder:archive"))))
      (rename-file file-to-move
                   (concat tn-archive-folder
                                       (file-name-nondirectory file-to-move)))
      (setq count (1+ count)))
    (if (> count 0)
            (call-process "notmuch" nil "*tn-notmuch-new-out*" nil "new"))
    (message "Moved %d messages" count)))

The variable `tn-refile-tags' look like this

(defvar tn-refile-tags (list "tag:rfile" "tag:lst")
  "list of refile tag strings for use in a notmuch search")

Don't remember why I made this, really just using the rfile tag, but
anyway. Finally I have this binding:

(define-key notmuch-hello-mode-map (kbd "A") 'tn-refile-rfiles)

The effect is that offlineimap see those messages as deleted and sync
the deletion to the server. But for Notmuch the archive folder is a
valid folder and in my case it is "/home/tomas/Mail/archive/cur/".

Best regards
--
Tomas
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch