emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Introduce a new variable for x11idle
@ 2012-12-23 19:34 Yasushi SHOJI
  2012-12-23 20:03 ` Bastien
  2013-01-11 22:17 ` Bastien
  0 siblings, 2 replies; 6+ messages in thread
From: Yasushi SHOJI @ 2012-12-23 19:34 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce a new variable for x11idle
  2012-12-23 19:34 [PATCH] Introduce a new variable for x11idle Yasushi SHOJI
@ 2012-12-23 20:03 ` Bastien
  2012-12-25 10:06   ` Yasushi SHOJI
  2013-01-11 22:17 ` Bastien
  1 sibling, 1 reply; 6+ messages in thread
From: Bastien @ 2012-12-23 20:03 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

Hi Yasushi,

Yasushi SHOJI <yashi@atmark-techno.com> writes:

> 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.

thanks for the patch, especially for taking care of updating the
documentation.

Since the patch is substantial, we need you sign the FSF copyright
assignment in order to apply it.  If that's okay with you, please
fill the form here and follow the instructions here:

  http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce a new variable for x11idle
  2012-12-23 20:03 ` Bastien
@ 2012-12-25 10:06   ` Yasushi SHOJI
  2012-12-25 10:32     ` Bastien
  2012-12-29 10:08     ` Bastien
  0 siblings, 2 replies; 6+ messages in thread
From: Yasushi SHOJI @ 2012-12-25 10:06 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

At Sun, 23 Dec 2012 21:03:57 +0100,
Bastien wrote:
> 
> Since the patch is substantial, we need you sign the FSF copyright
> assignment in order to apply it.  If that's okay with you, please
> fill the form here and follow the instructions here:
> 
>   http://orgmode.org/cgit.cgi/org-mode.git/plain/request-assign-future.txt

Thank you for the info.

I've signed the paper and it's on its way to FSF.  it will take a few
more days to reach the office, though.

Thanks,
-- 
            yashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce a new variable for x11idle
  2012-12-25 10:06   ` Yasushi SHOJI
@ 2012-12-25 10:32     ` Bastien
  2012-12-29 10:08     ` Bastien
  1 sibling, 0 replies; 6+ messages in thread
From: Bastien @ 2012-12-25 10:32 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

Hi Yasushi,

Yasushi SHOJI <yashi@atmark-techno.com> writes:

> I've signed the paper and it's on its way to FSF.  it will take a few
> more days to reach the office, though.

great -- thanks!

I've added you to the list of contributors waiting for the FSF
confirmation.  If you don't get any feedback within the next three
weeks, let me know, I can try to accelerate things.

Best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce a new variable for x11idle
  2012-12-25 10:06   ` Yasushi SHOJI
  2012-12-25 10:32     ` Bastien
@ 2012-12-29 10:08     ` Bastien
  1 sibling, 0 replies; 6+ messages in thread
From: Bastien @ 2012-12-29 10:08 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

Hi Yasushi,

Yasushi SHOJI <yashi@atmark-techno.com> writes:

> I've signed the paper and it's on its way to FSF.  it will take a few
> more days to reach the office, though.

thanks a lot for the time you spent on this -- and don't hold
your breath, it may take some time for the FSF to process this.

Let me know when you get the confirmation.

All best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce a new variable for x11idle
  2012-12-23 19:34 [PATCH] Introduce a new variable for x11idle Yasushi SHOJI
  2012-12-23 20:03 ` Bastien
@ 2013-01-11 22:17 ` Bastien
  1 sibling, 0 replies; 6+ messages in thread
From: Bastien @ 2013-01-11 22:17 UTC (permalink / raw)
  To: Yasushi SHOJI; +Cc: emacs-orgmode

Hi Yasushi,

Yasushi SHOJI <yashi@atmark-techno.com> writes:

> 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

Applied, thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-11 22:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-23 19:34 [PATCH] Introduce a new variable for x11idle Yasushi SHOJI
2012-12-23 20:03 ` Bastien
2012-12-25 10:06   ` Yasushi SHOJI
2012-12-25 10:32     ` Bastien
2012-12-29 10:08     ` Bastien
2013-01-11 22:17 ` Bastien

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).