emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-clock idle time in pgtk Emacs


From: Ihor Radchenko
Subject: Re: org-clock idle time in pgtk Emacs
Date: Thu, 02 Feb 2023 09:17:10 +0000

Max Nikulin <manikulin@gmail.com> 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 <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]