Changed it to just a function - you are correct, for this purpose I don't need a macro.On Fri, Nov 21, 2014 at 6:30 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:Nathaniel Flath <flat0103@gmail.com> writes:
> OK, I think I fixed that.
Thanks.
I didn't verify it compiles, but your macro still looks suspicious.
> +(defmacro org-table-execute-once-per-second (t1 &rest body)
> + "If there has been more than one second since T1, execute BODY.
> +Updates T1 to 'current-time' if this condition is met. If T1 is
> +nil, always execute body."
> + `(let ((t1 ,t1))
> + (if t1
> + (let ((curtime (current-time)))
> + (when (< 0 (nth 1 (time-subtract curtime t1)))
> + (setq t1 curtime)
> + ,@body))
> + ,@body)))
You shouldn't splice BODY twice in your macro. Also, I don't get why you
need to (setq t1 curtime).
Do you need a macro at all for this task? ISTM you only need to display
a message conditionally and update a time value.
Regard,