* Need help with creating shortcuts
@ 2012-06-24 7:57 C K Kashyap
2012-06-24 22:14 ` Mark Skilbeck
0 siblings, 1 reply; 4+ messages in thread
From: C K Kashyap @ 2012-06-24 7:57 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 475 bytes --]
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?
Regards,
Kashyap
[-- Attachment #2: Type: text/html, Size: 632 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Need help with creating shortcuts
2012-06-24 7:57 Need help with creating shortcuts C K Kashyap
@ 2012-06-24 22:14 ` Mark Skilbeck
2012-06-25 8:31 ` C K Kashyap
0 siblings, 1 reply; 4+ messages in thread
From: Mark Skilbeck @ 2012-06-24 22:14 UTC (permalink / raw)
To: C K Kashyap; +Cc: help-gnu-emacs
Adding to the previous answer, you might then be interested in the
YASnippet extension[1].
[1] https://github.com/capitaomorte/yasnippet#readme
On Sun, Jun 24, 2012 at 01:27:28PM +0530, C K Kashyap wrote:
> 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?
>
> Regards,
> Kashyap
--
- mgs.
if all you young men / were fish in the water
how many young girls / would undress and dive after
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Need help with creating shortcuts
2012-06-24 22:14 ` Mark Skilbeck
@ 2012-06-25 8:31 ` C K Kashyap
0 siblings, 0 replies; 4+ messages in thread
From: C K Kashyap @ 2012-06-25 8:31 UTC (permalink / raw)
To: Mark Skilbeck; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1009 bytes --]
Thank you Mark,
I think, this will do.
Regards,
Kashyap
On Mon, Jun 25, 2012 at 3:44 AM, Mark Skilbeck <m@iammark.us> wrote:
> Adding to the previous answer, you might then be interested in the
> YASnippet extension[1].
>
> [1] https://github.com/capitaomorte/yasnippet#readme
>
> On Sun, Jun 24, 2012 at 01:27:28PM +0530, C K Kashyap wrote:
> > 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?
> >
> > Regards,
> > Kashyap
>
> --
> - mgs.
>
> if all you young men / were fish in the water
> how many young girls / would undress and dive after
>
[-- Attachment #2: Type: text/html, Size: 1644 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.3356.1340524655.855.help-gnu-emacs@gnu.org>]
* Re: Need help with creating shortcuts
[not found] <mailman.3356.1340524655.855.help-gnu-emacs@gnu.org>
@ 2012-06-24 13:51 ` Pascal J. Bourguignon
0 siblings, 0 replies; 4+ messages in thread
From: Pascal J. Bourguignon @ 2012-06-24 13:51 UTC (permalink / raw)
To: help-gnu-emacs
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 {}.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-25 8:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-24 7:57 Need help with creating shortcuts C K Kashyap
2012-06-24 22:14 ` Mark Skilbeck
2012-06-25 8:31 ` C K Kashyap
[not found] <mailman.3356.1340524655.855.help-gnu-emacs@gnu.org>
2012-06-24 13:51 ` Pascal J. Bourguignon
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 read-only IMAP folder(s) and NNTP newsgroup(s).