From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 OvOqBox/22MBYAEAbAwnHQ (envelope-from ) for ; Thu, 02 Feb 2023 10:17:00 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0EpFBIx/22M8JwAAauVa8A (envelope-from ) for ; Thu, 02 Feb 2023 10:17:00 +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 B10E520F3F for ; Thu, 2 Feb 2023 10:16:59 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNVi0-0004Yj-44; Thu, 02 Feb 2023 04:16:44 -0500 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 1pNVhv-0004YN-M4 for emacs-orgmode@gnu.org; Thu, 02 Feb 2023 04:16:39 -0500 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 1pNVht-00045v-Ld for emacs-orgmode@gnu.org; Thu, 02 Feb 2023 04:16:39 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id A49E02406E6 for ; Thu, 2 Feb 2023 10:16:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1675329395; bh=kJrMBARZxcMc+bFlE29DXCBDV6xBKi/vCC0uIISZYIM=; h=From:To:Cc:Subject:Date:From; b=YOu3KbPohBT/eeZQ21viIVcUY6woXpquP1WBDtka0nhwEvqM8nJOvKsDkW9KZsDFt pApZiJU9oWtEvbGqkR+UcJhPr9c6jINjpll5I502dKjMu4QO48jD33c0dY72VQwp77 OQf/qO8/MRkK6iZake4EIQFlb9iSvvzQEce12Tu2aaCXg05JuobsOYo0Mmvk/P7qrL okPbHqeC+ZO2SU3CkNzeQdrv27xINYxmu3EPSnirPfF7g71BadBV+90L13n9F5iGOi 2peaMbJRML+PoNEt6MhsLyaII+fTrnbYfd1z/yijb2dSgkYIMQ7vNu2LTvqNC8CYTP 6rsCiilN0jBBA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4P6tSy5sbkz6tmS; Thu, 2 Feb 2023 10:16:34 +0100 (CET) From: Ihor Radchenko To: Max Nikulin Cc: emacs-orgmode@gnu.org, Julien Cubizolles Subject: Re: org-clock idle time in pgtk Emacs In-Reply-To: <29c1766c-89cb-6898-f11d-5886144dff27@gmail.com> References: <875ylvnxf9.fsf@free.fr> <87wnea15hy.fsf@localhost> <87lelin03e.fsf@free.fr> <87y1phjzmg.fsf@localhost> <29c1766c-89cb-6898-f11d-5886144dff27@gmail.com> Date: Thu, 02 Feb 2023 09:17:10 +0000 Message-ID: <87zg9wpgtl.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: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Seal: i=1; s=key1; d=yhetil.org; t=1675329419; a=rsa-sha256; cv=none; b=P/5Y+kGIDuRFW4KKdYKMawgVxxLxNgDrAuyN9LXrC8C69dvycfcMQ4dzkwDGcu1Mo9reKj oWngcomlYNdq/54GzqzjjLToan1oueCf4P2lSM+IU/c8+XOH99afGTLFwyQ7rBiJxQtHTw 3xD9fuXHF3xD86bE/7Yfv42Ii4oPFmhYJqcQ8a3VQy4X0GbDj9NZzcDzHFo6GyMg3PVUhR KxAXfhxV72kMy7siV+NM8Y+vpxqTguKZHlZY2o5MoLMXNYGeMMdeRiXGpY2EljKuPdQiZv 4cfwDyCisc65/yhDnWwMJXAlSHvt5CpRzhSA7ggXQyf14Diyk8bJNt0Xz+L+4Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=YOu3KbPo; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1675329419; 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=kWvnJOPaIb9ORcxEG0tLAFLNUtx5OvhmzfEm4hJVudY=; b=cvWO7rz7LFY5GZRRf3kEj5Bw6lflLqr9xo46Fll9Uv0nnZngp6SfDcd3Q/bnTBKbAwu99o 1kogV2Gbx3BFqsvt/MrVViaqY0ux9NQmUyxXU0QkRM9QF2id7qsZQHtdduZUDdqPCrhHMk syG5Hf62cLIpTlhFX/iuXXz3FvxVVkkUtDGWdNeeDor+w6d99R/BioxUDXG1PJ2R3ILLQv PbJFXU7fPAtciZMFicxeVJWShhiC0RNiU19eSeu9nvJD7uX/44Ywa4cSTGhfLwpoZaZlkJ FsBQx8jKE4GckF4Qk0SAg22j/eMpU/Bl/sDA/6g2IMgSZIhPfGvazV3VKRkNWg== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.55 X-Spam-Score: -4.55 X-Migadu-Queue-Id: B10E520F3F Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=YOu3KbPo; 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"; dmarc=pass (policy=none) header.from=posteo.net X-TUID: 4chFmpnVLUdD Max Nikulin writes: >>> +(defvar org-pgtkidle-exists-p >>> + ;; Check that org-clock-pgtkidle-program-name exists. But don't do that on DOS/Windows, >>> + ;; since the command definitely does NOT exist there, and invoking >>> + ;; COMMAND.COM on MS-Windows is a bad idea -- it hangs. >>> + (and (null (memq system-type '(windows-nt ms-dos))) >>> + (eq 0 (call-process-shell-command >>> + (format "command -v %s" org-clock-pgtkidle-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-pgtkidle-program-name)))) >> >> We may as well resolve this FIXME since we are at it. >> Instead of the awkward combination of two `call-process-shell-command' >> prompts, we can simply use `executable-find' + `call-process'. > > Is there a reasonable way to avoid code duplication? I agree that > `executable-find' may be better since `org-clock-pgtkidle-program-name' > might contain spaces or shell specials causing issues with current code. I do not think that we should avoid code duplication here. pgtk and x11 is principally different. The fact that the same code works for them is rather a co-incidence. It is unlikely that a new window-system is going to use the same code again. And de-duplicating jut two functions is not worth it. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at