Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Re: inserting date and time at the cursor location
       [not found] ` <m33croeu49.fsf@defun.localdomain>
@ 2002-10-02 15:37   ` David Kastrup
       [not found]   ` <x5fzvoam2w.fsf@tupik.goethe.zz>
  1 sibling, 0 replies; 5+ messages in thread
From: David Kastrup @ 2002-10-02 15:37 UTC (permalink / raw)


Jesper Harder <harder@myrealbox.com> writes:

> "Guy-Armand Kamendje" <kguy@gmx.at> writes:
> 
> > Is there a way to let xemacs insert the current date and time at the
> > actual cursor location?
> 
> (defun jh-insert-current-time ()
>   (interactive)
>   (insert (current-time-string)))
> 
> Then do `M-x jh-insert-current-time' or bind it to some key sequence.

You could also use
C-u M-! date RET

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: David.Kastrup@t-online.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: inserting date and time at the cursor location
       [not found] <3d9aee7f$0$15412$3b214f66@aconews.univie.ac.at>
  2002-10-02 15:10 ` inserting date and time at the cursor location Josh Huber
       [not found] ` <m33croeu49.fsf@defun.localdomain>
@ 2002-10-04  4:46 ` ken
  2 siblings, 0 replies; 5+ messages in thread
From: ken @ 2002-10-04  4:46 UTC (permalink / raw)
  Cc: help-gnu-emacs


Here's some elisp which does them separately... what I use:

(defun now ()
  "Insert string for the current time formatted like '2:34 PM'."
  (interactive)                 ; permit invocation in minibuffer
  (insert (format-time-string "%-I:%M %p"))
)


(defun today ()
  "Insert string for today's date nicely formatted in American style,
e.g. Sunday, September 17, 2000."
  (interactive)                 ; permit invocation in minibuffer
  (insert (format-time-string "%A, %B %e, %Y"))
)

Put these in a file in your emacs path.  Do "M-x today" or "M-x now" to 
invoke.  Also, it should be obvious how to integrate the two.


hth,
ken

-- 
AMD crashes?  See http://cleveland.lug.net/~ken/amd-problem/.

Spake Guy-Armand Kamendje at 15:03 (UTC+0200) on Wed, 2 Oct 2002:

= Hi,
= Is there a way to let xemacs insert the current date and time at the actual
= cursor location?
= Thanks for any hint
= Guy
= 
= 
= _______________________________________________
= Help-gnu-emacs mailing list
= Help-gnu-emacs@gnu.org
= http://mail.gnu.org/mailman/listinfo/help-gnu-emacs
= 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: inserting date and time at the cursor location
       [not found]     ` <65wkkzdz.fsf@ID-23066.news.dfncis.de>
@ 2002-10-11 12:14       ` Mario Lang
  0 siblings, 0 replies; 5+ messages in thread
From: Mario Lang @ 2002-10-11 12:14 UTC (permalink / raw)


Clemens Fischer <ino@despammed.com> writes:

> David Kastrup <David.Kastrup@t-online.de> writes:
>
>> You could also use
>> C-u M-! date RET
>
> ok, how do i bind this to a key?

Using keyboard macros for instance:

C-x ( C-u M-! date RET C-x )

Now you can use C-x e to call the last kbd macro or

M-x edit-kbd-macro RET C-x e 

to see the whole macro, being able to edit it and give it a name
and keybinding.  Use C-c C-c to save.

-- 
CYa,
  Mario


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: inserting date and time at the cursor location
       [not found] <3d9aee7f$0$15412$3b214f66@aconews.univie.ac.at>
@ 2002-10-02 15:10 ` Josh Huber
       [not found] ` <m33croeu49.fsf@defun.localdomain>
  2002-10-04  4:46 ` ken
  2 siblings, 0 replies; 5+ messages in thread
From: Josh Huber @ 2002-10-02 15:10 UTC (permalink / raw)


"Guy-Armand Kamendje" <kguy@gmx.at> writes:

> Is there a way to let xemacs insert the current date and time at the
> actual cursor location?

Probably, but here is some elisp to do it:

(insert (format-time-string "%c"))

You can bind this to a key like:

(defun jmh::insert-time-and-date ()
  (interactive)
  (insert (format-time-string "%c")))

(global-set-key (kbd "A-d") 'jmh::insert-time-and-date)

Which would use Alt-d as the keybinding.

-- 
Josh Huber


^ permalink raw reply	[flat|nested] 5+ messages in thread

* inserting date and time at the cursor location
@ 2002-10-02 13:03 Guy-Armand Kamendje
  0 siblings, 0 replies; 5+ messages in thread
From: Guy-Armand Kamendje @ 2002-10-02 13:03 UTC (permalink / raw)


Hi,
Is there a way to let xemacs insert the current date and time at the actual
cursor location?
Thanks for any hint
Guy


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-10-11 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3d9aee7f$0$15412$3b214f66@aconews.univie.ac.at>
2002-10-02 15:10 ` inserting date and time at the cursor location Josh Huber
     [not found] ` <m33croeu49.fsf@defun.localdomain>
2002-10-02 15:37   ` David Kastrup
     [not found]   ` <x5fzvoam2w.fsf@tupik.goethe.zz>
     [not found]     ` <65wkkzdz.fsf@ID-23066.news.dfncis.de>
2002-10-11 12:14       ` Mario Lang
2002-10-04  4:46 ` ken
2002-10-02 13:03 Guy-Armand Kamendje

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).