From 387af85c4d51dd98267f296bc91cf22d7ecc5374 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 15 Sep 2021 10:58:50 +0200 Subject: [PATCH] Handle updates flags when setting flags * nnmaildir.el (nnmaildir--article-set-flags): Handle updated flags more gracefully --- lisp/gnus/nnmaildir.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 171f0813b38..690761a2d6c 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -194,7 +194,15 @@ This variable is set by `nnmaildir-request-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)) + (let ((possible (file-expand-wildcards (concat curdir prefix "*")))) + (cond ((length= possible 1) + (unless (string-match-p "\\`\\(.+\\):2,.*?\\'" (car possible)) + (error "Couldn't find updated article file %s" article-file)) + (setq article-file (car possible))) + ((length> possible 1) + (error "Couldn't determine exact article file %s" article-file)) + ((null possible) + (error "Couldn't find article file %s" article-file))))) (rename-file article-file new-name 'replace) (setf (nnmaildir--art-suffix article) new-suffix))) -- 2.39.2