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: José A . Romero L .
Subject: Re: How to put this in a macro
Date: Tue, 04 May 2010 15:45:08 -0000
User-agent: G2/1.0

On 17 Kwi, 21:38, Cecil Westerhof <Ce...@decebal.nl> wrote:
(...)
> 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?
(...)

If you're in for a bit of coding stunts :-) I guess we could have one
last try, using your name, Barry's macro and shorter variable names:

    (defmacro dcbl-set-bounds (start end)
      `(progn
         (if (equal ,start ,end)
             (setq ,start (point-min)
                   ,end (point-max))
           (setq ,start (or ,start (point-min))
                 ,end (or ,end (point-max))))

         (setq ,start (list ,start ,end)
               ,start (sort ,start '<)
               ,end   (second ,start)
               ,start (first ,start))))

it should be OK to use one of the variables being changed as the temp
var, shouldn't it?

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)


reply via email to

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