From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Calderon Subject: Re: A bit of work around org-clock-idle-time Date: Sat, 28 Jul 2012 05:30:41 -0400 Message-ID: References: <8935.1342651403@alphaville> <87r4rwsrbz.fsf@gnu.org> <28102.1343445599@alphaville> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:52957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sv3MV-0004Ry-IA for emacs-orgmode@gnu.org; Sat, 28 Jul 2012 05:31:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sv3MU-000800-M4 for emacs-orgmode@gnu.org; Sat, 28 Jul 2012 05:31:03 -0400 In-Reply-To: <28102.1343445599@alphaville> 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: nicholas.dokos@hp.com Cc: Bastien , emacs-orgmode@gnu.org Sorry, I forgot to reply to all when Nicolas D. answered the first email and took it off the list. Here is what you missed regarding org-clock.el: On Thu, Jul 19, 2012 at 2:33 PM, Nick Dokos wrote: > Nicolas Calderon wrote: > >> >> As for the max solution for idle time, I don't think it's a good >> solution. It solves the case where x11idle always return 0, but if >> you're active in X (x11idle always low) but not in emacs (high idle >> time), you'll end up in clock resolving mode. >> > > Fair enough, but it can still be done so as to simulate today's behavior > while avoiding the 0 case. Something like > > ((eq window-system 'x) > (let ((idle (org-x11-idle-seconds))) > (if (> idle 0) > idle > (org-emacs-idle-seconds)))) The problem I see here is that 0 is a valid output for x11idle, so if the check is done while X11 is not idle, it will fall back to org-emacs-idle-seconds. From what I could see in the shell-command-to-string, there is no way to tell between an output from the program and the 0 the function returns if there is no output (can't find the command). That's why I added the additional check for the command existence. Optimally, that check would be done once at startup or the first time idle time is checked but I lack the elisp skills to perform such a "feat". That being said, the patch was merged in, so I don't know if it's an indication that I should not worry. Thanks, -- Nicolas Calderon On Fri, Jul 27, 2012 at 11:19 PM, Nick Dokos wrote: > Bastien wrote: > >> Nick Dokos writes: >> >> > o in org-clock.el, instead of checking whether x11idle exists or not, how >> > about something like this: >> > >> > ... >> > (eq window-system 'x) >> > (max (org-x11-idle-seconds) (org-emacs-idle-seconds)) >> > ... >> >> Yes, this is cleaner, thanks! >> > > Cleaner maybe, but it's not correct, as Nicolas C. pointed out. Nicolas > C. and I had an email exchange and I hope he will follow up with revised > patches. > > Nick