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

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

Re: macro with argument


From: Joakim Hove
Subject: Re: macro with argument
Date: Mon, 20 Oct 2003 14:33:57 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux)

David Kastrup <dak@gnu.org> writes:


>> how can I write "macros with arguments"?
>> 
>> Example: 
>> 
>> [Me:]    M-x my_macro
>> [Emacs:] your argument:
>> [Me:]    foo
>> 
>> Then emacs should print e.g.
>> 
>> bla foo blo
>
> (defun my_macro (string) (interactive "syour argument: ") (message
> "bla %s blo" string))

I.e. - write a small e-lisp function to achieve what you want, and not
a conventional macro. Check the documentation of the special form
(interactive )
 
               C-h f interactive

too see how the argument is read from you.

HTH - Joakim

-- 
  /--------------------------------------------------------------------\
 / Joakim Hove  / hove@bccs.no  /  (55 5) 84076       |                 \
 | Unifob AS, Avdeling for Beregningsvitenskap (BCCS) | Stabburveien 18 |
 | CMU                                                | 5231 Paradis    |
 \ Thormøhlensgt.55, 5020 Bergen.                     | 55 91 28 18     /
  \--------------------------------------------------------------------/


reply via email to

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