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

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

Re: Need help with creating shortcuts


From: Pascal J. Bourguignon
Subject: Re: Need help with creating shortcuts
Date: Sun, 24 Jun 2012 15:51:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

C K Kashyap <ckkashyap@gmail.com> writes:

> Hi All,
> I've been defining functions to create shortcuts 
>
> (defun (hw) (progn 
>        (delete-fun) ; This is another function that deletes the actual 
> function name from the buffer
>        (insert "Hello World"))
>
> I invoke it as follows - (hw)C-X-e, this removes (hw) and replaces it with 
> Hello World.
>
> the problem is that I have to type parenthesis. I explored
> abbreviations but they cannot seem to be parameterized. Can someone
> please suggest an alternative?

Write it like this:

    (defun hw ()
       (interactive) ; makes it a command.
       (insert "Hello World"))

Call it like this:

     M-x hw RET


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


reply via email to

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