Hello, I am sick today and I am sorry but I have no idea how to submit a patch or anything... I am very new to development and git so please bare with me. I saw on the documentation for SXMO that support for other editors was coming later, and I wanted to contribute what I could.
Anyway, I found that changing line 63 in sxmo_modemtext.sh to emacsclient -c -q -u "$DRAFT"
worked out well. But it seems that maybe a check to see if emacsclient
is in $EDITOR could allow for this line to work better, as opposed to sxmo_terminal.sh "$EDITOR" "$DRAFT"
. Calling sxmo_terminal.sh emacsclient -c -q -u "$DRAFT"
leaves an empty terminal on the screen while emacsclient is open.
This is an interesting challenge, I think having a VISUAL_EDITOR environment variable (rather than using sxmo_terminal.sh $EDITOR) would be the simplest way to support gui editors. It's possible that using xdg-open could also achieve the same thing, I'm not sure which would be better.
I think that using EDITOR="sxmo_terminal.sh vim" and dropping hard coded sxmo_terminal.sh should be enough to allow non terminals to be used as EDITOR. I already patched sxmo to allow multi-word EDITOR so this should be very easy to do.
This patch should cover the need :
https://lists.sr.ht/~mil/sxmo-devel/patches/33665
You then
export EDITOR="emacsclient -c -q -u"
from ~/.profile or from ~/.config/sxmo/profile and you should be good !
Why not just make sxmo_terminal.sh a hook? That way you can customize it as you like. In fact, you could make every script a hook (including the script that calls the hooks) to enhance customizability since you can't know of all possible use cases.
Using this patch with vim, will open a new terminal when
$EDITOR
is called right? I think it is best to keepsxmo_terminal.sh $EDITOR
when the script wants to spawn a window. This allows the use$EDITOR
in scripts running in a terminal without extra windows opening.I think using the environment variable
VISUAL_EDITOR
is a better idea.
Does it make more sense to call
sxmo_open.sh
on the files and let that decide how to handle text files? (and set the default tosxmo_terminal.sh vim
or whatever the current default is)
Can we make a menu for this (e.g. default programs) and for text we would have several pre-installed (Emacs, Nano, Vim, and a simple GUI)?