From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yasushi SHOJI Subject: [PATCH] Introduce a new variable for x11idle Date: Mon, 24 Dec 2012 04:34:54 +0900 Message-ID: <87fw2wa6k0.wl@dns1.atmark-techno.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmriI-0007B1-Kr for emacs-orgmode@gnu.org; Sun, 23 Dec 2012 15:00:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TmriC-0000ih-Mn for emacs-orgmode@gnu.org; Sun, 23 Dec 2012 14:59:58 -0500 Received: from plane.gmane.org ([80.91.229.3]:54594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmriC-0000iY-G5 for emacs-orgmode@gnu.org; Sun, 23 Dec 2012 14:59:52 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TmriO-0002RG-Hk for emacs-orgmode@gnu.org; Sun, 23 Dec 2012 21:00:04 +0100 Received: from p654785.hkidff01.ap.so-net.ne.jp ([121.101.71.133]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 23 Dec 2012 21:00:04 +0100 Received: from yashi by p654785.hkidff01.ap.so-net.ne.jp with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 23 Dec 2012 21:00:04 +0100 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: emacs-orgmode@gnu.org Debian and other OSes already have a program called 'xprintidle', which does the same thing as x11idle. It also handles the DPMS bug[1] some version of X servers have. In order to use an alternative, introduce a customizable variable 'org-clock-x11idle-program-name' to hold the actual command name. [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502226 --- doc/org.texi | 14 ++++++++------ lisp/org-clock.el | 19 ++++++++++++++++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index cb451fc..99d82bb 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -6350,12 +6350,14 @@ as 10 or 15, Emacs can alert you when you get back to your computer after being idle for that many minutes@footnote{On computers using Mac OS X, idleness is based on actual user idleness, not just Emacs' idle time. For X11, you can install a utility program @file{x11idle.c}, available in the -@code{contrib/scripts} directory of the Org git distribution, to get the same -general treatment of idleness. On other systems, idle time refers to Emacs -idle time only.}, and ask what you want to do with the idle time. There will -be a question waiting for you when you get back, indicating how much idle -time has passed (constantly updated with the current amount), as well as a -set of choices to correct the discrepancy: +@code{contrib/scripts} directory of the Org git distribution, or install the +@file{xprintidle} package and set it to the variable +@code{org-clock-x11idle-program-name} if you are running Debian, to get the +same general treatment of idleness. On other systems, idle time refers to +Emacs idle time only.}, and ask what you want to do with the idle time. +There will be a question waiting for you when you get back, indicating how +much idle time has passed (constantly updated with the current amount), as +well as a set of choices to correct the discrepancy: @table @kbd @item k diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 8d11b8c..d0605aa 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -374,6 +374,19 @@ specifications than `frame-title-format', which see." :group 'org-clock :type 'sexp) +(defcustom org-clock-x11idle-program-name "x11idle" + "Name of the program which prints X11 idle time in milliseconds. + +You can find x11idle.c in the contrib/scripts directory of the +Org git distribution. Or, you can do: + + sudo apt-get install xprintidle + +if you are using Debian." + :group 'org-clock + :version "24.3" + :type 'string) + (defvar org-clock-in-prepare-hook nil "Hook run when preparing the clock. This hook is run before anything happens to the task that @@ -1012,13 +1025,13 @@ If `only-dangling-p' is non-nil, only ask to resolve dangling (defvar org-x11idle-exists-p ;; Check that x11idle exists (and (eq window-system 'x) - (eq (call-process-shell-command "command" nil nil nil "-v" "x11idle") 0) + (eq (call-process-shell-command "command" nil nil nil "-v" org-clock-x11idle-program-name) 0) ;; Check that x11idle can retrieve the idle time - (eq (call-process-shell-command "x11idle" nil nil nil) 0))) + (eq (call-process-shell-command org-clock-x11idle-program-name nil nil nil) 0))) (defun org-x11-idle-seconds () "Return the current X11 idle time in seconds." - (/ (string-to-number (shell-command-to-string "x11idle")) 1000)) + (/ (string-to-number (shell-command-to-string org-clock-x11idle-program-name)) 1000)) (defun org-user-idle-seconds () "Return the number of seconds the user has been idle for. -- 1.7.10.4