From: Ihor Radchenko <yantar92@posteo.net>
To: Julien Cubizolles <j.cubizolles@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-x11idle-exists-p with emacs --daemon
Date: Fri, 28 Oct 2022 04:28:59 +0000 [thread overview]
Message-ID: <87y1t0lgfo.fsf@localhost> (raw)
In-Reply-To: <871qqs6gqs.fsf@free.fr>
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
Julien Cubizolles <j.cubizolles@free.fr> writes:
> All the org-*-idle-seconds func test at some point for
> org-x11idle-exists-p which is defvar-ed at load time.
>
> For me, org-x11idle-exists-p is always nil at startup, but is set to
> true if I eval it later on. I guess it's because I'm starting Emacs in
> daemon mode, (as a systemd user service actually), and
> org-x11idle-exists-p relies on (eq window-system 'x) which is somehow
> not set in the terminal when the daemon.
>
> For the time being, it manually set org-x11idle-exists-p to true but
> shouldn't all this tests on (eq-window-system) be run each time a new
> frame is created ?
Does the attached patch work for you?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-x11idle-exists-p-Do-not-demand-X-window-system-a.patch --]
[-- Type: text/x-patch, Size: 1335 bytes --]
From 95ec1073ab27bbfe522b25c9852f1e5e85e38e32 Mon Sep 17 00:00:00 2001
Message-Id: <95ec1073ab27bbfe522b25c9852f1e5e85e38e32.1666931293.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Fri, 28 Oct 2022 12:26:09 +0800
Subject: [PATCH] org-x11idle-exists-p: Do not demand X window system at load
time
* lisp/org-clock.el (org-x11idle-exists-p): Do not check if load-time
`window-system' is `x'. Instead, rely on the check in
`org-user-idle-seconds'.
Emacs may start as a daemon and hence `window-system' may not yet be
`x' during startup.
Reported-by: Julien Cubizolles <j.cubizolles@free.fr>
Link: https://orgmode.org/list/871qqs6gqs.fsf@free.fr
---
lisp/org-clock.el | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index e98a34f0d..ca026c44f 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1201,8 +1201,7 @@ (defun org-mac-idle-seconds ()
(defvar org-x11idle-exists-p
;; Check that x11idle exists
- (and (eq window-system 'x)
- (eq 0 (call-process-shell-command
+ (and (eq 0 (call-process-shell-command
(format "command -v %s" org-clock-x11idle-program-name)))
;; Check that x11idle can retrieve the idle time
;; FIXME: Why "..-shell-command" rather than just `call-process'?
--
2.35.1
[-- Attachment #3: Type: text/plain, Size: 225 bytes --]
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2022-10-28 4:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 22:31 org-x11idle-exists-p with emacs --daemon Julien Cubizolles
2022-10-28 3:08 ` Max Nikulin
2022-10-28 4:29 ` Ihor Radchenko
2022-10-28 4:39 ` Max Nikulin
2022-10-28 5:19 ` Ihor Radchenko
2022-10-28 4:28 ` Ihor Radchenko [this message]
2022-10-28 21:48 ` Julien Cubizolles
2022-10-29 2:54 ` Ihor Radchenko
2022-10-29 12:33 ` Max Nikulin
2022-10-30 1:33 ` Ihor Radchenko
2022-10-30 6:20 ` Max Nikulin
2022-10-31 2:50 ` Ihor Radchenko
2022-10-31 2:53 ` Change default value of org-clock-x11-idle-program-name (was: org-x11idle-exists-p with emacs --daemon) Ihor Radchenko
2023-01-24 12:41 ` [PATCH] Change default value of org-clock-x11-idle-program-name Ihor Radchenko
2023-01-26 15:43 ` Max Nikulin
2023-01-27 10:20 ` Ihor Radchenko
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=87y1t0lgfo.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=j.cubizolles@free.fr \
/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).