mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Show duration of compilation when it stops (bug#65251)
Patch by Helmut Eller, lightly edited. * lisp/progmodes/compile.el (compilation--start-time): New variable. (compilation-start): Set it. (compilation-handle-exit): Display duration.
This commit is contained in:
parent
02d96e39b2
commit
cc533f2338
1 changed files with 12 additions and 1 deletions
|
|
@ -1862,6 +1862,9 @@ process from additional information inserted by Emacs."
|
||||||
(apply #'insert args)
|
(apply #'insert args)
|
||||||
(put-text-property start (point) 'compilation-annotation t)))
|
(put-text-property start (point) 'compilation-annotation t)))
|
||||||
|
|
||||||
|
(defvar-local compilation--start-time nil
|
||||||
|
"The time when the compilation started as returned by `float-time'.")
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun compilation-start (command &optional mode name-function highlight-regexp
|
(defun compilation-start (command &optional mode name-function highlight-regexp
|
||||||
continue)
|
continue)
|
||||||
|
|
@ -1993,6 +1996,7 @@ Returns the compilation buffer created."
|
||||||
mode-name
|
mode-name
|
||||||
(substring (current-time-string) 0 19))
|
(substring (current-time-string) 0 19))
|
||||||
command "\n")
|
command "\n")
|
||||||
|
(setq compilation--start-time (float-time))
|
||||||
(setq thisdir default-directory))
|
(setq thisdir default-directory))
|
||||||
(set-buffer-modified-p nil))
|
(set-buffer-modified-p nil))
|
||||||
;; Pop up the compilation buffer.
|
;; Pop up the compilation buffer.
|
||||||
|
|
@ -2480,7 +2484,14 @@ commands of Compilation major mode are available. See
|
||||||
(message "%s" (cdr status)))
|
(message "%s" (cdr status)))
|
||||||
(if (bolp)
|
(if (bolp)
|
||||||
(forward-char -1))
|
(forward-char -1))
|
||||||
(compilation-insert-annotation " at " (substring (current-time-string) 0 19))
|
(compilation-insert-annotation
|
||||||
|
" at "
|
||||||
|
(substring (current-time-string) 0 19)
|
||||||
|
", duration "
|
||||||
|
(let ((elapsed (- (float-time) compilation--start-time)))
|
||||||
|
(cond ((< elapsed 10) (format "%.2f s" elapsed))
|
||||||
|
((< elapsed 60) (format "%.1f s" elapsed))
|
||||||
|
(t (format-seconds "%h:%02m:%02s" elapsed)))))
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
;; Prevent that message from being recognized as a compilation error.
|
;; Prevent that message from being recognized as a compilation error.
|
||||||
(add-text-properties omax (point)
|
(add-text-properties omax (point)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue