From facb1848952d5c844d76844e35da708fda8307c7 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 171f0813b3..690761a2d6 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -194,7 +194,15 @@ nnmaildir--article-set-flags (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.30.2