mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-03 18:41:25 -08:00
Prefer nil to (current-time) when either will do
* lisp/emacs-lisp/timer.el (timer-event-handler, run-at-time): * lisp/gnus/gnus-score.el (gnus-score-date): * lisp/gnus/gnus-search.el (gnus-search-query-parse-date) (gnus-search-imap-handle-date): * lisp/gnus/gnus-sum.el (gnus-user-date) (gnus-summary-create-article): * lisp/image-dired.el (image-dired-create-thumb-1): * lisp/image/gravatar.el (gravatar-retrieve) (gravatar--prune-cache): * lisp/net/dbus.el (dbus-monitor-handler): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-times): * lisp/net/tramp-sh.el (tramp-sh-handle-set-file-times): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-times): * test/lisp/autorevert-tests.el (auto-revert--wait-for-revert) (auto-revert-tests--write-file, auto-revert-test--wait-for): * test/lisp/net/tramp-tests.el (tramp--test-print-duration): Prefer nil to (current-time) when either will do, as this avoids some consing. Similarly, prefer omitting (current-time) arg when this is equivalent.
This commit is contained in:
parent
af60618945
commit
524c42fa0e
13 changed files with 20 additions and 25 deletions
|
|
@ -18048,7 +18048,7 @@ find all messages that have been received recently from certain groups:
|
||||||
(list
|
(list
|
||||||
(cons 'query
|
(cons 'query
|
||||||
(format-time-string "SENTSINCE %d-%b-%Y"
|
(format-time-string "SENTSINCE %d-%b-%Y"
|
||||||
(time-subtract (current-time)
|
(time-subtract nil
|
||||||
(days-to-time (car args)))))
|
(days-to-time (car args)))))
|
||||||
(cons 'criteria "")))
|
(cons 'criteria "")))
|
||||||
(group-spec (cadr args)))
|
(group-spec (cadr args)))
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ This function is called, by name, directly by the C code."
|
||||||
(not (timer--idle-delay timer)))
|
(not (timer--idle-delay timer)))
|
||||||
(setf (timer--time timer)
|
(setf (timer--time timer)
|
||||||
(timer-next-integral-multiple-of-time
|
(timer-next-integral-multiple-of-time
|
||||||
(current-time) (timer--repeat-delay timer))))
|
nil (timer--repeat-delay timer))))
|
||||||
;; Place it back on the timer-list before running
|
;; Place it back on the timer-list before running
|
||||||
;; timer--function, so it can cancel-timer itself.
|
;; timer--function, so it can cancel-timer itself.
|
||||||
(timer-activate timer t cell)
|
(timer-activate timer t cell)
|
||||||
|
|
@ -391,7 +391,7 @@ This function returns a timer object which you can use in
|
||||||
|
|
||||||
;; Special case: t means the next integral multiple of REPEAT.
|
;; Special case: t means the next integral multiple of REPEAT.
|
||||||
(when (and (eq time t) repeat)
|
(when (and (eq time t) repeat)
|
||||||
(setq time (timer-next-integral-multiple-of-time (current-time) repeat))
|
(setq time (timer-next-integral-multiple-of-time nil repeat))
|
||||||
(setf (timer--integral-multiple timer) t))
|
(setf (timer--integral-multiple timer) t))
|
||||||
|
|
||||||
;; Handle numbers as relative times in seconds.
|
;; Handle numbers as relative times in seconds.
|
||||||
|
|
|
||||||
|
|
@ -1749,7 +1749,7 @@ score in `gnus-newsgroup-scored' by SCORE."
|
||||||
(setq type 'after
|
(setq type 'after
|
||||||
match-func 'string<
|
match-func 'string<
|
||||||
match (gnus-time-iso8601
|
match (gnus-time-iso8601
|
||||||
(time-subtract (current-time)
|
(time-subtract nil
|
||||||
(* 86400 (nth 0 kill))))))
|
(* 86400 (nth 0 kill))))))
|
||||||
((eq type 'before)
|
((eq type 'before)
|
||||||
(setq match-func 'gnus-string>
|
(setq match-func 'gnus-string>
|
||||||
|
|
@ -1758,7 +1758,7 @@ score in `gnus-newsgroup-scored' by SCORE."
|
||||||
(setq type 'before
|
(setq type 'before
|
||||||
match-func 'gnus-string>
|
match-func 'gnus-string>
|
||||||
match (gnus-time-iso8601
|
match (gnus-time-iso8601
|
||||||
(time-subtract (current-time)
|
(time-subtract nil
|
||||||
(* 86400 (nth 0 kill))))))
|
(* 86400 (nth 0 kill))))))
|
||||||
((eq type 'at)
|
((eq type 'at)
|
||||||
(setq match-func 'string=
|
(setq match-func 'string=
|
||||||
|
|
|
||||||
|
|
@ -572,9 +572,7 @@ REL-DATE, or (current-time) if REL-DATE is nil."
|
||||||
;; Time parsing doesn't seem to work with slashes.
|
;; Time parsing doesn't seem to work with slashes.
|
||||||
(let ((value (string-replace "/" "-" value))
|
(let ((value (string-replace "/" "-" value))
|
||||||
(now (append '(0 0 0)
|
(now (append '(0 0 0)
|
||||||
(seq-subseq (decode-time (or rel-date
|
(seq-subseq (decode-time rel-date) 3))))
|
||||||
(current-time)))
|
|
||||||
3))))
|
|
||||||
;; Check for relative time parsing.
|
;; Check for relative time parsing.
|
||||||
(if (string-match "\\([[:digit:]]+\\)\\([dwmy]\\)" value)
|
(if (string-match "\\([[:digit:]]+\\)\\([dwmy]\\)" value)
|
||||||
(seq-subseq
|
(seq-subseq
|
||||||
|
|
@ -1239,8 +1237,7 @@ nil (except that (dd nil yyyy) is not allowed). Massage those
|
||||||
numbers into the most recent past occurrence of whichever date
|
numbers into the most recent past occurrence of whichever date
|
||||||
elements are present."
|
elements are present."
|
||||||
(pcase-let ((`(,nday ,nmonth ,nyear)
|
(pcase-let ((`(,nday ,nmonth ,nyear)
|
||||||
(seq-subseq (decode-time (current-time))
|
(seq-subseq (decode-time) 3 6))
|
||||||
3 6))
|
|
||||||
(`(,dday ,dmonth ,dyear) date))
|
(`(,dday ,dmonth ,dyear) date))
|
||||||
(unless (and dday dmonth dyear)
|
(unless (and dday dmonth dyear)
|
||||||
(unless dday (setq dday 1))
|
(unless dday (setq dday 1))
|
||||||
|
|
|
||||||
|
|
@ -3968,10 +3968,9 @@ Returns \" ? \" if there's bad input or if another error occurs.
|
||||||
Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
|
Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
|
||||||
(condition-case ()
|
(condition-case ()
|
||||||
(let* ((messy-date (gnus-date-get-time messy-date))
|
(let* ((messy-date (gnus-date-get-time messy-date))
|
||||||
(now (current-time))
|
|
||||||
;;If we don't find something suitable we'll use this one
|
;;If we don't find something suitable we'll use this one
|
||||||
(my-format "%b %d '%y"))
|
(my-format "%b %d '%y"))
|
||||||
(let* ((difference (time-subtract now messy-date))
|
(let* ((difference (time-subtract nil messy-date))
|
||||||
(templist gnus-user-date-format-alist)
|
(templist gnus-user-date-format-alist)
|
||||||
(top (eval (caar templist) t)))
|
(top (eval (caar templist) t)))
|
||||||
(while (if (numberp top) (time-less-p top difference) (not top))
|
(while (if (numberp top) (time-less-p top difference) (not top))
|
||||||
|
|
@ -10496,7 +10495,6 @@ latter case, they will be copied into the relevant groups."
|
||||||
"Create an article in a mail newsgroup."
|
"Create an article in a mail newsgroup."
|
||||||
(interactive nil gnus-summary-mode)
|
(interactive nil gnus-summary-mode)
|
||||||
(let ((group gnus-newsgroup-name)
|
(let ((group gnus-newsgroup-name)
|
||||||
(now (current-time))
|
|
||||||
group-art)
|
group-art)
|
||||||
(unless (gnus-check-backend-function 'request-accept-article group)
|
(unless (gnus-check-backend-function 'request-accept-article group)
|
||||||
(error "%s does not support article importing" group))
|
(error "%s does not support article importing" group))
|
||||||
|
|
@ -10506,7 +10504,7 @@ latter case, they will be copied into the relevant groups."
|
||||||
;; This doesn't look like an article, so we fudge some headers.
|
;; This doesn't look like an article, so we fudge some headers.
|
||||||
(insert "From: " (read-string "From: ") "\n"
|
(insert "From: " (read-string "From: ") "\n"
|
||||||
"Subject: " (read-string "Subject: ") "\n"
|
"Subject: " (read-string "Subject: ") "\n"
|
||||||
"Date: " (message-make-date now) "\n"
|
"Date: " (message-make-date) "\n"
|
||||||
"Message-ID: " (message-make-message-id) "\n")
|
"Message-ID: " (message-make-message-id) "\n")
|
||||||
(setq group-art (gnus-request-accept-article group nil t))
|
(setq group-art (gnus-request-accept-article group nil t))
|
||||||
(kill-buffer (current-buffer)))
|
(kill-buffer (current-buffer)))
|
||||||
|
|
|
||||||
|
|
@ -768,7 +768,7 @@ and remove the cached thumbnail files between each trial run.")
|
||||||
(image-dired-debug-message
|
(image-dired-debug-message
|
||||||
(format-time-string
|
(format-time-string
|
||||||
"Generated thumbnails in %s.%3N seconds"
|
"Generated thumbnails in %s.%3N seconds"
|
||||||
(time-subtract (current-time)
|
(time-subtract nil
|
||||||
image-dired--generate-thumbs-start))))
|
image-dired--generate-thumbs-start))))
|
||||||
(if (not (and (eq (process-status process) 'exit)
|
(if (not (and (eq (process-status process) 'exit)
|
||||||
(zerop (process-exit-status process))))
|
(zerop (process-exit-status process))))
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ where GRAVATAR is either an image descriptor, or the symbol
|
||||||
;; Store the image in the cache.
|
;; Store the image in the cache.
|
||||||
(when image
|
(when image
|
||||||
(setf (gethash mail-address gravatar--cache)
|
(setf (gethash mail-address gravatar--cache)
|
||||||
(cons (time-convert (current-time) 'integer)
|
(cons (time-convert nil 'integer)
|
||||||
image)))
|
image)))
|
||||||
(prog1
|
(prog1
|
||||||
(apply callback (if data image 'error) cbargs)
|
(apply callback (if data image 'error) cbargs)
|
||||||
|
|
@ -286,7 +286,7 @@ where GRAVATAR is either an image descriptor, or the symbol
|
||||||
|
|
||||||
(defun gravatar--prune-cache ()
|
(defun gravatar--prune-cache ()
|
||||||
(let ((expired nil)
|
(let ((expired nil)
|
||||||
(time (- (time-convert (current-time) 'integer)
|
(time (- (time-convert nil 'integer)
|
||||||
;; Twelve hours.
|
;; Twelve hours.
|
||||||
(* 12 60 60))))
|
(* 12 60 60))))
|
||||||
(maphash (lambda (key val)
|
(maphash (lambda (key val)
|
||||||
|
|
|
||||||
|
|
@ -2102,7 +2102,7 @@ has been handled by this function."
|
||||||
(interface (dbus-event-interface-name event))
|
(interface (dbus-event-interface-name event))
|
||||||
(member (dbus-event-member-name event))
|
(member (dbus-event-member-name event))
|
||||||
(arguments (dbus-event-arguments event))
|
(arguments (dbus-event-arguments event))
|
||||||
(time (time-to-seconds (current-time))))
|
(time (float-time)))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
;; Check for matching method-call.
|
;; Check for matching method-call.
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
|
|
|
||||||
|
|
@ -1595,7 +1595,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
|
||||||
"%s" (if (or (null time)
|
"%s" (if (or (null time)
|
||||||
(tramp-compat-time-equal-p time tramp-time-doesnt-exist)
|
(tramp-compat-time-equal-p time tramp-time-doesnt-exist)
|
||||||
(tramp-compat-time-equal-p time tramp-time-dont-know))
|
(tramp-compat-time-equal-p time tramp-time-dont-know))
|
||||||
(current-time)
|
nil
|
||||||
time)))))
|
time)))))
|
||||||
|
|
||||||
(defun tramp-gvfs-handle-get-remote-uid (vec id-format)
|
(defun tramp-gvfs-handle-get-remote-uid (vec id-format)
|
||||||
|
|
|
||||||
|
|
@ -1429,7 +1429,7 @@ of."
|
||||||
(if (or (null time)
|
(if (or (null time)
|
||||||
(tramp-compat-time-equal-p time tramp-time-doesnt-exist)
|
(tramp-compat-time-equal-p time tramp-time-doesnt-exist)
|
||||||
(tramp-compat-time-equal-p time tramp-time-dont-know))
|
(tramp-compat-time-equal-p time tramp-time-dont-know))
|
||||||
(current-time)
|
nil
|
||||||
time)))
|
time)))
|
||||||
(tramp-send-command-and-check
|
(tramp-send-command-and-check
|
||||||
v (format
|
v (format
|
||||||
|
|
|
||||||
|
|
@ -534,7 +534,7 @@ the result will be a local, non-Tramp, file name."
|
||||||
(if (or (null time)
|
(if (or (null time)
|
||||||
(tramp-compat-time-equal-p time tramp-time-doesnt-exist)
|
(tramp-compat-time-equal-p time tramp-time-doesnt-exist)
|
||||||
(tramp-compat-time-equal-p time tramp-time-dont-know))
|
(tramp-compat-time-equal-p time tramp-time-dont-know))
|
||||||
(current-time)
|
nil
|
||||||
time)))
|
time)))
|
||||||
(tramp-sudoedit-send-command
|
(tramp-sudoedit-send-command
|
||||||
v "env" "TZ=UTC" "touch" "-t"
|
v "env" "TZ=UTC" "touch" "-t"
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ This expects `auto-revert--messages' to be bound by
|
||||||
`ert-with-message-capture' before calling."
|
`ert-with-message-capture' before calling."
|
||||||
;; Remote files do not cooperate well with timers. So we count ourselves.
|
;; Remote files do not cooperate well with timers. So we count ourselves.
|
||||||
(let ((ct (current-time)))
|
(let ((ct (current-time)))
|
||||||
(while (and (< (float-time (time-subtract (current-time) ct))
|
(while (and (< (float-time (time-subtract nil ct))
|
||||||
(auto-revert--timeout))
|
(auto-revert--timeout))
|
||||||
(null (string-match
|
(null (string-match
|
||||||
(format-message
|
(format-message
|
||||||
|
|
@ -167,7 +167,7 @@ This expects `auto-revert--messages' to be bound by
|
||||||
|
|
||||||
(defun auto-revert-tests--write-file (text file time-delta &optional append)
|
(defun auto-revert-tests--write-file (text file time-delta &optional append)
|
||||||
(write-region text nil file append 'no-message)
|
(write-region text nil file append 'no-message)
|
||||||
(set-file-times file (time-subtract (current-time) time-delta)))
|
(set-file-times file (time-subtract nil time-delta)))
|
||||||
|
|
||||||
(ert-deftest auto-revert-test00-auto-revert-mode ()
|
(ert-deftest auto-revert-test00-auto-revert-mode ()
|
||||||
"Check autorevert for a file."
|
"Check autorevert for a file."
|
||||||
|
|
@ -453,7 +453,7 @@ This expects `auto-revert--messages' to be bound by
|
||||||
(defun auto-revert-test--wait-for (pred max-wait)
|
(defun auto-revert-test--wait-for (pred max-wait)
|
||||||
"Wait until PRED is true, or MAX-WAIT seconds elapsed."
|
"Wait until PRED is true, or MAX-WAIT seconds elapsed."
|
||||||
(let ((ct (current-time)))
|
(let ((ct (current-time)))
|
||||||
(while (and (< (float-time (time-subtract (current-time) ct)) max-wait)
|
(while (and (< (float-time (time-subtract nil ct)) max-wait)
|
||||||
(not (funcall pred)))
|
(not (funcall pred)))
|
||||||
(read-event nil nil 0.1))))
|
(read-event nil nil 0.1))))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ is greater than 10.
|
||||||
(progn ,@body)
|
(progn ,@body)
|
||||||
(tramp--test-message
|
(tramp--test-message
|
||||||
"%s %f sec"
|
"%s %f sec"
|
||||||
,message (float-time (time-subtract (current-time) start))))))
|
,message (float-time (time-subtract nil start))))))
|
||||||
|
|
||||||
;; `always' is introduced with Emacs 28.1.
|
;; `always' is introduced with Emacs 28.1.
|
||||||
(defalias 'tramp--test-always
|
(defalias 'tramp--test-always
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue