macroexpansion (slime-expand-1) results in error

Mirko Vukovic mirko.vukovic at gmail.com
Thu Dec 10 16:16:36 UTC 2015


As requested (and should have been provided in the original email)

On Thu, Dec 10, 2015 at 11:04 AM, Luís Oliveira <luismbo at gmail.com> wrote:

> On Thu, Dec 10, 2015 at 3:56 PM, Mirko Vukovic <mirko.vukovic at gmail.com>
> wrote:
> > C-c Ret returns an error on some macros (but not on others):
>

An example using the Vecto package:

(defmacro with-png-output ((stream/filename/pathname
  &key width height) &body body)
  "Define canvas and emit picture generated by BODY"
  `(with-canvas (:width ,width :height ,height)
     , at body
     (save-png ,stream/filename/pathname)))

And example code:
(with-png-output ("pie-wedge--literal.png" :width 80 :height 80)
      (let ((x 0) (y 0)
   (radius 70)
   (angle1 (* (/ pi 180) 15))
   (angle2 (* (/ pi 180) 45)))
(translate 5 5)
(set-rgb-fill 1 1 1)
(move-to 0 0)
(arc x y radius angle1 angle2)
(fill-and-stroke))) ;;; **********************************

I played by selectively adding code -- I started with the (with-png-output
...) just by itself, and that worked.
Then I started adding form by form.  It failed when I added the last form
(fill-and-stroke).

Note: To add or remove code, I would add parenthesis to close the macro.
Commenting out (via ;; or #+skip) would invariably
result in an error.

Doing it at the REPL via MACROEXPAND works fine:
(LET ((VECTO::*GRAPHICS-STATE* (MAKE-INSTANCE 'VECTO::GRAPHICS-STATE)))
(VECTO::STATE-IMAGE VECTO::*GRAPHICS-STATE* 80 80) (UNWIND-PROTECT (PROGN
(LET ((X 0) (Y 0) (RADIUS 70) (ANGLE1 (* (/ PI 180) 15)) (ANGLE2 (* (/ PI
180) 45))) (TRANSLATE 5 5) (SET-RGB-FILL 1 1 1) (MOVE-TO 0 0) (ARC X Y
RADIUS ANGLE1 ANGLE2) (FILL-AND-STROKE)) (SAVE-PNG
"pie-wedge--literal.png")) (VECTO::CLEAR-STATE VECTO::*GRAPHICS-STATE*)))


Mirko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20151210/9c64c5d2/attachment.html>


More information about the slime-devel mailing list