[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org a4105d0942 05/12: Use higher level helpers instead
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org a4105d0942 05/12: Use higher level helpers instead of `encode-time' |
Date: |
Sun, 17 Jul 2022 04:57:50 -0400 (EDT) |
branch: externals/org
commit a4105d0942d8728c689040baffa32d1273750fd6
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Ihor Radchenko <yantar92@gmail.com>
Use higher level helpers instead of `encode-time'
* lisp/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
Prefer org-time-string-to-seconds to doing it by hand.
* lisp/org-macs.el (org-2ft):
Prefer org-time-string-to-seconds to doing it by hand.
* lisp/org-table.el (org-table-eval-formula):
Prefer org-time-string-to-time to doing it by hand.
Max Nikulin:
A larger patch "Improve Org usage of timestamps" was suggested in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54764#10
Only cosmetic changes are selected for this patch.
---
lisp/org-clock.el | 17 ++++++-----------
lisp/org-macs.el | 2 +-
lisp/org-table.el | 3 +--
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index e0b2d3ce69..577baaa838 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1914,13 +1914,10 @@ PROPNAME lets you set a custom text property instead of
:org-clock-minutes."
(cond
((match-end 2)
;; Two time stamps.
- (let* ((ts (float-time
- (apply #'encode-time
- (save-match-data
- (org-parse-time-string (match-string 2))))))
- (te (float-time
- (apply #'encode-time
- (org-parse-time-string (match-string 3)))))
+ (let* ((ss (match-string 2))
+ (se (match-string 3))
+ (ts (org-time-string-to-seconds ss))
+ (te (org-time-string-to-seconds se))
(dt (- (if tend (min te tend) te)
(if tstart (max ts tstart) ts))))
(when (> dt 0) (cl-incf t1 (floor dt 60)))))
@@ -3052,10 +3049,8 @@ Otherwise, return nil."
(end-of-line 1)
(setq ts (match-string 1)
te (match-string 3))
- (setq s (- (float-time
- (apply #'encode-time (org-parse-time-string te)))
- (float-time
- (apply #'encode-time (org-parse-time-string ts))))
+ (setq s (- (org-time-string-to-seconds te)
+ (org-time-string-to-seconds ts))
neg (< s 0)
s (abs s)
h (floor (/ s 3600))
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index b6f1a7fdfc..b848987765 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1358,7 +1358,7 @@ nil, just return 0."
((numberp s) s)
((stringp s)
(condition-case nil
- (float-time (apply #'encode-time (org-parse-time-string s)))
+ (org-time-string-to-seconds s)
(error 0)))
(t 0)))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index e84c2090fb..e9d6c5a9fc 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2607,8 +2607,7 @@ location of point."
(format-time-string
(org-time-stamp-format
(string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))
- (apply #'encode-time
- (save-match-data (org-parse-time-string ts))))))
+ (save-match-data (org-time-string-to-time ts)))))
form t t))
(setq ev (if (and duration (string-match
"^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form))
- [elpa] externals/org updated (0583a0c5ea -> b4a72ddf98), ELPA Syncer, 2022/07/17
- [elpa] externals/org c550a42902 01/12: oc-basic: Parse @string entries in BiBTeX bibliographies, ELPA Syncer, 2022/07/17
- [elpa] externals/org a189697681 04/12: Fix tests for `org-parse-time-string' and `org-clock', ELPA Syncer, 2022/07/17
- [elpa] externals/org 132a9d304e 03/12: Use unknown DST instead of standard time in timestamps, ELPA Syncer, 2022/07/17
- [elpa] externals/org ae1db7df39 08/12: Use `org-encode-time' helper macro, ELPA Syncer, 2022/07/17
- [elpa] externals/org b4a72ddf98 12/12: org-agenda-show-current-time-in-grid: Use more common Unicode arrow, ELPA Syncer, 2022/07/17
- [elpa] externals/org bf930b6fe5 02/12: ; * lisp/org-refile.el (org-refile-targets): Fix typo., ELPA Syncer, 2022/07/17
- [elpa] externals/org e08ce5b27d 09/12: test-org.el: Add some tests for `org-test-with-timezone', ELPA Syncer, 2022/07/17
- [elpa] externals/org f3802b017c 06/12: testing/lisp: Use `org-time-string-to-time', ELPA Syncer, 2022/07/17
- [elpa] externals/org a4105d0942 05/12: Use higher level helpers instead of `encode-time',
ELPA Syncer <=
- [elpa] externals/org 064afa0c01 11/12: org-indent: Fix edge case when edited region ends at headline leading stars, ELPA Syncer, 2022/07/17
- [elpa] externals/org 79f0969ccc 10/12: * doc/org-manual.org (Using CDLaTeX to enter math): Clarify ' binding, ELPA Syncer, 2022/07/17
- [elpa] externals/org 8908a1bda1 07/12: org-macs.el: Introduce a helper for `encode-time', ELPA Syncer, 2022/07/17