help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to put this in a macro


From: Cecil Westerhof
Subject: Re: How to put this in a macro
Date: Tue, 04 May 2010 15:45:06 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

José A. Romero L. <escherdragon@gmail.com> writes:

>>            (if (> (symbol-value ,start-sym) (symbol-value ,end-sym))
>>                (let ((temp (symbol-value ,start-sym)))
>>                  (set ,start-sym (symbol-value ,end-sym))
>>                  (set ,end-sym   temp)))))
>>
>> I also make sure now that start is not after end.
> (...)
>
> Hmm, be careful with lets inside macros - this will work OK until one
> of the variables you try to set is named precisely "temp" (no lexical
> scope, remember?).

I deleted it again. It is at the moment not important, because all the
functions that use the macro do not care if the end is before the
beginning. So it is not really important at the moment. But I like to
make robust code, and when in the future the macro is used where it is a
problem when the start is after the end ... So is it possible to switch
the values when the end is before the start?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


reply via email to

[Prev in Thread] Current Thread [Next in Thread]