[Top][All Lists]

[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:44:59 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

José A. Romero L. <address@hidden> writes:

> Maybe you could do something like this:
>     (defmacro cw/set-bounds (start-sym end-sym)
>       `(if (equal (symbol-value ,start-sym) (symbol-value ,end-sym))
>            (progn
>              (set ,start-sym (point-min))
>              (set ,end-sym (point-max)))
>          (progn
>            (set ,start-sym (or start (point-min)))
>            (set ,end-sym (or end (point-max))))))

Almost. It looks like the following does what I want:
    (defmacro cw/set-bounds (start-sym end-sym)
      `(if (equal (symbol-value ,start-sym) (symbol-value ,end-sym))
             (set ,start-sym (point-min))
             (set ,end-sym (point-max)))
           (set ,start-sym (or ,start-sym (point-min)))
           (set ,end-sym (or ,end-sym (point-max))))))

In the or's the parameter is used instead of the hard variables start
and end.


Cecil Westerhof
Senior Software Engineer

reply via email to

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