[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Insert date and Time
From: |
Tim Visher |
Subject: |
Re: Insert date and Time |
Date: |
Thu, 25 Feb 2010 09:41:48 -0500 |
On Thu, Feb 25, 2010 at 3:29 AM, Tugello <kompy01@yahoo.it> wrote:
> good morning to all,I'm newbie with emacs
> my question is about how to insert current date and time, using a short key
> combination instead to write they completely .
> someone ave any suggestion ?
> thanks in advance
I use this function to insert a time stamp at point:
(defun insert-time-stamp ()
"Inserts a time stamp 'YYYY-MM-DD HH:MM AM/PM'"
(interactive)
(insert (format-time-string "%Y-%m-%d - %I:%M %p")))
I just call that via `M-x insert-time-stamp` unless a higher level
function calls it. You could call it with a short cut though with
something like
(global-set-key (kbd "<f12>") 'insert-time-stamp)
if you wanted.
You'll need to evaluate those in your scratch buffer to get them in
the current emacs session. Paste them in and then `M-x eval-buffer`.
If you want them in all emacs sessions, put them in your .emacs file.
`C-h r m Init File RET`. Also, [Yegge's .emacs
file](http://steve.yegge.googlepages.com/my-dot-emacs-file) is worth a
read.
Hope that helps.
--
In Christ,
Timmy V.
http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail