From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: jit-lock timer etc. Date: Wed, 23 Aug 2006 15:09:30 +0200 Message-ID: References: <44E9E5F5.8000400@gmx.at> <87fyfpq5wf.fsf@stupidchicken.com> <44EA3222.9050405@gmx.at> <44EC49AD.2080001@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1156338694 17027 80.91.229.2 (23 Aug 2006 13:11:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 23 Aug 2006 13:11:34 +0000 (UTC) Cc: cyd@stupidchicken.com, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 23 15:11:31 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GFsVn-0004yi-K7 for ged-emacs-devel@m.gmane.org; Wed, 23 Aug 2006 15:11:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFsVm-0003YV-G4 for ged-emacs-devel@m.gmane.org; Wed, 23 Aug 2006 09:11:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GFsVY-0003UZ-6Q for emacs-devel@gnu.org; Wed, 23 Aug 2006 09:11:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GFsVW-0003Rn-OJ for emacs-devel@gnu.org; Wed, 23 Aug 2006 09:10:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GFsVW-0003Rh-Kg for emacs-devel@gnu.org; Wed, 23 Aug 2006 09:10:58 -0400 Original-Received: from [195.41.46.237] (helo=pfepc.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GFsdJ-00056T-MP; Wed, 23 Aug 2006 09:19:01 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (unknown [80.165.4.124]) by pfepc.post.tele.dk (Postfix) with SMTP id 889D08A005D; Wed, 23 Aug 2006 15:10:46 +0200 (CEST) Original-To: martin rudalics In-Reply-To: <44EC49AD.2080001@gmx.at> (martin rudalics's message of "Wed, 23 Aug 2006 14:27:25 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58765 Archived-At: martin rudalics writes: >> I think this ought to use run-with-idle-timer >> and current-idle-time, as in my patch. > > I was not able to accomplish that since the idle timer does not trigger. I can hardly imagine emacs being idle for more than 2^28 seconds, so it seems safe to simplify it to return a cons (SECS . USECS) [see patch below] > In analogy to your patch I replaced the above by > > (when (and jit-lock-stealth-buffers jit-lock-stealth-time) > ;; Call us again. > (timer-set-idle-time jit-lock-stealth-repeat-timer (current-idle-time)) > (timer-inc-time jit-lock-stealth-repeat-timer delay) > (timer-activate-when-idle jit-lock-stealth-repeat-timer t) > > but I suspect that calling `timer-set-idle-time' with the return value > of `current-idle-time' does not DTRT: With the above change to current-idle-time, it seems the following should work: (when (and jit-lock-stealth-buffers jit-lock-stealth-time) ;; Call us again. (let ((idle (current-idle-time))) (when idle (timer-set-idle-time jit-lock-stealth-repeat-timer delay) (timer-inc-time jit-lock-stealth-repeat-timer (car idle) (cdr idle)) (timer-activate-when-idle jit-lock-stealth-repeat-timer t))) Notice the swap in the args in the first two calls. That's because inc-time accepts an USECS arg, while set-idle-time doesn't. *** keyboard.c 21 Aug 2006 21:38:31 +0200 1.872 --- keyboard.c 23 Aug 2006 14:54:50 +0200 *************** *** 4561,4571 **** DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0, /* Return the current length of Emacs idleness. ! The value is returned as a list of three integers. The first has the ! most significant 16 bits of the seconds, while the second has the ! least significant 16 bits. The third integer gives the microsecond ! count. ! The microsecond count is zero on systems that do not provide resolution finer than a second. */) () --- 4561,4567 ---- DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0, /* Return the current length of Emacs idleness. ! The value is returned as a cons (SECS . USECS). The microsecond count is zero on systems that do not provide resolution finer than a second. */) () *************** *** 4578,4588 **** { EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time); ! XSETINT (result[0], (EMACS_SECS (idleness_now) >> 16) & 0xffff); ! XSETINT (result[1], (EMACS_SECS (idleness_now) >> 0) & 0xffff); ! XSETINT (result[2], EMACS_USECS (idleness_now)); ! ! return Flist (3, result); } return Qnil; --- 4574,4581 ---- { EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time); ! return Fcons (make_number (EMACS_SECS (idleness_now)), ! make_number (EMACS_USECS (idleness_now))); } return Qnil; -- Kim F. Storm http://www.cua.dk