emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Calderon <nicolas.calderon.asselin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Patch for org-clock.el
Date: Wed, 18 Jul 2012 16:40:29 -0400	[thread overview]
Message-ID: <CAHbMD+HV=MCxM1E_wdhJjzz3DfNLudgBStZ=9Cn92Y_05WtqVg@mail.gmail.com> (raw)

From c8979b360749ecd66e298fdbdbc2450668be3a20 Mon Sep 17 00:00:00 2001
From: Nicolas Calderon Asselin <nicolas.calderon.asselin@gmail.com>
Date: Wed, 18 Jul 2012 14:58:31 -0400
Subject: [PATCH 2/2] Added checks to determine which idle time to use

* lisp/org-clock.el (org-clock-idle-time): Org-mode assumed that x11idle
  was an available command, and returned an idle time of 0 if it was not
  (never idle). Added checks so that org-idle-time will come from emacs'
  own current-idle-time if x11idle cannot be found or if it cannot
  retrieve the idle time from X11

TINYCHANGE
---
 lisp/org-clock.el |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 162ee07..a913014 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1010,7 +1010,12 @@ This routine returns a floating point number."
   (cond
    ((eq system-type 'darwin)
     (org-mac-idle-seconds))
-   ((eq window-system 'x)
+   ((and
+     (eq window-system 'x)
+     ;; Check that x11idle exists
+     (eq (call-process-shell-command "command" nil nil nil "-v" "x11idle") 0)
+     ;; Check that x11idle can retrieve the idle time
+     (eq (call-process-shell-command "x11idle" nil nil nil ) 0))
     (org-x11-idle-seconds))
    (t
     (org-emacs-idle-seconds))))
-- 
1.7.10.4

             reply	other threads:[~2012-07-18 20:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 20:40 Nicolas Calderon [this message]
2012-07-24 15:10 ` Patch for org-clock.el Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHbMD+HV=MCxM1E_wdhJjzz3DfNLudgBStZ=9Cn92Y_05WtqVg@mail.gmail.com' \
    --to=nicolas.calderon.asselin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).