From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sHOxBxk4X2O5xwAAbAwnHQ (envelope-from ) for ; Mon, 31 Oct 2022 03:51:05 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SB+0Bxk4X2MlbwEA9RJhRA (envelope-from ) for ; Mon, 31 Oct 2022 03:51:05 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B1C7C26D97 for ; Mon, 31 Oct 2022 03:51:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opKsF-00082X-Qc; Sun, 30 Oct 2022 22:50:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opKsE-00082M-RC for emacs-orgmode@gnu.org; Sun, 30 Oct 2022 22:50:02 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opKsC-0003rB-BG for emacs-orgmode@gnu.org; Sun, 30 Oct 2022 22:50:02 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 1D15A240101 for ; Mon, 31 Oct 2022 03:49:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667184597; bh=8DRcmnUnhJlm2KA36ehCobBNA7eqgkwvTUP5fLVd/rc=; h=From:To:Cc:Subject:Date:From; b=n/MUp7MQvkIldYXBo1nnlcnCJGlf2ZT8671PuhC6yDa10eeHckh+sGDWPYuU0Mcfr QLb+L4TTBR0ZTSvUzSk16Lv/8yzuXMbZwUf6Htpk3gl8ZVWrbFt4aIeFMHsU2tt0pp AQ9EoVdmv1YtJJH/vxqjUamz+9Y+8PjjG4KOT27vUN0+zlB/Gvs0xzTDAdZoJpdxal /foxSsF9/K+9L73WPtiMItuGIjICRRpC7ilXnQg5OWjWxymD1IaT8DkqmmQ4tJo/7E Gi6eNWxennYvqWt3iPAov3WHzpddJQriDdK1Yt1/ZM/bq32MWEDsmqQm7//eRFS5Gv EjHpuosZE4/uw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N0yLD0m2Wz6trJ; Mon, 31 Oct 2022 03:49:55 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org Subject: Re: org-x11idle-exists-p with emacs --daemon In-Reply-To: References: <871qqs6gqs.fsf@free.fr> <87y1t0lgfo.fsf@localhost> <87mt9egknp.fsf@localhost> Date: Mon, 31 Oct 2022 02:50:31 +0000 Message-ID: <877d0gn1u0.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Emacs-orgmode" Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1667184664; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=31I5PHb8RT+sHmgs4j4BFC/nrHnopXlJSepUucCDd28=; b=BfuMYIxQhvQ7N+YkDq1vTG2RJmCsxTWUaFSsI4MddOHwi700s4hUbbHgf5x+90uOb+mzhJ +I3e8/VELnsTQocddL4gntgU3fl+Dj9t8epcVK+ifvVPhmPDvDQPA3/3qQih/bYzFzZnM4 KPeBkW3Q6aS0wcPTppfGUV9AxEQYY7jBakU5K0hupD5N6KX5TbpAlGtMH6XGACvLfiXwJV xkrTYeO89xxsjHl5PFbnuH7EZHBfgP0JlZ/XE2CfICQgbjAX5f9XxeA1PWfdgoYISM21sN x1KhcI8Rkb0TIIgd9AGTkRJWSHzS5SFNivVa+gz2AlvHyAwjKA/GBIw6RGamVA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667184664; a=rsa-sha256; cv=none; b=cAF4/cVKwAMliJeKMKDO0aVNJyI/JKsoY/GL2hKwI7+PgXObT/MyHu0jrXS3hRG9PnfqRX ne9yUY7k4YejwSrwuZvEpXRNJsCLl3UT9cevrPQVslryB0Qs45ixoLvKgFTT2VhdcCrdVu AS9XCpi3JYb+jYWUBPXSS3Yia0Rn8HKYG4+0s0JoDiH/0XCnf690ofyhEjn2BC6bPA/luS BpAfruEmcCk0HQyd2otWbvgFZ/NtHh7XZSHMqdScAsqznu5b1Bpu552NI75RLXLTDGs6l6 WiU+S5LBdpufg8n4+Nc9GQGlXGX62da0Q4MoTi7iRS4ToklwZp2XANawco1cHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="n/MUp7MQ"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.46 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="n/MUp7MQ"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B1C7C26D97 X-Spam-Score: -3.46 X-Migadu-Scanner: scn1.migadu.com X-TUID: j3qaffvwgz1L Max Nikulin writes: > Ihor, what I do not like in your patch is that an external process is > unconditionally executed during load time. Earlier there was a (failed) > attempt to limit it to X11. > > - Unsure if Windows builds of Emacs may connect to X servers. > - MacOS does not use x11idle, it calls ioreg and perl instead. We can test `sytem-type' to be in '(gnu gnu/linux gnu/kfreebsd). > In above cases, there might be a point to execute x11idle if a user is > running remote Emacs session on a Windows or a MacOS machine (e.g. > through ssh) from local X server. Unsure if somebody has ever tried it. > The reason to try x11idle should be a test if current frame is > associated with X. This is a trade-off. If we want to consider individual frames running on remote X server, `org-user-idle-seconds' will need to check the command availability on every call. That is - we will try to run shell command every 60 seconds (`org-resolve-clocks-if-idle''s default timer). I'd say that it is not a good idea considering how rare such situation is. > A side note. I am aware that the following comment existed before your > commit. >> (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'? >> (eq 0 (call-process-shell-command org-clock-x11idle-program-name)))) > > `call-process' can not be used here because "command" is a shell > built-in, not a real executable. I have another question. Why > `locate-file' is not used instead? > > (locate-file command exec-path exec-suffixes 1)) > > https://emacs.stackexchange.com/questions/332/how-can-i-find-the-path-to-an-executable-with-emacs-lisp Not idea. Maybe even `executable-find'? > On 30/10/2022 08:33, Ihor Radchenko wrote: >> Max Nikulin writes: >> >>> In server.el I found >>> >>> (frame-parameter frame 'display) > .. >> >> I do not understand. > > echo "$DISPLAY" > :0 > emacs -Q --daemon > emacsclient -nw > > window-system > nil > (frame-parameter nil 'display) > ":0" > (call-process "xterm") > > So formally a tty frame has access to X11 server. Can we reliably distinguish between X and Wayland this way? > My summary: > - To be really flexible (e.g. to support Wayland) > `org-user-idle-seconds' should have an extension point allowing to > specify elisp function. Could you prepare a patch? > - x11idle availability should be checked when X connection is detected, > not at startup time and perhaps `locate-file' is better than "command" > shell built-in. Again, patches welcome. It will be a marginal improvement. > - (frame-parameter nil 'display) might be more accurate in addition to > `window-system' check. Do you mean (or ..)? -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at