emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/why-this 37f3842f5e 32/59: Improve why-this-relative-time


From: ELPA Syncer
Subject: [nongnu] elpa/why-this 37f3842f5e 32/59: Improve why-this-relative-time
Date: Sun, 27 Nov 2022 16:02:51 -0500 (EST)

branch: elpa/why-this
commit 37f3842f5e8b7ab36744d3c66ae96d19fed67cf6
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Improve why-this-relative-time
---
 why-this.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/why-this.el b/why-this.el
index 072f6c2185..fd02ef843e 100644
--- a/why-this.el
+++ b/why-this.el
@@ -234,7 +234,6 @@ and return a string."
 
 (defface why-this-face
   '((t :foreground "#82b0ec"
-       :background nil
        :italic t))
   "Face for Why-This data."
   :package-version '(why-this "1.0")
@@ -276,9 +275,9 @@ When EXACT is non-nil, be as exact as possible."
             (let ((count (/ elapsed length)))
               (setq str (concat str
                                 (unless (zerop count)
-                                  (if (eq count 1)
-                                      (if (and (not exact)
-                                               (string= type "day"))
+                                  (if (and (not exact)
+                                           (eq count 1))
+                                      (if (string= type "day")
                                           "Yesterday"
                                         (format "A%s %s "
                                                 (if (string= type "hour")
@@ -292,13 +291,15 @@ When EXACT is non-nil, be as exact as possible."
       (when (or exact (zerop (length str)))
         (funcall calc-time "month" (* 30 24 3600))
         (when (or exact (zerop (length str)))
-          (funcall calc-time "day" (* 24 3600))
+          (funcall calc-time "week" (* 7 24 3600))
           (when (or exact (zerop (length str)))
-            (funcall calc-time "hour" 3600)
+            (funcall calc-time "day" (* 24 3600))
             (when (or exact (zerop (length str)))
-              (funcall calc-time "minute" 60)
+              (funcall calc-time "hour" 3600)
               (when (or exact (zerop (length str)))
-                (funcall calc-time "second" 1))))))
+                (funcall calc-time "minute" 60)
+                (when (or exact (zerop (length str)))
+                  (funcall calc-time "second" 1)))))))
       (if (and (not exact) (string= str "Yesterday"))
           str
         (concat str "ago")))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]