From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATH] Speedups to org-table-recalculate Date: Sat, 22 Nov 2014 00:30:31 +0100 Message-ID: <87oas03ze0.fsf@nicolasgoaziou.fr> References: <87oas9tnlm.fsf@selenimh.mobile.lan> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrxeA-0000Zl-3u for emacs-orgmode@gnu.org; Fri, 21 Nov 2014 18:30:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xrxdz-0008DJ-Ud for emacs-orgmode@gnu.org; Fri, 21 Nov 2014 18:29:50 -0500 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:40460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xrxdz-0008D5-Ot for emacs-orgmode@gnu.org; Fri, 21 Nov 2014 18:29:39 -0500 In-Reply-To: (Nathaniel Flath's message of "Fri, 21 Nov 2014 14:40:32 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nathaniel Flath Cc: Michael Brand , org-mode List Nathaniel Flath 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,