Open posita opened 2 years ago
Somewhat answering my own question: flatpak enter org.gnu.emacs flatpak-spawn emacsclient …
kind of works (at least intermittently), but this (or whatever is the preferred method) should probably be documented.
One oddity is that relative paths will be interpreted relative to the container's default directory which can be really confusing. This (from the host) will not work as expected:
% cd ~/some/directory
% flatpak enter org.gnu.emacs flatpak-spawn emacsclient ./some/file # will try to open ~/some/file, not ~/some/directory/some/file
Okay, I think I found a solution to the directory issue, but this is not intuitive:
% flatpak enter org.gnu.emacs flatpak-spawn --directory="${PWD}" emacsclient -- …
This assumes that the host directory is mounted at the same location in the container. Note the --
is necessary to ensure that emacsclient
receives all arguments thereafter. This is also not documented (at least not in the man pages) and was a lucky guess on my part.
% flatpak enter org.gnu.emacs flatpak-spawn --directory="${PWD}" emacsclient --help
error: No such pid org.gnu.emacs
% flatpak enter org.gnu.emacs flatpak-spawn --directory="${PWD}" emacsclient -- .
Waiting for Emacs...
Nope. The --
is a red herring. This is really weird:
% emacsclient --help
Usage: emacsclient [OPTIONS] FILE...
…
% emacsclient --help
error: No such pid org.gnu.emacs
% emacsclient --help
error: No such pid org.gnu.emacs
% emacsclient --help
error: No such pid org.gnu.emacs
% emacsclient .
Waiting for Emacs...
These look like intermittent failures? :confused:
In other environments, I would normally fire up Emacs and then interact with it calling
emacsclient
directly from the command line (e.g.,emacsclient /some/path/some/file
). However it is not obvious how to do this when Emacs is running viaflatpak
. It would be nice if this was documented.After reading https://www.reddit.com/r/flatpak/comments/w4aoih/launch_application_emacsclient_from_within_a/, I came up with something like
flatpak enter org.gnu.emacs flatpak-spawn --host emacsclient …
, but that seems somewhat absurd and results in the following error: