From: Philip Kaludercic Date: Wed, 15 Sep 2021 08:58:50 +0000 (+0200) Subject: Handle updates flags when setting flags X-Git-Tag: emacs-28.0.90~707 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=387af85c4d51dd98267f296bc91cf22d7ecc5374;p=emacs.git Handle updates flags when setting flags * nnmaildir.el (nnmaildir--article-set-flags): Handle updated flags more gracefully --- 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)))