all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ack94598@yahoo.com (')
Subject: Re: how to insert a timestamp?
Date: 7 Jan 2004 23:43:24 -0800	[thread overview]
Message-ID: <45b780c3.0401072343.6845a6bd@posting.google.com> (raw)
In-Reply-To: wc365ford5w.fsf@mu.cis.ohio-state.edu

Thanks for your help!  I had never actually written an Emacs Lisp
function before, but with this handy link:

http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/index.html

I was able to quickly produce the following:

(defun timestamp ()
  "Insert timestamp at point."
  (interactive)
  (insert (format-time-string "%a, %d %b %Y %H:%M:%S %z")))

(global-set-key [f5] 'timestamp)

I love it!  Emacs rocks!

Adam

Benjamin Rutt <brutt+news@bloomington.in.us> wrote in message news:<wc365ford5w.fsf@mu.cis.ohio-state.edu>...
> ack94598@yahoo.com (') writes:
> 
> > How can I insert a string representing the current time/date at the
> > point?  It is for timestamping entries in a diary/log.
> 
> I use:
> 
> (insert (format-time-string "%a %b %e, %Y %l:%M %p"))
> 
> which gives (ATM):  Tue Jan  6, 2004  4:15 PM
> 
> There are a zillion other ways to do it.  See C-h f
> format-time-string.

  reply	other threads:[~2004-01-08  7:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-06 21:12 how to insert a timestamp? '
2004-01-06 21:16 ` Benjamin Rutt
2004-01-08  7:43   ` ' [this message]
2004-01-07  6:14 ` WANG Wei
2004-01-07 12:59 ` Bruce Ingalls

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=45b780c3.0401072343.6845a6bd@posting.google.com \
    --to=ack94598@yahoo.com \
    /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.