From: Maxim Nikulin <firstname.lastname@example.org>
Subject: Re: [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file
Date: Mon, 18 Jan 2021 23:32:35 +0700 [thread overview]
Message-ID: <email@example.com> (raw)
On 05/09/2020 14:52, Bastien wrote:
> stardiviner <firstname.lastname@example.org> writes:
>> When I press =[C-u C-u C-c C-o]= to open an image file link with system external
>> program. It can't open the image file.
> I cannot reproduce the problem here.
> If you still have this issue, can you provide a minimal reproducible
Christopher Miles recently posted a link to askubuntu that shed some
light on the problem.
I have compared the following commands:
(start-process-shell-command "xdg-open" nil "xdg-open
(start-process-shell-command "eog" nil "eog
The latter works in my (test) case (Ubuntu-20.04, ubuntu session -
gnome), the former does not. If I do not mistake,
start-process-shell-command is what org mode uses to open file.
Meaningful lines from strace of the emacs process
24108 21:39:51 execve("/bin/bash", ["/bin/bash", "-c", "xdg-open
/usr/share/icons/gnome/"...], 0x7ffcb1c1fdb0 /* 55 vars */ <unfinished...>
24116 21:39:51 execve("/usr/bin/eog", ["eog",
"/usr/share/icons/gnome/256x256/a"...], 0x55d009672ec8 /* 57 vars */
24108 21:39:51 +++ exited with 0 +++
24116 21:39:51 +++ killed by SIGHUP +++
I think, the problem is that start-process-shell-command creates a "pty"
process. As soon as main command exits, all children, that belong to the
same terminal session created by emacs for the process, got killed.
Calling eog directly works because of it does not attempt to go to
background or demonize.
The solution could be (make-process :connection-type 'pipe ...).
Personally I would prefer to avoid shell as well when it is not really
I am surprised that in the discussion of problem related to desktop
integration and perhaps even order in which applications able to handle
particular file format were installed, nobody mentioned such details,
neither for "positive" nor for "negative" results. Probably output of
the following commands (for the proper mime type) could be relevant. The
complication is that there are several mime handler "databases".
grep image/png /etc/mailcap ~/.mailcap
xdg-mime query default image/png
For some handlers there might be even a race, sometimes it might work
but might fail as well, depending if child could send a message to its
server quickly enough. In such case providing of ECM might be a challenge.
next prev parent reply other threads:[~2021-01-18 17:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-13 7:49 [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file stardiviner
2020-06-13 14:51 ` Nicolas Goaziou
2020-06-14 9:08 ` stardiviner
2020-06-14 21:06 ` Nicolas Goaziou
2021-01-10 11:26 ` [BUG] [C-u C-u C-c C-o] open link with external program auto exited before child process " Christopher Miles
[not found] ` <87sg799gnx.fsf@numbchild>
2021-01-10 12:13 ` Christopher Miles
2020-09-05 7:52 ` [BUG] [C-u C-u C-c C-o] open link with external program invalid to " Bastien
2021-01-18 16:32 ` Maxim Nikulin [this message]
2021-01-19 1:53 ` Christopher Miles
2021-01-19 17:00 ` Maxim Nikulin
2021-01-20 3:21 ` Christopher Miles
2021-01-20 16:27 ` Maxim Nikulin
2021-01-21 0:58 ` [PATCH] " Christopher Miles
2021-01-21 17:12 ` Maxim Nikulin
2021-01-22 6:00 ` Christopher Miles
2021-03-10 14:55 ` Maxim Nikulin
2021-03-11 9:33 ` Christopher Miles
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:
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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 public inbox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).