emacs-orgmode
[Top][All Lists]
Advanced

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

Re: bug#44824: [PATCH] org.el: Avoid xdg-open silent failure


From: Maxim Nikulin
Subject: Re: bug#44824: [PATCH] org.el: Avoid xdg-open silent failure
Date: Fri, 19 Feb 2021 23:45:55 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 19/02/2021 21:54, Eli Zaretskii wrote:
From: Maxim Nikulin
Date: Fri, 19 Feb 2021 19:29:49 +0700

On Windows Emacs always uses pipes, because we don't have PTYs there.
And there's no xdg-open on MS-Windows anyway, so it's a moot point.

Should I consider your response as a suggestion to remove the `if'
related to `system-type'?

Yes, that 'if' isn't necessary.

Let's wait for comments comments from org developers. I do not mind to remove the `if' but they could ask for other changes.

If I remember correctly, on windows it is possible to communicate with a
process through stdin and stdout only if the application is compiled as
a *console* one.

That's true.  But in this case we don't really want to communicate
with the sub-process, do we?  We just want to invoke it and let it
run.  So the fact that there's no way of communicating with the
sub-process is not important here, as the pipes will not be used.  We
just need to specify pipes because that works around the problem with
xdg-open.

The reason to switch to pipe process here is to avoid side effects of *terminal session*. PTY is redundant here. Pipe process is the only alternative available in emacs. Currently there is no data exchange with subprocess.

Reading of stderr and stdout from the handler and its descendants could be useful to realize a cause of a problem when it happens. At least on linux it is enough to specify some buffer instead of `nil' or add a :filter function. The reason why I did not make such change is that Gtk applications tends to report significant number of failed asserts. I do not like to pollute the "*Messages*" buffer. I am in doubts if a dedicated buffer should be created for such purpose.

Reading of stdout could be useful in mailcap handlers e.g. to display text from PDF file when only text terminal is available (no X11 or wayland). Currently emacs ignores "needsterminal" and "copiousoutput" flags in mailcap. Example of an entry for PDF:

application/pdf; pdftotext -layout %s -; test=test -z "$DISPLAY"; copiousoutput

Likely only a small part of users could benefit from such feature.

"start file.pdf" executed in cmd.exe launches an application that does
not block command prompt. In this sense it similar to background
processes launched by kde-open5 or "gio open". However I am unaware if
there is something similar to process groups on windows that leads to
termination of all group members when leader process finishes.

Things are fairly similar on Windows.  But is this really relevant to
the issue at hand?  There's no xdg-open on Windows, so whatever
problems you had with xdg-open will never happen on Windows.  the
proposed patch fixes the problem only on systems where org.el invokes
the PDF viewer via xdg-open.  Right?

1. It is not a problem of namely xdg-open. It is (mostly reasonable but with some caveats however) specific of DE-specific handlers as "gio open" and kde-open5. They exit just after spawning of a process with actual handler. (Just like "start file.pdf" on windows.) I am afraid that I could break something on windows, so I would prefer that somebody will test the changes on non-linux systems.

2. It is not specific to PDF files, the problem could happen with any format if wrapper handler such as "gio open" is invoked instead of e.g. direct execution of eog.




reply via email to

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