summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-02-10 20:25:22 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2019-02-10 23:54:35 -0800
commit988e37fa0f922b852715671d59a0e3f682373411 (patch)
tree6520da61ebe5a27b3057bfb97eaa83053bf8eeec /lisp/gnus
parent3eb63da19579824801a169a03b9de7bdd945eaa6 (diff)
downloademacs-988e37fa0f922b852715671d59a0e3f682373411.tar.gz
emacs-988e37fa0f922b852715671d59a0e3f682373411.tar.bz2
emacs-988e37fa0f922b852715671d59a0e3f682373411.zip
Simplify use of encode-time
Most uses of (apply #'encode-time foo) can now be replaced with (encode-time foo). Make similar simplifications. * lisp/calendar/time-date.el (date-to-time): * lisp/calendar/timeclock.el (timeclock-when-to-leave) (timeclock-day-base, timeclock-generate-report): * lisp/emacs-lisp/timer.el (timer-set-idle-time): * lisp/eshell/esh-util.el (eshell-parse-ange-ls): * lisp/gnus/gnus-art.el (article-make-date-line): * lisp/gnus/gnus-delay.el (gnus-delay-article) (gnus-delay-send-queue): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event--decode-datefield): * lisp/gnus/gnus-logic.el (gnus-advanced-date): * lisp/gnus/message.el (message-make-expires-date): * lisp/gnus/nndiary.el (nndiary-compute-reminders): * lisp/mail/ietf-drums.el (ietf-drums-parse-date): * lisp/net/tramp-adb.el (tramp-adb-ls-output-time-less-p): * lisp/org/org-agenda.el (org-agenda-get-timestamps) (org-agenda-get-progress, org-agenda-show-clocking-issues): * lisp/org/org-capture.el (org-capture-set-target-location): * lisp/org/org-clock.el (org-clock-get-sum-start, org-clock-sum) (org-clocktable-steps): * lisp/org/org-colview.el (org-colview-construct-allowed-dates) * lisp/org/org-macro.el (org-macro--vc-modified-time): * lisp/org/org-table.el (org-table-eval-formula): * lisp/org/org.el (org-current-time, org-store-link) (org-time-today, org-read-date, org-read-date-display) (org-display-custom-time, org-time-string-to-time) (org-timestamp-change, org-timestamp--to-internal-time): * lisp/url/url-dav.el (url-dav-process-date-property): * lisp/vc/vc-cvs.el (vc-cvs-annotate-current-time) (vc-cvs-parse-entry): Simplify use of encode-time. * lisp/org/org-clock.el (org-clock-get-clocked-time): (org-clock-resolve, org-resolve-clocks, org_clock_out) (org-clock-update-time-maybe): Avoid some rounding problems with encode-time and float-time. * lisp/org/org-clock.el (org-clock-in, org-clock-update-time-maybe): * lisp/org/org-colview.el (org-columns--age-to-minutes): * lisp/org/org.el (org-get-scheduled-time, org-get-deadline-time) (org-add-planning-info, org-2ft, org-time-string-to-absolute) (org-closest-date): Use org-time-string-to-time instead of doing it by hand with encode-time. * lisp/org/org.el (org-current-time): Simplify rounding. (org-read-date): Avoid extra trip through encode-time.
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/gnus-art.el2
-rw-r--r--lisp/gnus/gnus-delay.el22
-rw-r--r--lisp/gnus/gnus-icalendar.el2
-rw-r--r--lisp/gnus/gnus-logic.el6
-rw-r--r--lisp/gnus/message.el2
-rw-r--r--lisp/gnus/nndiary.el12
6 files changed, 20 insertions, 26 deletions
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index e39011837a1..191f623afa3 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -3544,7 +3544,7 @@ possible values."
(substring
(message-make-date
(let* ((e (parse-time-string date))
- (tm (apply 'encode-time e))
+ (tm (encode-time e))
(ms (car tm))
(ls (- (cadr tm) (car (current-time-zone time)))))
(cond ((< ls 0) (list (1- ms) (+ ls 65536)))
diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el
index e013f26adf2..aabf23924a0 100644
--- a/lisp/gnus/gnus-delay.el
+++ b/lisp/gnus/gnus-delay.el
@@ -98,19 +98,15 @@ DELAY is a string, giving the length of the time. Possible values are:
(setq hour (string-to-number (match-string 1 delay))
minute (string-to-number (match-string 2 delay)))
;; Use current time, except...
- (setq deadline (apply 'vector (decode-time)))
+ (setq deadline (decode-time))
;; ... for minute and hour.
- (aset deadline 1 minute)
- (aset deadline 2 hour)
- ;; Convert to seconds.
- (setq deadline (float-time (apply 'encode-time
- (append deadline nil))))
+ (setq deadline (apply #'encode-time (car deadline) minute hour
+ (nthcdr 3 deadline)))
;; If this time has passed already, add a day.
- (when (< deadline (float-time))
- (setq deadline (+ 86400 deadline))) ; 86400 secs/day
+ (when (time-less-p deadline nil)
+ (setq deadline (time-add 86400 deadline))) ; 86400 secs/day
;; Convert seconds to date header.
- (setq deadline (message-make-date
- (encode-time deadline))))
+ (setq deadline (message-make-date deadline)))
((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay)
(setq num (match-string 1 delay))
(setq unit (match-string 2 delay))
@@ -128,8 +124,7 @@ DELAY is a string, giving the length of the time. Possible values are:
(setq delay (* num 60 60)))
(t
(setq delay (* num 60))))
- (setq deadline (message-make-date
- (encode-time (+ (float-time) delay)))))
+ (setq deadline (message-make-date (time-add nil delay))))
(t (error "Malformed delay `%s'" delay)))
(message-add-header (format "%s: %s" gnus-delay-header deadline)))
(set-buffer-modified-p t)
@@ -164,8 +159,7 @@ DELAY is a string, giving the length of the time. Possible values are:
nil t)
(progn
(setq deadline (nnheader-header-value))
- (setq deadline (apply 'encode-time
- (parse-time-string deadline)))
+ (setq deadline (encode-time (parse-time-string deadline)))
(unless (time-less-p nil deadline)
(message "Sending delayed article %d" article)
(gnus-draft-send article group)
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index e39561edb33..06f09271647 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -147,7 +147,7 @@
(icalendar--get-event-property-attributes
event field) zone-map))
(dtdate-dec (icalendar--decode-isodatetime dtdate nil dtdate-zone)))
- (apply 'encode-time dtdate-dec)))
+ (encode-time dtdate-dec)))
(defun gnus-icalendar-event--find-attendee (ical name-or-email)
(let* ((event (car (icalendar--all-events ical)))
diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el
index 8bf15cfd5b3..90f74205209 100644
--- a/lisp/gnus/gnus-logic.el
+++ b/lisp/gnus/gnus-logic.el
@@ -162,9 +162,9 @@
(funcall type (or (aref gnus-advanced-headers index) 0) match)))
(defun gnus-advanced-date (index match type)
- (let ((date (apply 'encode-time (parse-time-string
- (aref gnus-advanced-headers index))))
- (match (apply 'encode-time (parse-time-string match))))
+ (let ((date (encode-time (parse-time-string
+ (aref gnus-advanced-headers index))))
+ (match (encode-time (parse-time-string match))))
(cond
((eq type 'at)
(equal date match))
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 9d5445c18cc..b0674525a86 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -5542,7 +5542,7 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'."
(let* ((cur (decode-time))
(nday (+ days (nth 3 cur))))
(setf (nth 3 cur) nday)
- (message-make-date (apply 'encode-time cur))))
+ (message-make-date (encode-time cur))))
(defun message-make-message-id ()
"Make a unique Message-ID."
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index 3798be10582..c8b7eed9870 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -1278,27 +1278,27 @@ all. This may very well take some time.")
(push
(cond ((eq (cdr reminder) 'minute)
(time-subtract
- (apply 'encode-time 0 (nthcdr 1 date-elts))
+ (apply #'encode-time 0 (nthcdr 1 date-elts))
(encode-time (* (car reminder) 60.0))))
((eq (cdr reminder) 'hour)
(time-subtract
- (apply 'encode-time 0 0 (nthcdr 2 date-elts))
+ (apply #'encode-time 0 0 (nthcdr 2 date-elts))
(encode-time (* (car reminder) 3600.0))))
((eq (cdr reminder) 'day)
(time-subtract
- (apply 'encode-time 0 0 0 (nthcdr 3 date-elts))
+ (apply #'encode-time 0 0 0 (nthcdr 3 date-elts))
(encode-time (* (car reminder) 86400.0))))
((eq (cdr reminder) 'week)
(time-subtract
- (apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts))
+ (apply #'encode-time 0 0 0 monday (nthcdr 4 date-elts))
(encode-time (* (car reminder) 604800.0))))
((eq (cdr reminder) 'month)
(time-subtract
- (apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts))
+ (apply #'encode-time 0 0 0 1 (nthcdr 4 date-elts))
(encode-time (* (car reminder) 18748800.0))))
((eq (cdr reminder) 'year)
(time-subtract
- (apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts))
+ (apply #'encode-time 0 0 0 1 1 (nthcdr 5 date-elts))
(encode-time (* (car reminder) 400861056.0)))))
res))
(sort res 'time-less-p)))