Subject: bug#8055: Patch for handling Maildir flags in nnmaildir

From: Magnus Henoch <[email-masked]>
Date: Wed, 05 Sep 2012 19:12:38 +0100

Lars Ingebrigtsen <[email-masked]> writes:

> Lars Ingebrigtsen <[email-masked]> writes:
>
>> Thanks; I've now applied this patch to Ma Gnus.
>
> Compilation gives this error, though:
>
> nnmaildir.el:130:1:Error: (nnmaildir--art-suffix article) is not a valid place expression

Right, nnmaildir--article-set-flags needs to be defined below the
nnmaildir--art defstruct.  (Spending too much time inside emacs
recompiling things incrementally can be a bad thing...)

diff --git a/lisp/nnmaildir.el b/lisp/nnmaildir.el
index caf2820..c5df510 100644
--- a/lisp/nnmaildir.el
+++ b/lisp/nnmaildir.el
@@ -127,16 +127,6 @@ SUFFIX should start with \":2,\"."
 	 (new-flags (concat (delq flag flags-as-list))))
     (concat ":2," new-flags)))
 
-(defun nnmaildir--article-set-flags (article new-suffix curdir)
-  (let* ((prefix (nnmaildir--art-prefix article))
-	 (suffix (nnmaildir--art-suffix article))
-	 (article-file (concat curdir prefix suffix))
-	 (new-name (concat curdir prefix new-suffix)))
-    (unless (file-exists-p article-file)
-      (error "Couldn't find article file %s" article-file))
-    (rename-file article-file new-name 'replace)
-    (setf (nnmaildir--art-suffix article) new-suffix)))
-
 (defvar nnmaildir-article-file-name nil
   "*The filename of the most recently requested article.  This variable is set
 by nnmaildir-request-article.")
@@ -212,6 +202,16 @@ by nnmaildir-request-article.")
   (gnm        	 nil)                      ;; flag: split from mail-sources?
   (target-prefix nil :type string))        ;; symlink target prefix
 
+(defun nnmaildir--article-set-flags (article new-suffix curdir)
+  (let* ((prefix (nnmaildir--art-prefix article))
+	 (suffix (nnmaildir--art-suffix article))
+	 (article-file (concat curdir prefix suffix))
+	 (new-name (concat curdir prefix new-suffix)))
+    (unless (file-exists-p article-file)
+      (error "Couldn't find article file %s" article-file))
+    (rename-file article-file new-name 'replace)
+    (setf (nnmaildir--art-suffix article) new-suffix)))
+
 (defun nnmaildir--expired-article (group article)
   (setf (nnmaildir--art-nov article) nil)
   (let ((flist  (nnmaildir--grp-flist group))