From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.bugs Subject: bug#65251: 30.0.50; Duration in compilation buffer Date: Thu, 17 Aug 2023 20:48:22 +0200 Message-ID: References: <83h6oy6xnk.fsf@gnu.org> <83a5uq6w68.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14312"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: mattias.engdegard@gmail.com, 65251@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 17 20:49:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWi3m-0003SL-IS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Aug 2023 20:49:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWi3R-0004Fi-Or; Thu, 17 Aug 2023 14:49:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWi3K-0004Eo-R7 for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2023 14:49:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWi3K-0000Lu-9S for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2023 14:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWi3K-000433-6R for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2023 14:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Helmut Eller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Aug 2023 18:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65251 X-GNU-PR-Package: emacs Original-Received: via spool by 65251-submit@debbugs.gnu.org id=B65251.169229811215476 (code B ref 65251); Thu, 17 Aug 2023 18:49:02 +0000 Original-Received: (at 65251) by debbugs.gnu.org; 17 Aug 2023 18:48:32 +0000 Original-Received: from localhost ([127.0.0.1]:45625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWi2q-00041U-8i for submit@debbugs.gnu.org; Thu, 17 Aug 2023 14:48:32 -0400 Original-Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:50431) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWi2o-00040i-62 for 65251@debbugs.gnu.org; Thu, 17 Aug 2023 14:48:31 -0400 Original-Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3fe5c0e57d2so1642575e9.0 for <65251@debbugs.gnu.org>; Thu, 17 Aug 2023 11:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692298104; x=1692902904; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=hEXC0lzBWa8MGAqZCmKMmDAxHe8EKcg2Qyjwygk+dNc=; b=JAhpunvo4zOPOdZPu9S2UF87c4ol806AzgTY0Gt4JSiopzZ2RukvdYrrI3AbCvDSWh Vj2n/q/iAnb4nTdA8TNb6AdB1PM5icAb2/QW34iy+crJ8ujcvGQZUYq64xuQT7cIB6gM Q8CqKavCyYuQF9l7k+xjcNPec8/fb5gFycnv8nv8oVeb9G/XNIVyUvjiMzSiwTsQ+FcQ EXSmsK96PAjgYgAYkUgNea/mXNU7ASDQbRJ7J/LoI+qLeTv2Yv6/q0sZKyWNHm/y0rEi X1R/nPM9fmhhuscJKmqhrNv8/50JhWBcx9dksS1k+pqU5Fw2vA1SoGZCcOXQceHANEcx 6dAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692298104; x=1692902904; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hEXC0lzBWa8MGAqZCmKMmDAxHe8EKcg2Qyjwygk+dNc=; b=PEdx7/QwYJjT2/lg3sWfthTk6AmRMuBsjbdxwaDkkXVUwZDtyEsBukREuhYURC7Qaf Lhs/2/yFYG4l/81w8ImAYvVdXc636jLJK+BnYRFIiNzuBnwuGc/uBT+cMtA6jqxNBPau orWwdFA6YcAuiCGSSy3ycBbHeqv9ngzqDsBX9SLSzektQRD3i8Au3SYXBPZ3rhn9vf8n 5D9HaKl19b2iyfyWRVRYrcBStI0jw28NsjTPsMM0ee6xZDidcucZGUUtEqwsG6+7QFv5 dWdn7noDHFFGBsb9GQj7jqvTSS7va0RnVGhTyX/O/SUtXL1TEN09yzkCumq4gZA1dCJk rMbw== X-Gm-Message-State: AOJu0Yxrqra/m4haP+02I1AVGTeB8maGOZlbfPZCAq+MnzhVgToN6ziC RXu6YXNggqBGXlrW1pdzV3b3AEzP3Lo= X-Google-Smtp-Source: AGHT+IGXWTMBFnO1RKs2Q9cobrYdrtW2JVSg6jMFon3JAA+DxmV/pRl1Hq2wTO0Lz2pZ/b5GDso/5g== X-Received: by 2002:a1c:7211:0:b0:3fc:e7d:ca57 with SMTP id n17-20020a1c7211000000b003fc0e7dca57mr475508wmc.2.1692298104030; Thu, 17 Aug 2023 11:48:24 -0700 (PDT) Original-Received: from caladan (dial-181023.pool.broadband44.net. [212.46.181.23]) by smtp.gmail.com with ESMTPSA id f11-20020a7bcd0b000000b003fbbe41fd78sm383873wmj.10.2023.08.17.11.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 11:48:23 -0700 (PDT) In-Reply-To: <83a5uq6w68.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 17 Aug 2023 09:05:19 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267692 Archived-At: --=-=-= Content-Type: text/plain On Thu, Aug 17 2023, Eli Zaretskii wrote: > I intended to install this once there are no more review comments, as > I think this could be a useful addition. I believe Mattias also > thought the idea was a good one. So my preference is for you to post > an updated patch, yes. Here it is: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-When-a-compilation-finishes-show-how-long-it-took.patch >From 3f41a75a61a08c1e2850bf3e3e4d1d2d137aeedd Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Thu, 17 Aug 2023 20:46:05 +0200 Subject: [PATCH] When a compilation finishes, show how long it took Insert the duration, not just the timestamp. * lisp/progmodes/compile.el (compilation--start-time): New variable. (compilation-start): Set it. (compilation-handle-exit): Use it to compute the duration and insert it in human readable form. --- lisp/progmodes/compile.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 6d151db8a83..a41fca7de1e 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1862,6 +1862,9 @@ compilation-insert-annotation (apply #'insert args) (put-text-property start (point) 'compilation-annotation t))) +;; The time when the compilation started as returned by `float-time'. +(defvar-local compilation--start-time nil) + ;;;###autoload (defun compilation-start (command &optional mode name-function highlight-regexp continue) @@ -1993,6 +1996,7 @@ compilation-start mode-name (substring (current-time-string) 0 19)) command "\n") + (setq compilation--start-time (float-time)) (setq thisdir default-directory)) (set-buffer-modified-p nil)) ;; Pop up the compilation buffer. @@ -2480,7 +2484,14 @@ compilation-handle-exit (message "%s" (cdr status))) (if (bolp) (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* ((secs (- (float-time) compilation--start-time))) + (cond ((< secs 10) (format "%.2f s" secs)) + ((< secs 60) (format "%.1f s" secs)) + (t (format-seconds "%h:%m:%s" secs))))) (goto-char (point-max)) ;; Prevent that message from being recognized as a compilation error. (add-text-properties omax (point) -- 2.39.2 --=-=-=--