emacs-diffs
[Top][All Lists]
Advanced

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

master d470cff 2/2: Make emacs-uptime insert at point with prefix arg


From: Stefan Kangas
Subject: master d470cff 2/2: Make emacs-uptime insert at point with prefix arg
Date: Fri, 18 Sep 2020 11:42:44 -0400 (EDT)

branch: master
commit d470cff770db7309f330528b0cc7b21514caff91
Author: Adam Sjøgren <asjo@koldfront.dk>
Commit: Stefan Kangas <stefan@marxist.se>

    Make emacs-uptime insert at point with prefix arg
    
    * lisp/time.el (emacs-uptime): Insert at point when called with prefix
    argument.  (Bug#20112)
---
 lisp/time.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lisp/time.el b/lisp/time.el
index e2fab4a..cb3a847 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -588,19 +588,23 @@ To turn off the world time display, go to the window and 
type `\\[quit-window]'.
     (world-clock-cancel-timer)))
 
 ;;;###autoload
-(defun emacs-uptime (&optional format)
+(defun emacs-uptime (&optional format here)
   "Return a string giving the uptime of this instance of Emacs.
 FORMAT is a string to format the result, using `format-seconds'.
-For example, the Unix uptime command format is \"%D, %z%2h:%.2m\"."
-  (interactive)
+For example, the Unix uptime command format is \"%D, %z%2h:%.2m\".
+If the optional argument HERE is non-nil, insert string at
+point."
+  (interactive "i\nP")
   (let ((str
          (format-seconds (or format "%Y, %D, %H, %M, %z%S")
                         (time-convert
                          (time-since before-init-time)
                          'integer))))
-    (if (called-interactively-p 'interactive)
-        (message "%s" str)
-      str)))
+    (if here
+        (insert str)
+      (if (called-interactively-p 'interactive)
+          (message "%s" str)
+        str))))
 
 ;;;###autoload
 (defun emacs-init-time ()



reply via email to

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