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

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

Can you create interactive funtions in a a macro


From: Kelly
Subject: Can you create interactive funtions in a a macro
Date: Wed, 18 Mar 2009 15:35:31 -0700 (PDT)
User-agent: G2/1.0

Hi, I am missing something here.

I am trying to write a macro to create interactive functions to
automate some stuff.

What I present below is a simlified case:

(defmacro deftext (functionname texttoinsert)
  `(defun ,(make-symbol (concatenate 'string "text-" functionname)) ()
     (interactive)
     (insert-string ,texttoinsert)))

(deftext "swallow" "What is the flight speed velocity of a laden
swallow?")
(deftext "ni" "We are the knights who say NI!")

the code is supposed to create two interactive functions (text-
swallow) and (text-ni)
that insert the string.

If I macroexpand the forms above and evaluate that, I get what I was
after.

Is there something I'm missing, or can you just not do this.

(it's fine to tell me that I would be better served doing it some
other way, but  I'm just trying to understand why this doesn't work)

TIA,
Kelly


reply via email to

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