[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can you create interactive funtions in a a macro
From: |
Katsumi Yamaoka |
Subject: |
Re: Can you create interactive funtions in a a macro |
Date: |
Thu, 19 Mar 2009 10:18:15 +0900 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.91 (gnu/linux) |
>>>>> Kelly wrote:
> 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)))
A function symbol has to be interned in `obarray'. You seem to
have meant the Emacs Lisp function `concat' with `concatenate'.
`insert-string' is obsolete since Emacs 22.1. This will work:
(defmacro deftext (functionname texttoinsert)
`(defun ,(intern (concat "text-" functionname)) ()
(interactive)
(insert ,texttoinsert)))