[Top][All Lists]

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

Re: Inserting date, Disabling the Yes/No question

From: Ehud Karni
Subject: Re: Inserting date, Disabling the Yes/No question
Date: Mon, 2 Sep 2002 23:51:47 +0300

On Sat, 31 Aug 2002 22:51:46 +0200, Jesse Mathias Marder <address@hidden> wrote:
> Is there a built in function or a package to gnu emacs 21.2 that
> inserts the current date in the document, undepedent of the current
> major mode?

Here is a simple function I use to inserts the date and time:

(defvar current-date-time-format " %d/%m/%y %H:%M:%S "
  "Format of date to insert with `insert-current-date-time' func
See help of `format-time-string' for possible replacements")

(defun insert-current-date-time ()
  "insert the current date and time into current buffer.
Uses `current-date-time-format' for the formatting the date/time."
       (insert (format-time-string current-date-time-format (current-time))))

I use the Alt Shift C combination for this function:
    (global-set-key [?\A-C] 'insert-current-date-time) 
If your Alt key creates the Meta modifier, then use:
    (global-set-key [?\M-C] 'insert-current-date-time)
Of course, you can choose any key you like.


 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail  FAX:  1-815-5509341  / \
 mailto:address@hidden                  Better  Safe  Than  Sorry

reply via email to

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