[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 83db9a1: Fix two more minor Gnus typos
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] emacs-26 83db9a1: Fix two more minor Gnus typos |
Date: |
Fri, 20 Oct 2017 22:17:08 -0400 (EDT) |
branch: emacs-26
commit 83db9a1bba20575303fd01f8e67d5c6e09e3d72a
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Fix two more minor Gnus typos
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming):
The old code had two minor bugs: first, it multiplied by 1/65536
instead of by 1/86400. Second, it called current-time twice and
glued part of the two results together, resulting in a race.
Fix both bugs by simplifying the code and using
time-to-number-of-days.
---
lisp/gnus/mail-source.el | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 3befd46..93f03be 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -591,25 +591,21 @@ Return the number of files that were found."
If CONFIRM is non-nil, ask for confirmation before removing a file."
(interactive "P")
(require 'gnus-util)
- (let* ((high2days (/ 65536.0 60 60 24));; convert high bits to days
- (low2days (/ 1.0 65536.0)) ;; convert low bits to days
+ (let* ((now (current-time))
(diff (if (natnump age) age 30));; fallback, if no valid AGE given
- currday files)
+ files)
(setq files (directory-files
mail-source-directory t
(concat "\\`"
- (regexp-quote mail-source-incoming-file-prefix)))
- currday (* (car (current-time)) high2days)
- currday (+ currday (* low2days (nth 1 (current-time)))))
+ (regexp-quote mail-source-incoming-file-prefix))))
(while files
(let* ((ffile (car files))
(bfile (replace-regexp-in-string "\\`.*/\\([^/]+\\)\\'" "\\1"
ffile))
- (filetime (nth 5 (file-attributes ffile)))
- (fileday (* (car filetime) high2days))
- (fileday (+ fileday (* low2days (nth 1 filetime)))))
+ (filetime (nth 5 (file-attributes ffile))))
(setq files (cdr files))
- (when (and (> (- currday fileday) diff)
+ (when (and (> (time-to-number-of-days (time-subtract now filetime))
+ diff)
(if confirm
(y-or-n-p
(format-message "\
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 83db9a1: Fix two more minor Gnus typos,
Paul Eggert <=