messages: download-message: Reset mtime.
authorRicardo Wurmus <rekado@elephly.net>
Tue, 31 Mar 2020 08:32:59 +0000 (10:32 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Tue, 31 Mar 2020 08:32:59 +0000 (10:32 +0200)
mumi/messages.scm

index 63f68df9aeaeae107cb589689ad012e475e740bb..805a5183a735dda86b2c67e6e30ffa3a09948f05 100644 (file)
@@ -174,7 +174,22 @@ target file."
                               (lambda ()
                                 (put-bytevector (current-output-port)
                                                 (get-bytevector-all port))))
-                            (close-port port)))
+                            (close-port port)
+
+                            ;; Reset mtime, because mu uses it!
+                            (with-input-from-file file-name
+                              (lambda ()
+                                (match (mbox->emails (current-input-port))
+                                  ((email)
+                                   (let* ((mail (parse-email email))
+                                          (seconds
+                                           (time-second
+                                            (date->time-monotonic
+                                             (date mail)))))
+                                     (utime file-name
+                                            seconds
+                                            seconds)))
+                                  (_ #f))))))
                         file-name)))))))
 
 ;; We would like to use get-bug-log here, but it often returns