Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!ruuinf!piet From: piet@cs.ruu.nl (Piet van Oostrum) Newsgroups: comp.emacs Subject: Re: Problem with macros Message-ID: <4301@ruuinf.cs.ruu.nl> Date: 14 Nov 90 09:10:46 GMT References: <1183@red15.qtp.ufl.edu> Sender: news@ruuinf.cs.ruu.nl Reply-To: piet@cs.ruu.nl (Piet van Oostrum) Organization: Dept of Computer Science, Utrecht University, The Netherlands Lines: 34 In-reply-to: beck@qtp.ufl.edu (Sullivan Beck) >>>>> In message <1183@red15.qtp.ufl.edu>, beck@qtp.ufl.edu (Sullivan Beck) >>>>> (SB) writes: SB> (defmacro test (char) SB> (` (save-excursion SB> (set-buffer (get-buffer tmp-buffer)) SB> (save-excursion SB> (goto-char 1) SB> (forward-line 2) SB> (forward-char 3) SB> (delete-char 1) SB> (insert char))))) SB> But this doesn't work. If I have the following lines in a program: SB> (setq char "*") SB> (test "!") SB> the first two will insert the "!" but the third will insert a "*". Could SB> someone explain what I am doing wrong (other than I don't really understand SB> how to use the quote). Thanks in advance. The problem is that you want the "char" in your macro body to be replaced by the parameter, and not to mean the variable with the name "char". So you must UNQUOTE char in your macro body as follows: (insert ,char))))) Well, I haven't run the code, but this should work. -- Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31 30 531806 Uucp: uunet!mcsun!ruuinf!piet Telefax: +31 30 513791 Internet: piet@cs.ruu.nl (*`Pete')