(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)))