Browse Source

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
Nicolas Calderon Asselin 12 năm trước cách đây
mục cha
commit
db2bf2a818
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      lisp/org-clock.el

+ 6 - 1
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))))