all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: asjo@koldfront.dk (Adam Sjøgren)
To: 20112@debbugs.gnu.org
Subject: bug#20112: 24.4; (emacs-uptime): insert at point when called with prefix
Date: Sun, 15 Mar 2015 19:48:08 +0100	[thread overview]
Message-ID: <87h9tmhzbr.fsf@topper.koldfront.dk> (raw)

Here is a patch making emacs-uptime insert at point when called with
prefix, similar to what emacs-version does:

2015-02-10  Adam Sjøgren  <asjo@koldfront.dk>

	* time.el (emacs-uptime): insert at point when called with
        prefix.


--- time.el.orig	2015-02-10 15:42:48.472482974 +0100
+++ time.el	2015-02-10 15:45:27.743592919 +0100
@@ -571,18 +571,22 @@
             (cancel-timer elt)))))))
 
 ;;;###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")
                          (float-time
                           (time-subtract (current-time) before-init-time)))))
-    (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 ()

In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2015-03-07 on trouble, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.0 (jessie)

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

-- 
 "Och jag vet att allt är falskt och bedrageri                Adam Sjøgren
  Men det struntar jag i                                 asjo@koldfront.dk
  För vi dansar och du har så mjuka läppar"





             reply	other threads:[~2015-03-15 18:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-15 18:48 Adam Sjøgren [this message]
2015-03-15 19:12 ` bug#20112: 24.4; (emacs-uptime): insert at point when called with prefix Glenn Morris
2015-03-15 19:41   ` Adam Sjøgren
2020-01-15  5:28   ` Stefan Kangas
     [not found]     ` <87blr5fco5.fsf@tullinup.koldfront.dk>
2020-01-15 21:09       ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9tmhzbr.fsf@topper.koldfront.dk \
    --to=asjo@koldfront.dk \
    --cc=20112@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.