From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org, Julien Cubizolles <j.cubizolles@free.fr>
Subject: Re: org-clock idle time in pgtk Emacs
Date: Thu, 02 Feb 2023 09:17:10 +0000 [thread overview]
Message-ID: <87zg9wpgtl.fsf@localhost> (raw)
In-Reply-To: <29c1766c-89cb-6898-f11d-5886144dff27@gmail.com>
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>
next prev parent reply other threads:[~2023-02-02 9:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 8:32 org-clock idle time in pgtk Emacs Julien Cubizolles
2022-05-24 10:27 ` Tim Cross
2022-05-25 6:38 ` Ihor Radchenko
2023-01-31 16:24 ` Julien Cubizolles
2023-02-01 13:15 ` Ihor Radchenko
2023-02-01 15:45 ` Max Nikulin
2023-02-02 9:17 ` Ihor Radchenko [this message]
2023-02-03 5:55 ` Julien Cubizolles
2023-02-03 12:17 ` Ihor Radchenko
2023-02-03 15:07 ` Max Nikulin
2023-02-04 11:04 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zg9wpgtl.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=j.cubizolles@free.fr \
--cc=manikulin@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.