emacs-diffs
[Top][All Lists]
Advanced

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

master e14e5dff2c 4/4: Merge branch 'master' of git.savannah.gnu.org:/sr


From: Eli Zaretskii
Subject: master e14e5dff2c 4/4: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Wed, 13 Apr 2022 10:01:05 -0400 (EDT)

branch: master
commit e14e5dff2c5d8113b06e2aafa0d920120bdb68e9
Merge: 131ac4d209 0ef9f6d07b
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 lisp/calendar/time-date.el | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index 0db973ea16..ba7c48b290 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -343,15 +343,18 @@ right of \"%x\", trailing zero units are not output."
           ;; Cf article-make-date-line in gnus-art.
           (setq num (floor seconds unit)
                 seconds (- seconds (* num unit)))
-          ;; Start position of the first non-zero unit.
-          (when (and (not leading-zeropos)
-                     (not (zerop num)))
-            (setq leading-zeropos (match-beginning 0)))
-          (unless (zerop num)
-            (setq trailing-zeropos nil))
-          (when (and (not trailing-zeropos)
-                     (zerop num))
-            (setq trailing-zeropos (match-beginning 0)))
+          (let ((is-zero (zerop (if (= unit 1)
+                                    (+ num fraction)
+                                  num))))
+            ;; Start position of the first non-zero unit.
+            (when (and (not leading-zeropos)
+                       (not is-zero))
+              (setq leading-zeropos (match-beginning 0)))
+            (unless is-zero
+              (setq trailing-zeropos nil))
+            (when (and (not trailing-zeropos)
+                       is-zero)
+              (setq trailing-zeropos (match-beginning 0))))
           (setq string
                 (replace-match
                  (format (if (match-string 2 string)



reply via email to

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