Function: dirvish--run-with-delay
dirvish--run-with-delay is a natively compiled function defined in
dirvish.el.
Signature
(dirvish--run-with-delay ACTION &optional RECORD FUN DEBOUNCE THROTTLE)
Documentation
Run function FUN accroding to ACTION with delay.
DEBOUNCE defaults to dirvish-input-debounce.
THROTTLE defaults to dirvish-input-throttle.
RECORD defaults to :default record in dirvish--timers.
Source Code
;; Defined in /nix/store/1gijwny2yx4fggrsb9l110h1ybs1gdk5-emacs-packages-deps/share/emacs/site-lisp/elpa/dirvish-20260725.1520/dirvish.el
(defun dirvish--run-with-delay (action &optional record fun debounce throttle)
"Run function FUN accroding to ACTION with delay.
DEBOUNCE defaults to `dirvish-input-debounce'.
THROTTLE defaults to `dirvish-input-throttle'.
RECORD defaults to `:default' record in `dirvish--timers'."
(declare (indent defun))
(unless (plist-get dirvish--timers (setq record (or record :default)))
(cl-callf append dirvish--timers
`(,record (,(timer-create) ,(float-time) nil))))
(setq record (plist-get dirvish--timers record) fun (or fun #'ignore)
debounce (or debounce dirvish-input-debounce)
throttle (or throttle dirvish-input-throttle))
(pcase action
((pred stringp)
(unless (equal action (nth 2 record))
(cancel-timer (car record))
(timer-set-function
(car record)
(lambda () (setf (nth 1 record) (float-time)) (funcall fun action)))
(timer-set-time
(car record)
(timer-relative-time
nil (max debounce (- (+ (nth 1 record) throttle) (float-time)))))
(setf (nth 2 record) action)
(timer-activate (car record))))
('reset (setf (nth 2 record) ""))))