emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 88fdc49: Add optional FORMAT argument to 'emacs-init-time'


From: Lars Ingebrigtsen
Subject: master 88fdc49: Add optional FORMAT argument to 'emacs-init-time'
Date: Wed, 24 Mar 2021 05:35:34 -0400 (EDT)

branch: master
commit 88fdc4945ab3d37592abdd6e18c4c01c6dde3fef
Author: Gabriel do Nascimento Ribeiro <gabriel.nascimento@nubank.com.br>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add optional FORMAT argument to 'emacs-init-time'
    
    * lisp/time.el (emacs-init-time): Add optional FORMAT argument
    (bug#47306).
---
 lisp/time.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/time.el b/lisp/time.el
index 1403c4a..7e1d918 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -614,13 +614,14 @@ point."
         str))))
 
 ;;;###autoload
-(defun emacs-init-time ()
-  "Return a string giving the duration of the Emacs initialization."
+(defun emacs-init-time (&optional format)
+  "Return a string giving the duration of the Emacs initialization.
+FORMAT is a string to format the result, using `format'. If nil,
+the default format \"%f seconds\" is used."
   (interactive)
-  (let ((str
-        (format "%s seconds"
-                (float-time
-                 (time-subtract after-init-time before-init-time)))))
+  (let ((str (format (or format "%f seconds")
+                     (float-time (time-subtract after-init-time
+                                                before-init-time)))))
     (if (called-interactively-p 'interactive)
         (message "%s" str)
       str)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]