[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:00 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Cecil Westerhof <Cecil@decebal.nl> writes:
> 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))
> (progn
> (set ,start-sym (point-min))
> (set ,end-sym (point-max)))
> (progn
> (set ,start-sym (or ,start-sym (point-min)))
> (set ,end-sym (or ,end-sym (point-max))))))
>
Almost. It should be:
(defmacro dcbl-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 (symbol-value ,start-sym) (point-min)))
(set ,end-sym (or (symbol-value ,end-sym) (point-max))))
(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.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
- How to put this in a macro, Cecil Westerhof, 2010/05/04
- Re: How to put this in a macro, José A . Romero L ., 2010/05/04
- Re: How to put this in a macro, Barry Margolin, 2010/05/04
- Re: How to put this in a macro, Cecil Westerhof, 2010/05/04
- Re: How to put this in a macro, José A . Romero L ., 2010/05/04
- Re: How to put this in a macro, Cecil Westerhof, 2010/05/04
- Re: How to put this in a macro, José A . Romero L ., 2010/05/04
- Re: How to put this in a macro,
Cecil Westerhof <=
- Re: How to put this in a macro, José A . Romero L ., 2010/05/04
- Re: How to put this in a macro, Barry Margolin, 2010/05/04
- Re: How to put this in a macro, José A . Romero L ., 2010/05/04
- Re: How to put this in a macro, Barry Margolin, 2010/05/04
- Re: How to put this in a macro, Cecil Westerhof, 2010/05/04
- Re: How to put this in a macro, José A . Romero L ., 2010/05/04
- Re: How to put this in a macro, Barry Margolin, 2010/05/04
- Re: How to put this in a macro, José A . Romero L ., 2010/05/04
- Re: How to put this in a macro, Barry Margolin, 2010/05/04
Re: How to put this in a macro, Pascal J. Bourguignon, 2010/05/04