help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: inserting date and time at the cursor location


From: Reiner Steib
Subject: Re: inserting date and time at the cursor location
Date: Thu, 03 Oct 2002 12:44:55 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.1 (i586-pc-linux-gnu)

On Thu, Oct 03 2002, Clemens Fischer wrote:

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

(1) Find out the function called by `M-!' using `C-h k' ...

,----[ C-h k M-! ]
| M-! runs the command shell-command
|    which is an interactive compiled Lisp function in `simple'.
| (shell-command COMMAND &optional OUTPUT-BUFFER ERROR-BUFFER)
| 
| Execute string COMMAND in inferior shell; display output, if any.
| With prefix argument, insert the COMMAND's output at point.
`----

(2) Read the doc-string, especially about the prefix argument in this
    case (C-u).

(3) Bind it to a key (e.g. `C-c i d'), with the arguments you like.
    Remember that you need an interactive function for key bindings:

(global-set-key [(control c) (i) (d)]
                '(lambda ()
                   (interactive)
                   (shell-command "date" t t)))

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/


reply via email to

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