I began use Fedora Silverblue.
I tried to start up doom emacs with emacs from flatpak
So i added
EMACS="/usr/bin/flatpak run org.gnu.emacs" into bin/doom
I think it can be done better.
Is it good/bad idea ?
I don't know anything about flatpak. Does it provide no way to set environment variables, or to modify the environment in which the contained app runs?
i mean that
":"; ( echo "$EMACS" | grep -q "term" ) && EMACS=emacs || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*-
":"; command -v $EMACS >/dev/null || { >&2 echo "Emacs isn't installed"; exit 1; }
shows Emacs isn't installed. It is correct. It is not in system.
By adding
EMACS="/usr/bin/flatpak run org.gnu.emacs" helped to install it and doom can be used with flatpack Emacs.
bin/doom info shows then
(path "/app/bin" "/usr/bin" "/app/libexec/emacs/26.2/x86_64-pc-linux-gnu"))
So i post it here for anybody who may be interested. But i am pretty sure, it can be done in some better way and not hardcoded.
Yeah flatpak is awesome
~/.emacs.d/bin/doom install
Can't find emacs in your PATH
Add
EMACS="/usr/bin/flatpak run org.gnu.emacs" into ~/.emacs.d/bin/doom on second line.
It is ugly, but working change. I do not know how to detect emacs in flatpak without hardcoded if else block.
Can you clarify what you did. I saw the EMACS=emacs and replaced it with the flatpak text. Did you just replace that part or is that the only line?
#!/usr/bin/env sh
:; ( echo "$EMACS" | grep -q "term" ) && **EMACS="/usr/bin/flatpak run org.gnu.emacs"** || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*-
Is there no way to bake environment variables into a flatpak'ed app?
How about creating an shim in /usr/local/bin/emacs (or /usr/bin/emacs) containing the following?
#!/usr/bin/env bash
/usr/bin/flatpak run org.gnu.emacs "$@"
What about
if /usr/bin/flatpak info org.gnu.emacs; then EMACS="/usr/bin/flatpak run org.gnu.emacs" ; fi
?
Can you clarify what you did. I saw the EMACS=emacs and replaced it with the flatpak text. Did you just replace that part or is that the only line?
Added one line, because it is for me only, and i am not able to propose proper solution.
Here is my modified doom script .
1 │ #!/usr/bin/env sh
2 + │ ":"; EMACS="/usr/bin/flatpak run org.gnu.emacs"
3 │ ":"; ( echo "$EMACS" | grep -q "term" ) && EMACS=emacs || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*-
Another alternative:
# add to your shell config (.zshrc or .bashrc)
export EMACS="/usr/bin/flatpak run org.gnu.emacs"
Most helpful comment
Another alternative: