From 4fd6ecc3d599cedabc821c2d85cc010770dd537b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 4 Jan 2025 06:01:55 +0100 Subject: [PATCH] Report time to process man page --- lisp/man.el | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index 54ca8cbae9f..36c136db4a6 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1210,6 +1210,8 @@ Man-start-calling (setenv "MAN_KEEP_FORMATTING" "1") ,@body)) +(defvar-local man--background-time-start nil) + (defun Man-getpage-in-background (topic) "Use TOPIC to build and fire off the manpage and cleaning command. Return the buffer in which the manpage will appear." @@ -1230,6 +1232,7 @@ Man-getpage-in-background (setq Man-original-frame (selected-frame)) (setq Man-arguments man-args) (Man-mode) + (setq man--background-time-start (current-time)) (setq mode-line-process (concat " " (propertize (if Man-fontify-manpage-flag "[formatting...]" @@ -1621,11 +1624,19 @@ Man-bgproc-sentinel (setq message (format "Can't find the %s manpage" (Man-page-from-arguments args))))) - (if Man-fontify-manpage-flag - (setq message (format "%s man page formatted" - (Man-page-from-arguments Man-arguments))) - (setq message (format "%s man page cleaned up" - (Man-page-from-arguments Man-arguments)))) + (let ((elapsed-time + (format-time-string + " [in %s.%3N seconds]" + (time-subtract (current-time) + man--background-time-start)))) + (setq message + (if Man-fontify-manpage-flag + (format "%s man page formatted%s" + (Man-page-from-arguments Man-arguments) + elapsed-time) + (format "%s man page cleaned up%s" + (Man-page-from-arguments Man-arguments) + elapsed-time)))) (unless (and (processp process) (not (eq (process-status process) 'exit))) (setq mode-line-process nil)) -- 2.47.1