I have some tasks that I like to do using Emacs in several different operating systems.
I have been using Termux to access these tasks on my Android phone.
To reduce the configuration by writing to the file editing part of this workflow, I installed Termux: Widget and wrote a two-line widget script that did
Filename = $ (a bit of shell logic) emacs $ file name
So now my phone has a button on the home screen that I can press and open the file I want in the editor. That part all works well.
Often, once I started editing, it is convenient to run a shell script. It is good to be able to run the shell script in an Emacs buffer in order to use the regular buffer change commands to interact with it. If I open a new session of Termux and write
emacs to order, then I can do
M-x async-shell-command, use relative file names and tab completion to find the name of the script that I want (for example,
../my-script.sh), and run it from within Emacs. That part works well.
However, if I started Emacs from Termux: Widget, Emacs can not generate threads. I get errors like
/data/data/com.termux/files/usr/bin/sh: 1: ../my-script.sh: not found /data/data/com.termux/files/usr/bin/sh: 1: /data/data/com.termux/files/home/whatever/my-script.sh: not found
I think the relative and absolute path names are correct because I am using the complete tabulation to verify them before asking to execute.
This seems to be the kind of problem that the termux-exec was invented to solve. However, it does not work by magic, and I am confused by the documentation.