another simple defmacro question

From: bufie (bufie_at_spamneggs.com)
Date: 08/28/04


Date: Sat, 28 Aug 2004 02:54:10 GMT

Hi again,

I know I'm missing something simple here, but I've tried a bunch of stuff
and it just doesn't work...

My application needs to read a list of constants at compile time from a
file. I came up with this macro:

(defmacro my-file-to-string-list (fname)
  (let ((stringlist)
           (tmpstr))
    (with-open-file (infile fname :direction :input)
      (loop
        (setq tmpstr (read-line infile nil nil))
        (unless tmpstr
          (return))
        (push tmpstr stringlist)
         ))
    (setq stringlist (nreverse stringlist))
    stringlist
    ))

When I call this using
(setq mystrings (my-file-to-string-list myfilename))

I get an error that the first line of the file is invalid as a function
(it's apparently considering the opening paren of the list as a function
call). I know there must be something simple here (if I change the defmacro
to defun it will work, but doesn't get evaluated at load time or compile
time), and I think I've solved this (or seen it solved) before, but I'm just
not seeing it this time...

help, please!

thanks!

bufie



Relevant Pages

  • Re: Sonic the Hedgehog question
    ... because I know in the hints they do mention a bunch ... THERE MUST BE SOME thing I'm missing, ... Infinite lives really isn't going to help me. ...
    (rec.games.video.classic)
  • Re: Holloway Arrest Breaking News
    ... Bunch of backwoods hypocrits. ... the thousand or more people still missing and probably dead in their ... How many thousands more, men and women alike, are missing now ... The first link that comes up is "F Natalee Holloway." ...
    (alt.true-crime)
  • Re: Death to tuples!
    ... Antoon Pardon wrote: ... print 'x is really odd' ... > I'm probably missing something, but what would be the problem if this ... > list was created during compile time? ...
    (comp.lang.python)
  • Re: Auto insert $?
    ... > the color syntax highlighting alerts me to mistakes before compile time, ... > so I'm a lot less likely to get a bunch of error boxes and have to hunt ...
    (comp.text.tex)
  • Re: Latest Wudi8 Winter Fun Ride Update
    ... wrote:>I say a bunch of us missing this years start planning now on making>next years. ... CrashTestDummy - '85 RM 250 ...
    (rec.motorcycles.dirt)