From: Tamas Papp
Subject: macro indentation in slime
Date: 
Message-ID: <877ioeowyp.fsf@pu100877.student.princeton.edu>
I have a macro which defines constants as powers of two (for
interfacing with xlib):

(defmacro define-bitmask-constants (&rest name-power-pairs)
  "Define a list of constants from name-value pairs, raising 2 to
the power value."
  (labels ((dbc (pairs)
	     (case (length pairs)
	       (0 nil)
	       (1 (error "no power after ~a" (car name-power-pairs)))
	       (t (destructuring-bind (name power &rest rest) pairs
		    `((defconstant ,name (expt 2 ,power))
		       ,@(dbc rest)))))))
    `(progn
       ,@(dbc name-power-pairs))))

But when I apply it, the first argument is indented too much.  For
example,

(define-bitmask-constants 
    USPosition 0
  USSize 1
  PPosition 2
  PSize 3
  PMinSize 4
  PMaxSize 5
  PResizeInc 6
  PAspect 7
  PBaseSize 8
  PWinGravity 9)

Any suggestions?  This is cosmetic, but I would be interested to know
why this occurs.

Thanks,

Tamas

From: GP lisper
Subject: Re: macro indentation in slime
Date: 
Message-ID: <slrnfb3qos.rit.spambait@phoenix.clouddancer.com>
On Thu, 02 Aug 2007 16:03:10 +0200, <······@gmail.com> wrote:
> I have a macro which defines constants as powers of two (for
> interfacing with xlib):
>...
> 		    `((defconstant ,name (expt 2 ,power))
>
> (define-bitmask-constants 
>     USPosition 0
>   USSize 1
>   PPosition 2
>   PSize 3
>   PMinSize 4
>   PMaxSize 5
>   PResizeInc 6
>   PAspect 7
>   PBaseSize 8
>   PWinGravity 9)

Ah, where are the powers of 2 again?


-- 
Lisp:  Powering `Impossible Thoughts since 1958

-- 
Posted via a free Usenet account from http://www.teranews.com
From: GP lisper
Subject: Re: macro indentation in slime
Date: 
Message-ID: <slrnfb48it.tnd.spambait@phoenix.clouddancer.com>
On Thu, 2 Aug 2007 07:33:00 -0700, <········@CloudDancer.com> wrote:
> On Thu, 02 Aug 2007 16:03:10 +0200, <······@gmail.com> wrote:
>> I have a macro which defines constants as powers of two (for
>> interfacing with xlib):
>>...
>> 		    `((defconstant ,name (expt 2 ,power))
>>
>> (define-bitmask-constants 
>>     USPosition 0
>>   USSize 1
>>   PPosition 2
>>   PSize 3
>>   PMinSize 4
>>   PMaxSize 5
>>   PResizeInc 6
>>   PAspect 7
>>   PBaseSize 8
>>   PWinGravity 9)
>
> Ah, where are the powers of 2 again?

Ohh, that was the input... |-(


-- 
Lisp:  Powering `Impossible Thoughts since 1958

-- 
Posted via a free Usenet account from http://www.teranews.com
From: Sacha
Subject: Re: macro indentation in slime
Date: 
Message-ID: <yDlsi.30315$pB1.1016032@phobos.telenet-ops.be>
Tamas Papp wrote:
> I have a macro which defines constants as powers of two (for
> interfacing with xlib):
> 
> (defmacro define-bitmask-constants (&rest name-power-pairs)
>   "Define a list of constants from name-value pairs, raising 2 to
> the power value."
>   (labels ((dbc (pairs)
> 	     (case (length pairs)
> 	       (0 nil)
> 	       (1 (error "no power after ~a" (car name-power-pairs)))
> 	       (t (destructuring-bind (name power &rest rest) pairs
> 		    `((defconstant ,name (expt 2 ,power))
> 		       ,@(dbc rest)))))))
>     `(progn
>        ,@(dbc name-power-pairs))))
> 
> But when I apply it, the first argument is indented too much.  For
> example,
> 
> (define-bitmask-constants 
>     USPosition 0
>   USSize 1
>   PPosition 2
>   PSize 3
>   PMinSize 4
>   PMaxSize 5
>   PResizeInc 6
>   PAspect 7
>   PBaseSize 8
>   PWinGravity 9)
> 
> Any suggestions?  This is cosmetic, but I would be interested to know
> why this occurs.
> 
> Thanks,
> 
> Tamas

I think replacing &rest with &body would make it.

Sacha
From: Tamas Papp
Subject: Re: macro indentation in slime
Date: 
Message-ID: <873az2oukd.fsf@pu100877.student.princeton.edu>
Sacha <····@address.spam> writes:

>> But when I apply it, the first argument is indented too much.  For
>> example,
>>
>> (define-bitmask-constants     USPosition 0
>>   USSize 1
>>   PPosition 2
>>   PSize 3
>>   PMinSize 4
>>   PMaxSize 5
>>   PResizeInc 6
>>   PAspect 7
>>   PBaseSize 8
>>   PWinGravity 9)
>>
>> Any suggestions?  This is cosmetic, but I would be interested to know
>> why this occurs.
>>
>> Thanks,
>>
>> Tamas
>
> I think replacing &rest with &body would make it.
>
> Sacha

Thanks Sacha,

Tamas