Function: exec-path-from-shell--warn-duration

exec-path-from-shell--warn-duration is a macro defined in exec-path-from-shell.el.

Signature

(exec-path-from-shell--warn-duration &rest BODY)

Documentation

Evaluate BODY and warn if execution duration exceeds a time limit.

The limit is given by exec-path-from-shell-warn-duration-millis.

Source Code

;; Defined in /nix/store/a3f7aq5s6rdw5arrqvyppbs5jfrlsxa3-emacs-packages-deps/share/emacs/site-lisp/elpa/exec-path-from-shell-20260423.1833/exec-path-from-shell.el
(defmacro exec-path-from-shell--warn-duration (&rest body)
  "Evaluate BODY and warn if execution duration exceeds a time limit.
The limit is given by `exec-path-from-shell-warn-duration-millis'."
  (let ((start-time (gensym))
        (duration-millis (gensym)))
    `(let ((,start-time (current-time)))
       (prog1
           (progn ,@body)
         (let ((,duration-millis (* 1000.0 (float-time (time-subtract (current-time) ,start-time)))))
           (if (> ,duration-millis exec-path-from-shell-warn-duration-millis)
               (message "Warning: exec-path-from-shell execution took %dms. See the README for tips on reducing this." ,duration-millis)
             (exec-path-from-shell--debug "Shell execution took %dms" ,duration-millis)))))))