From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: [PATCH 1/2] nnmaildir: Mirror Gnus flags to IMAP flags Date: Thu, 27 May 2010 15:07:13 -0600 Message-ID: <8855E4C3-2279-43C8-8AB9-E709654897EA@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: multipart/mixed; boundary=Apple-Mail-1-334489959 X-Trace: dough.gmane.org 1274999482 32701 80.91.229.12 (27 May 2010 22:31:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 27 May 2010 22:31:22 +0000 (UTC) To: "emacs-devel@gnu.org devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 28 00:31:21 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OHlbf-0000Hc-2b for ged-emacs-devel@m.gmane.org; Fri, 28 May 2010 00:31:15 +0200 Original-Received: from localhost ([127.0.0.1]:45729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHlbd-0004wK-QY for ged-emacs-devel@m.gmane.org; Thu, 27 May 2010 18:31:14 -0400 Original-Received: from [140.186.70.92] (port=60719 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHkrZ-0001ck-Gz for emacs-devel@gnu.org; Thu, 27 May 2010 17:43:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHkIS-0008Fs-3A for emacs-devel@gnu.org; Thu, 27 May 2010 17:07:21 -0400 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:61461) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHkIR-0008Fl-Qx for emacs-devel@gnu.org; Thu, 27 May 2010 17:07:20 -0400 Original-Received: by pwi6 with SMTP id 6so513645pwi.0 for ; Thu, 27 May 2010 14:07:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type:subject :date:message-id:to:mime-version:x-mailer; bh=LGIUpg0dRJihmEy/C4tA7c1fVz1FGFh1pQIvH6TYTM4=; b=GLRTbhGC3deHxXhlBt3SF7EoipGsMe+zklhnPstxCfvjckm6p58fY7SdKLTJ9hSx4f trlkDW+KFnoc4M3UpdJ2M33M3mOpl5EyvDjUQ9RrtOacJ7/WlYV3MxnfrOQRyajA/SbT 9hEjdJZoEgSQ8m5IJnkGQP4nC7iRC+zWTLq30= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:subject:date:message-id:to:mime-version:x-mailer; b=OrgHkLxYtS0w3zf/DUpK0vAMOTKsbYL4YJvptCSL9UeGdaneDmI2Ce1Hi47OfvbMOB /3O2qTSrZNbUXnaqbGx4vyrKdb492vY1utwawLi0p8JYbWdiZcs99hU/KCiTAEttNM/Q eSSpjfMe4isUt8czw813+92IytNVYW3WjTe/I= Original-Received: by 10.115.135.13 with SMTP id m13mr761685wan.206.1274994438866; Thu, 27 May 2010 14:07:18 -0700 (PDT) Original-Received: from [192.168.0.3] (174-24-43-180.clsp.qwest.net [174.24.43.180]) by mx.google.com with ESMTPS id b6sm13154064wam.21.2010.05.27.14.07.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 27 May 2010 14:07:16 -0700 (PDT) X-Mailer: Apple Mail (2.1078) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125313 Archived-At: --Apple-Mail-1-334489959 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The following patch causes nnmaildir.el to mirror Gnus marks to IMAP = flags, so that offlineimap can work sanely without needing a helper = script. John --Apple-Mail-1-334489959 Content-Disposition: attachment; filename=0001-nnmaildir-Mirror-Gnus-flags-to-IMAP-flags.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-nnmaildir-Mirror-Gnus-flags-to-IMAP-flags.patch" Content-Transfer-Encoding: quoted-printable =46rom=206c860b5b9835cdd6d76126a2f40fdadba1c62fac=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20John=20Wiegley=20=0A= Date:=20Thu,=2027=20May=202010=2014:58:24=20-0600=0ASubject:=20[PATCH=20= 1/2]=20nnmaildir:=20Mirror=20Gnus=20flags=20to=20IMAP=20flags=0A=0A---=0A= =20nnmaildir.el=20|=20=20=2053=20= ++++++++++++++++++++++++++++++++++++++++++++++++-----=0A=201=20files=20= changed,=2048=20insertions(+),=205=20deletions(-)=0A=0Adiff=20--git=20= a/nnmaildir.el=20b/nnmaildir.el=0Aindex=20ca73714..fde1fc8=20100644=0A= ---=20a/nnmaildir.el=0A+++=20b/nnmaildir.el=0A@@=20-120,7=20+120,7=20@@=20= by=20nnmaildir-request-article.")=0A=20=0A=20(defstruct=20nnmaildir--art=0A= =20=20=20(prefix=20nil=20:type=20string)=20=20;;=20"time.pid.host"=0A-=20= =20(suffix=20nil=20:type=20string)=20=20;;=20":2,flags"=0A+=20=20(suffix=20= nil=20:type=20string)=20=20;;=20":2,flags"=20(note:=20flags=20may=20be=20= empty)=0A=20=20=20(num=20=20=20=20nil=20:type=20natnum)=20=20;;=20= article=20number=0A=20=20=20(msgid=20=20nil=20:type=20string)=20=20;;=20= ""=0A=20=20=20(nov=20=20=20=20nil=20:type=20vector))=20;;=20= cached=20nov=20structure,=20or=20nil=0A@@=20-1535,6=20+1535,35=20@@=20by=20= nnmaildir-request-article.")=0A=20=09(erase-buffer))=0A=20=20=20=20=20=20= =20didnt)))=0A=20=0A+(defun=20nnmaildir-article-modify-file-flags=20= (article=20dir=20action=20marks)=0A+=20=20(let*=20((suffix=20= (nnmaildir--art-suffix=20article))=0A+=09=20(new-suffix=20suffix)=0A+=09=20= (xlat-alist=20'((tick=20=20.=20"F")=0A+=09=09=20=20=20=20=20=20=20(reply=20= .=20"R")=0A+=09=09=20=20=20=20=20=20=20(read=20=20.=20"S"))))=0A+=20=20=20= =20(when=20(eq=20action=20'set)=0A+=20=20=20=20=20=20(setq=20new-suffix=20= (replace-regexp-in-string=20"[FRS]"=20""=20new-suffix)=0A+=09=20=20=20=20= action=20'add))=0A+=20=20=20=20(dolist=20(mark=20marks)=0A+=20=20=20=20=20= =20(let=20((flag=20(cdr=20(assq=20mark=20xlat-alist))))=0A+=09(if=20flag=0A= +=09=20=20=20=20(cond=20((eq=20action=20'add)=0A+=09=09=20=20=20(unless=20= (string-match=20flag=20new-suffix)=0A+=09=09=20=20=20=20=20(setq=20= new-suffix=0A+=09=09=09=20=20=20(concat=20new-suffix=20flag))))=0A+=09=09= =20=20((eq=20action=20'delete)=0A+=09=09=20=20=20(if=20(string-match=20= flag=20new-suffix)=0A+=09=09=20=20=20=20=20=20=20(setq=20new-suffix=0A+=09= =09=09=20=20=20=20=20(replace-regexp-in-string=20flag=20""=20= new-suffix))))=0A+=09=09=20=20((eq=20action=20'set))))))=0A+=20=20=20=20= (unless=20(string=3D=20suffix=20new-suffix)=0A+=20=20=20=20=20=20(let=20= ((nnmaildir-article-file-name=0A+=09=20=20=20=20=20(concat=20dir=20= (nnmaildir--art-prefix=20article)=20suffix)))=0A+=09(setf=20= (nnmaildir--art-suffix=20article)=20new-suffix)=0A+=09(rename-file=20= nnmaildir-article-file-name=0A+=09=09=20=20=20=20=20(concat=20dir=20= (nnmaildir--art-prefix=20article)=0A+=09=09=09=20=20=20=20=20= new-suffix))))))=0A+=0A=20(defun=20nnmaildir-request-set-mark=20(gname=20= actions=20&optional=20server)=0A=20=20=20(let=20((group=20= (nnmaildir--prepare=20server=20gname))=0A=20=09(coding-system-for-write=20= nnheader-file-coding-system)=0A@@=20-1542,13=20+1571,21=20@@=20by=20= nnmaildir-request-article.")=0A=20=09(file-coding-system-alist=20nil)=0A=20= =09del-mark=20del-action=20add-action=20set-action=20marksdir=20nlist=0A=20= =09ranges=20begin=20end=20article=20all-marks=20todo-marks=20mdir=20= mfile=0A-=09pgname=20ls=20permarkfile=20deactivate-mark)=0A+=09pgname=20= ls=20permarkfile=20deactivate-mark=20dir=20marks-already-set)=0A+=20=20=20= =20(setq=20dir=20(nnmaildir--srv-dir=20nnmaildir--cur-server)=0A+=09=20=20= dir=20(nnmaildir--srvgrp-dir=20dir=20gname)=0A+=09=20=20dir=20(if=20= (nnmaildir--param=20pgname=20'read-only)=0A+=09=09=20=20(nnmaildir--new=20= dir)=20(nnmaildir--cur=20dir)))=0A=20=20=20=20=20(setq=20del-mark=0A=20=09= =20=20(lambda=20(mark)=0A=20=09=20=20=20=20(setq=20mfile=20= (nnmaildir--subdir=20marksdir=20(symbol-name=20mark))=0A=20=09=09=20=20= mfile=20(concat=20mfile=20(nnmaildir--art-prefix=20article)))=0A=20=09=20= =20=20=20(nnmaildir--unlink=20mfile))=0A-=09=20=20del-action=20(lambda=20= (article)=20(mapcar=20del-mark=20todo-marks))=0A+=09=20=20del-action=0A+=09= =20=20(lambda=20(article)=0A+=09=20=20=20=20(mapcar=20del-mark=20= todo-marks)=0A+=09=20=20=20=20(nnmaildir-article-modify-file-flags=20= article=20dir=0A+=09=09=09=09=09=09=20'delete=20todo-marks))=0A=20=09=20=20= add-action=0A=20=09=20=20(lambda=20(article)=0A=20=09=20=20=20=20(mapcar=0A= @@=20-1569,9=20+1606,15=20@@=20by=20nnmaildir-request-article.")=0A=20=09= =09=20=20=20=20=20(rename-file=20permarkfilenew=20permarkfile=20= 'replace)=0A=20=09=09=20=20=20=20=20(add-name-to-file=20permarkfile=20= mfile)))=0A=20=09=09=20=20(t=20(signal=20(car=20err)=20(cdr=20err))))))=0A= -=09=20=20=20=20=20todo-marks))=0A+=09=20=20=20=20=20todo-marks)=0A+=09=20= =20=20=20(unless=20marks-already-set=0A+=09=20=20=20=20=20=20= (nnmaildir-article-modify-file-flags=20article=20dir=0A+=09=09=09=09=09=09= =20=20=20'add=20todo-marks)))=0A=20=09=20=20set-action=20(lambda=20= (article)=0A-=09=09=20=20=20=20=20=20=20(funcall=20add-action)=0A+=09=09=20= =20=20=20=20=20=20(nnmaildir-article-modify-file-flags=20article=20dir=0A= +=09=09=09=09=09=09=09=20=20=20=20'set=20todo-marks)=0A+=09=09=20=20=20=20= =20=20=20(let=20((marks-already-set=20t))=0A+=09=09=09=20(funcall=20= add-action))=0A=20=09=09=20=20=20=20=20=20=20(mapcar=20(lambda=20(mark)=0A= =20=09=09=09=09=20(unless=20(memq=20mark=20todo-marks)=0A=20=09=09=09=09=20= =20=20(funcall=20del-mark=20mark)))=0A--=20=0A1.7.1=0A=0A= --Apple-Mail-1-334489959--