]> git.eshelyaron.com Git - emacs.git/commitdiff
Prefer nil to (current-time) when either will do
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 6 Dec 2021 02:25:46 +0000 (18:25 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 6 Dec 2021 07:24:08 +0000 (23:24 -0800)
* 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.

13 files changed:
doc/misc/gnus.texi
lisp/emacs-lisp/timer.el
lisp/gnus/gnus-score.el
lisp/gnus/gnus-search.el
lisp/gnus/gnus-sum.el
lisp/image-dired.el
lisp/image/gravatar.el
lisp/net/dbus.el
lisp/net/tramp-gvfs.el
lisp/net/tramp-sh.el
lisp/net/tramp-sudoedit.el
test/lisp/autorevert-tests.el
test/lisp/net/tramp-tests.el

index 6ffc057ba15d5182ed4ed57d74b1016bde2918cf..74b5fb442e3d52abf4430f54f662f3855d79c3b8 100644 (file)
@@ -18048,7 +18048,7 @@ find all messages that have been received recently from certain groups:
          (list
           (cons 'query
                 (format-time-string "SENTSINCE %d-%b-%Y"
-                                    (time-subtract (current-time)
+                                    (time-subtract nil
                                                    (days-to-time (car args)))))
           (cons 'criteria "")))
         (group-spec (cadr args)))
index 2ac2c992456c37220667c4d28cc1e23e35f902be..c7d02cc74872f307f1da4fe5727954d0bbe95eea 100644 (file)
@@ -314,7 +314,7 @@ This function is called, by name, directly by the C code."
                          (not (timer--idle-delay timer)))
                 (setf (timer--time timer)
                       (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
               ;; timer--function, so it can cancel-timer itself.
               (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.
     (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))
 
     ;; Handle numbers as relative times in seconds.
index d031047804acdceea84297bf4053b5d00ce3764c..a25673a0e751023432829105ca468e39d3be76a2 100644 (file)
@@ -1749,7 +1749,7 @@ score in `gnus-newsgroup-scored' by SCORE."
            (setq type 'after
                  match-func 'string<
                  match (gnus-time-iso8601
-                        (time-subtract (current-time)
+                        (time-subtract nil
                                        (* 86400 (nth 0 kill))))))
           ((eq type 'before)
            (setq match-func 'gnus-string>
@@ -1758,7 +1758,7 @@ score in `gnus-newsgroup-scored' by SCORE."
            (setq type 'before
                  match-func 'gnus-string>
                  match (gnus-time-iso8601
-                        (time-subtract (current-time)
+                        (time-subtract nil
                                        (* 86400 (nth 0 kill))))))
           ((eq type 'at)
            (setq match-func 'string=
index c77de688e662befc1af084b1484b659b24f69d61..a79c106062ce690219eeef435832bf583dd745f6 100644 (file)
@@ -572,9 +572,7 @@ REL-DATE, or (current-time) if REL-DATE is nil."
   ;; Time parsing doesn't seem to work with slashes.
   (let ((value (string-replace "/" "-" value))
        (now (append '(0 0 0)
-                    (seq-subseq (decode-time (or rel-date
-                                                 (current-time)))
-                                3))))
+                    (seq-subseq (decode-time rel-date) 3))))
     ;; Check for relative time parsing.
     (if (string-match "\\([[:digit:]]+\\)\\([dwmy]\\)" value)
        (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
 elements are present."
   (pcase-let ((`(,nday ,nmonth ,nyear)
-              (seq-subseq (decode-time (current-time))
-                          3 6))
+              (seq-subseq (decode-time) 3 6))
              (`(,dday ,dmonth ,dyear) date))
     (unless (and dday dmonth dyear)
       (unless dday (setq dday 1))
index dcdf3d977dfc6e7ace7f1cfebbbfb0a73d93c6dc..ba616586002bb8497e6e1fff4c9289e1e4ebf59e 100644 (file)
@@ -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\"."
   (condition-case ()
       (let* ((messy-date (gnus-date-get-time messy-date))
-            (now (current-time))
             ;;If we don't find something suitable we'll use this one
             (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)
               (top (eval (caar templist) t)))
          (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."
   (interactive nil gnus-summary-mode)
   (let ((group gnus-newsgroup-name)
-       (now (current-time))
        group-art)
     (unless (gnus-check-backend-function 'request-accept-article 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.
       (insert "From: " (read-string "From: ") "\n"
              "Subject: " (read-string "Subject: ") "\n"
-             "Date: " (message-make-date now) "\n"
+             "Date: " (message-make-date) "\n"
              "Message-ID: " (message-make-message-id) "\n")
       (setq group-art (gnus-request-accept-article group nil t))
       (kill-buffer (current-buffer)))
index 0723804ff27bf853040d60c429e5917159f5cd00..fe0c3b7c2266d004f19bde845f1ca98f8fc870a2 100644 (file)
@@ -768,7 +768,7 @@ and remove the cached thumbnail files between each trial run.")
               (image-dired-debug-message
                (format-time-string
                 "Generated thumbnails in %s.%3N seconds"
-                (time-subtract (current-time)
+               (time-subtract nil
                                image-dired--generate-thumbs-start))))
             (if (not (and (eq (process-status process) 'exit)
                           (zerop (process-exit-status process))))
index f6f056a2baf08c2380061f7ff4fa97df7ffd0320..87726a9b8c824f308f72dc25f27190bc75fce20b 100644 (file)
@@ -277,7 +277,7 @@ where GRAVATAR is either an image descriptor, or the symbol
               ;; Store the image in the cache.
               (when image
                 (setf (gethash mail-address gravatar--cache)
-                      (cons (time-convert (current-time) 'integer)
+                     (cons (time-convert nil 'integer)
                             image)))
               (prog1
                   (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 ()
   (let ((expired nil)
-        (time (- (time-convert (current-time) 'integer)
+       (time (- (time-convert nil 'integer)
                  ;; Twelve hours.
                  (* 12 60 60))))
     (maphash (lambda (key val)
index 3fff5398c0680b283a7810ac6e00320c253495e8..411249767f589a93d28b7c78da8a062d7dc0900b 100644 (file)
@@ -2102,7 +2102,7 @@ has been handled by this function."
           (interface (dbus-event-interface-name event))
           (member (dbus-event-member-name event))
            (arguments (dbus-event-arguments event))
-           (time (time-to-seconds (current-time))))
+          (time (float-time)))
       (save-excursion
         ;; Check for matching method-call.
         (goto-char (point-max))
index 22e31428a7630701b31a1a901cdb0f030d6275f0..6d83ae59b0607c2bd49e5cb944054436bc3c9d02 100644 (file)
@@ -1595,7 +1595,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
       "%s" (if (or (null time)
                   (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
                   (tramp-compat-time-equal-p time tramp-time-dont-know))
-              (current-time)
+              nil
             time)))))
 
 (defun tramp-gvfs-handle-get-remote-uid (vec id-format)
index 8d106591af349477d88e918f193fcf4357086bcc..8e66363f03ab993d1ce5ec139ad8600872719d85 100644 (file)
@@ -1429,7 +1429,7 @@ of."
             (if (or (null time)
                     (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
                     (tramp-compat-time-equal-p time tramp-time-dont-know))
-                (current-time)
+                nil
               time)))
        (tramp-send-command-and-check
         v (format
index c91bced656c1457f4ecd06f8c279f9617508c8a7..6da00f812da8045f9400a516fbece8a73e059b4c 100644 (file)
@@ -534,7 +534,7 @@ the result will be a local, non-Tramp, file name."
           (if (or (null time)
                   (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
                   (tramp-compat-time-equal-p time tramp-time-dont-know))
-              (current-time)
+              nil
             time)))
       (tramp-sudoedit-send-command
        v "env" "TZ=UTC" "touch" "-t"
index b9d45324cb77ed65bcce96c7396cf137d136e2ef..b31f0a9afc42724411c08149c996bf43266b55d2 100644 (file)
@@ -127,7 +127,7 @@ This expects `auto-revert--messages' to be bound by
 `ert-with-message-capture' before calling."
   ;; Remote files do not cooperate well with timers.  So we count ourselves.
   (let ((ct (current-time)))
-    (while (and (< (float-time (time-subtract (current-time) ct))
+    (while (and (< (float-time (time-subtract nil ct))
                    (auto-revert--timeout))
                 (null (string-match
                        (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)
   (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 ()
   "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)
   "Wait until PRED is true, or MAX-WAIT seconds elapsed."
   (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)))
       (read-event nil nil 0.1))))
 
index 47fa18eb8061555fffb38038f0fb4b4fb4815c46..c047f666dae0fa8775c9edf354801e3e7b2dfa62 100644 (file)
@@ -241,7 +241,7 @@ is greater than 10.
         (progn ,@body)
        (tramp--test-message
        "%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.
 (defalias 'tramp--test-always