[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/counsel 14c696aa2d 1/2: Prefer Emacs 27 (TICKS . HZ) ti
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/counsel 14c696aa2d 1/2: Prefer Emacs 27 (TICKS . HZ) time values |
Date: |
Thu, 29 Feb 2024 10:18:37 -0500 (EST) |
branch: externals/counsel
commit 14c696aa2d6cd905795ba543374457a04a13ccae
Author: Basil L. Contovounesios <basil@contovou.net>
Commit: Basil L. Contovounesios <basil@contovou.net>
Prefer Emacs 27 (TICKS . HZ) time values
* counsel.el (counsel--async-filter-update-time): New function.
(counsel--async-filter): Use it in place of creating a (HI LO MICRO)
timestamp by hand.
(counsel-file-stale-p): Use time-since in place of time-subtract.
---
counsel.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/counsel.el b/counsel.el
index c5d9e6507a..67f93f5b7b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -318,13 +318,20 @@ caused by spawning too many subprocesses too quickly."
"The amount of microseconds to wait until updating `counsel--async-filter'."
:type 'integer)
+(defalias 'counsel--async-filter-update-time
+ (if (fboundp 'time-convert)
+ ;; Preferred (TICKS . HZ) format since Emacs 27.1.
+ (lambda () (cons counsel-async-filter-update-time 1000000))
+ (lambda () (list 0 0 counsel-async-filter-update-time)))
+ "Return `counsel-async-filter-update-time' as a time value.")
+
(defun counsel--async-filter (process str)
"Receive from PROCESS the output STR.
Update the minibuffer with the amount of lines collected every
`counsel-async-filter-update-time' microseconds since the last update."
(with-current-buffer (process-buffer process)
(insert str))
- (when (time-less-p (list 0 0 counsel-async-filter-update-time)
+ (when (time-less-p (counsel--async-filter-update-time)
(time-since counsel--async-time))
(let (numlines)
(with-current-buffer (process-buffer process)
@@ -2677,7 +2684,7 @@ library, which see."
(defun counsel-file-stale-p (fname seconds)
"Return non-nil if FNAME was modified more than SECONDS ago."
- (> (float-time (time-subtract nil (nth 5 (file-attributes fname))))
+ (> (float-time (time-since (nth 5 (file-attributes fname))))
seconds))
(defun counsel--locate-updatedb ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/counsel 14c696aa2d 1/2: Prefer Emacs 27 (TICKS . HZ) time values,
Basil L. Contovounesios <=