Giter Site home page Giter Site logo

Comments (4)

ndwarshuis avatar ndwarshuis commented on July 20, 2024

Feel free to open a PR for this ;) I haven't had the bandwidth to focus much on this in the past month or so. This actually might be super easy to solve just by taking the "/usr/bin/" part off the string since those eventually go to call-process which accepts executable names and performs the lookup in PATH (which at some point I apparently forgot).

Also, what is your setup? I'm not familiar at all with running emacs on Android. If it isn't super convoluted it would be good to add the environment you are using to the testing suite.

from org-sql.

jarofromel avatar jarofromel commented on July 20, 2024

Well, just taking the "/usr/bin/" is not enough (my wild guess is somewhere in this part, the path is expected).
This works:
(defconst org-sql--sqlite-exe (executable-find "sqlite3"))

However, somewhat similar error shows after that:

f--write-bytes: Opening output file: No such file or directory, /tmp/org-sql-cmd-1605289747

Again, the hard-coded path is the origin. In this case I am not sure if there is some generic definition of a temporary directory (it is %TMP% in Windows, but on *nix? )?

Regarding the setup where I found the error, Termux is an app from Playstore/F-droid. After the install you have at your disposal the command line environment (package manager based on apt, common packages etc.). I just installed emacs (it is one of the many available packages), synced my (doom-)emacs config (over syncthing) to Android and symlinked it to the Termux file hierarchy - all of this over the SSH (you can run sshd in Termux, so your phone is another device you can control from your main computer). I had low expectation before, but the it works almost flawlessly.
In spite of all the above, I think it comes the category "convoluted". I use it infrequently, just to check my org-mode notes when I don't have an laptop around.

from org-sql.

ndwarshuis avatar ndwarshuis commented on July 20, 2024

Well, just taking the "/usr/bin/" is not enough (my wild guess is somewhere in this part, the path is expected).
This works: (defconst org-sql--sqlite-exe (executable-find "sqlite3"))

Interesting. So in your case call-process must be searching in the wrong PATH or an incomplete PATH. The reason why I thought the simple string change would work is because (org-sql--run-command "md5sum" "/bin/emacs") will return the MD5 of the emacs binary when I run it on my desktop (md5sum is used elsewhere in the code), so it knows the "md5sum" is a valid command and is able to find it. Because of this, what you have with executable-find is likely the best solution, but it will also be required for md5sum, pgsql, createdb, and dropdb (although the last three would only throw an error if you were trying to sync to a postgres database).

However, somewhat similar error shows after that

f--write-bytes: Opening output file: No such file or directory, /tmp/org-sql-cmd-1605289747

This is a bit surprising, since I would think the temp directory would also be the same on android as linux (which is just "/tmp"). What is the value of temporary-file-directory (this is an emacs variable)? I also realized looking at this again that my code actually duplicates some emacs built-in functions (eg make-temp-file), so long term it should be rewritten in terms of those.

In spite of all the above, I think it comes the category "convoluted". I use it infrequently, just to check my org-mode notes when I don't have an laptop around.

It might seem "convoluted" but I'm sure others would appreciate more ways to use emacs on mobile, particularly with org-mode. Setting up the testing environment is probably be an entirely separate issue which would require a docker image with the termux environment and emacs/org-sql installed on top of it, and then all that put in the github action workflow (I'm not yet sure exactly how to do that, although there is a termux docker image).

The things you noted above would likely allow it to work without the testing environment though, but adding the environment would allow the README to say "supported on Termux/Android" ;)

from org-sql.

jarofromel avatar jarofromel commented on July 20, 2024

Well, just taking the "/usr/bin/" is not enough (my wild guess is somewhere in this part, the path is expected).
This works: (defconst org-sql--sqlite-exe (executable-find "sqlite3"))

Interesting. So in your case call-process must be searching in the wrong PATH or an incomplete PATH......

I was wrong and you right, taking the "/usr/bin" is enough (I probably didn't reload emacs config when I evaluated that).

However, somewhat similar error shows after that
f--write-bytes: Opening output file: No such file or directory, /tmp/org-sql-cmd-1605289747

This is a bit surprising, since I would think the temp directory would also be the same on android as linux (which is just "/tmp"). What is the value of temporary-file-directory (this is an emacs variable)?

I see, this can solve it. The value of temporary-file-directory is "$PREFIX/usr/tmp" where $PREFIX is '/data/data/com.termux/files' - this is the place where termux emulates the file hierarchy (because the real file hierarchy on which is Android build is blocked to access by apps - https://wiki.termux.com/wiki/Differences_from_Linux)

In spite of all the above, I think it comes the category "convoluted". I use it infrequently, just to check my org-mode notes when I don't have an laptop around.

It might seem "convoluted" but I'm sure others would appreciate more ways to use emacs on mobile, particularly with org-mode....

Sounds fair, I'll keep it in my mind, because there are serious issues with Termux and new Android versions (10, 11) which limits usability of Termux on Android - so work on setting the test environment could be useless (https://github.com/termux/termux-packages/wiki/Termux-and-Android-10 and termux/termux-app#1072)

I'll send PR dealing with 1) and 2) in the mean time.

from org-sql.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.