emacs-diffs
[Top][All Lists]
Advanced

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

master dd0727e 3/9: encode-time simplifications


From: Paul Eggert
Subject: master dd0727e 3/9: encode-time simplifications
Date: Thu, 16 Dec 2021 14:17:36 -0500 (EST)

branch: master
commit dd0727e1ec1f535b9b06be88173b4d3ccd55abcb
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    encode-time simplifications
    
    * lisp/gnus/gnus-search.el (gnus-search-query-parse-date):
    * lisp/net/soap-client.el (soap-decode-date-time):
    * lisp/net/tramp-adb.el (tramp-adb-ls-output-time-less-p):
    * lisp/org/ol.el (org-store-link):
    * lisp/org/org-clock.el (org-clock-sum)
    (org-clock-update-time-maybe):
    * lisp/org/org-colview.el (org-colview-construct-allowed-dates):
    * lisp/org/org-macro.el (org-macro--vc-modified-time):
    * lisp/org/org-macs.el (org-2ft, org-matcher-time):
    * lisp/org/org-table.el (org-table-eval-formula):
    * lisp/org/org.el (org-read-date, org-display-custom-time)
    (org-time-string-to-time, org-timestamp-change):
    Prefer (encode-time L) to (apply #'encode-time L) where either will do.
    * lisp/gnus/gnus-search.el (gnus-search-imap-handle-date):
    * lisp/org/org-clock.el (org-clocktable-steps):
    Prefer (encode-time S M ...) to (apply #'encode-time (list S M ...)).
---
 lisp/gnus/gnus-search.el |  8 +++-----
 lisp/net/soap-client.el  |  7 +++----
 lisp/net/tramp-adb.el    |  4 ++--
 lisp/org/ol.el           |  2 +-
 lisp/org/org-clock.el    | 12 ++++++------
 lisp/org/org-colview.el  |  2 +-
 lisp/org/org-macro.el    |  2 +-
 lisp/org/org-macs.el     |  4 ++--
 lisp/org/org-table.el    |  2 +-
 lisp/org/org.el          |  8 ++++----
 10 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index a79c106..46dc1cf 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -578,7 +578,7 @@ REL-DATE, or (current-time) if REL-DATE is nil."
        (seq-subseq
         (decode-time
          (time-subtract
-          (apply #'encode-time now)
+          (encode-time now)
           (days-to-time
            (* (string-to-number (match-string 1 value))
               (cdr (assoc (match-string 2 value)
@@ -597,7 +597,7 @@ REL-DATE, or (current-time) if REL-DATE is nil."
             ;; If DOW is given, handle that specially.
             (if (and (seq-elt d-time 6) (null (seq-elt d-time 3)))
                 (decode-time
-                 (time-subtract (apply #'encode-time now)
+                 (time-subtract (encode-time now)
                                 (days-to-time
                                  (+ (if (> (seq-elt d-time 6)
                                            (seq-elt now 6))
@@ -1257,9 +1257,7 @@ elements are present."
          (setq dmonth 1))))
     (format-time-string
      "%e-%b-%Y"
-     (apply #'encode-time
-           (append '(0 0 0)
-                   (list dday dmonth dyear))))))
+     (encode-time 0 0 0 dday dmonth dyear))))
 
 (cl-defmethod gnus-search-imap-handle-string ((engine gnus-search-imap)
                                              (str string))
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index b4aed27..6f915e9 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -718,10 +718,9 @@ representing leap seconds."
                 second)
               minute hour day month year second-fraction datatype time-zone)
       (let ((time
-             (apply
-              #'encode-time (list
-                             (if new-decode-time new-decode-time-second second)
-                             minute hour day month year nil nil time-zone))))
+            (encode-time (list
+                          (if new-decode-time new-decode-time-second second)
+                          minute hour day month year nil nil time-zone))))
         (if new-decode-time
             (with-no-warnings (decode-time time nil t))
           (decode-time time))))))
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 341357d..bc94092 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -416,9 +416,9 @@ Emacs dired can't find files."
   "Sort \"ls\" output by time, descending."
   (let (time-a time-b)
     (string-match tramp-adb-ls-date-regexp a)
-    (setq time-a (apply #'encode-time (parse-time-string (match-string 0 a))))
+    (setq time-a (encode-time (parse-time-string (match-string 0 a))))
     (string-match tramp-adb-ls-date-regexp b)
-    (setq time-b (apply #'encode-time (parse-time-string (match-string 0 b))))
+    (setq time-b (encode-time (parse-time-string (match-string 0 b))))
     (time-less-p time-b time-a)))
 
 (defun tramp-adb-ls-output-name-less-p (a b)
diff --git a/lisp/org/ol.el b/lisp/org/ol.el
index aa18497..b70f199 100644
--- a/lisp/org/ol.el
+++ b/lisp/org/ol.el
@@ -1575,7 +1575,7 @@ non-nil."
          (setq link
                (format-time-string
                 (car org-time-stamp-formats)
-                (apply 'encode-time
+                (encode-time
                        (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
                              nil nil nil))))
          (org-link-store-props :type "calendar" :date cd)))
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 12a4c2b..2526ca7 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1904,11 +1904,11 @@ PROPNAME lets you set a custom text property instead of 
:org-clock-minutes."
           ((match-end 2)
            ;; Two time stamps.
            (let* ((ts (float-time
-                       (apply #'encode-time
+                       (encode-time
                               (save-match-data
                                 (org-parse-time-string (match-string 2))))))
                   (te (float-time
-                       (apply #'encode-time
+                       (encode-time
                               (org-parse-time-string (match-string 3)))))
                   (dt (- (if tend (min te tend) te)
                          (if tstart (max ts tstart) ts))))
@@ -2837,7 +2837,7 @@ a number of clock tables."
           (pcase (if range (car range) (plist-get params :tstart))
             ((and (pred numberp) n)
              (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
-               (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
+              (encode-time 0 0 org-extend-today-until d m y)))
             (timestamp
             (seconds-to-time
              (org-matcher-time (or timestamp
@@ -2847,7 +2847,7 @@ a number of clock tables."
           (pcase (if range (nth 1 range) (plist-get params :tend))
             ((and (pred numberp) n)
              (pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
-               (apply #'encode-time (list 0 0 org-extend-today-until d m y))))
+              (encode-time 0 0 org-extend-today-until d m y)))
             (timestamp (seconds-to-time (org-matcher-time timestamp))))))
     (while (time-less-p start end)
       (unless (bolp) (insert "\n"))
@@ -3042,9 +3042,9 @@ Otherwise, return nil."
          (setq ts (match-string 1)
                te (match-string 3))
          (setq s (- (float-time
-                     (apply #'encode-time (org-parse-time-string te)))
+                     (encode-time (org-parse-time-string te)))
                     (float-time
-                     (apply #'encode-time (org-parse-time-string ts))))
+                     (encode-time (org-parse-time-string ts))))
                neg (< s 0)
                s (abs s)
                h (floor (/ s 3600))
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 9794382..f93e948 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -782,7 +782,7 @@ around it."
       (setq time-after (copy-sequence time))
       (setf (nth 3 time-before) (1- (nth 3 time)))
       (setf (nth 3 time-after) (1+ (nth 3 time)))
-      (mapcar (lambda (x) (format-time-string fmt (apply #'encode-time x)))
+      (mapcar (lambda (x) (format-time-string fmt (encode-time x)))
              (list time-before time time-after)))))
 
 (defun org-columns-open-link (&optional arg)
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index c0287a2..83c35fa 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -378,7 +378,7 @@ Return value as a string."
                                  (buffer-substring
                                   (point) (line-end-position)))))
                       (when (cl-some #'identity time)
-                        (setq date (apply #'encode-time time))))))))
+                        (setq date (encode-time time))))))))
              (let ((proc (get-buffer-process buf)))
                (while (and proc (accept-process-output proc .5 nil t)))))
          (kill-buffer buf))
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 0779c3a..044056b 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -1185,7 +1185,7 @@ nil, just return 0."
    ((numberp s) s)
    ((stringp s)
     (condition-case nil
-       (float-time (apply #'encode-time (org-parse-time-string s)))
+       (float-time (encode-time (org-parse-time-string s)))
       (error 0)))
    (t 0)))
 
@@ -1252,7 +1252,7 @@ following special strings: \"<now>\", \"<today>\",
 \"<tomorrow>\", and \"<yesterday>\".
 
 Return 0. if S is not recognized as a valid value."
-  (let ((today (float-time (apply #'encode-time
+  (let ((today (float-time (encode-time
                                  (append '(0 0 0) (nthcdr 3 (decode-time)))))))
     (save-match-data
       (cond
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index e34872f..a6dd8bf 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -2606,7 +2606,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
+                     (encode-time
                             (save-match-data (org-parse-time-string ts))))))
                 form t t))
 
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 00bbc07..253a9ef 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -13987,7 +13987,7 @@ user."
     (when (< (nth 2 org-defdecode) org-extend-today-until)
       (setf (nth 2 org-defdecode) -1)
       (setf (nth 1 org-defdecode) 59)
-      (setq org-def (apply #'encode-time org-defdecode))
+      (setq org-def (encode-time org-defdecode))
       (setq org-defdecode (decode-time org-def)))
     (let* ((timestr (format-time-string
                     (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d")
@@ -14471,7 +14471,7 @@ The command returns the inserted time stamp."
          time (org-fix-decoded-time t1)
          str (org-add-props
                  (format-time-string
-                  (substring tf 1 -1) (apply 'encode-time time))
+                  (substring tf 1 -1) (encode-time time))
                  nil 'mouse-face 'highlight))
     (put-text-property beg end 'display str)))
 
@@ -14726,7 +14726,7 @@ days in order to avoid rounding problems."
 
 (defun org-time-string-to-time (s)
   "Convert timestamp string S into internal time."
-  (apply #'encode-time (org-parse-time-string s)))
+  (encode-time (org-parse-time-string s)))
 
 (defun org-time-string-to-seconds (s)
   "Convert a timestamp string S into a number of seconds."
@@ -15156,7 +15156,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
          (setcar time0 (or (car time0) 0))
          (setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
          (setcar (nthcdr 2 time0) (or (nth 2 time0) 0))
-         (setq time (apply 'encode-time time0))))
+         (setq time (encode-time time0))))
       ;; Insert the new time-stamp, and ensure point stays in the same
       ;; category as before (i.e. not after the last position in that
       ;; category).



reply via email to

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