3

How can I make Emacs function 'browse-url-at-point work on a tablet running Android?

Following advice I found at "http://endlessparentheses.com/running-emacs-on-android.html" I installed 'Termux and 'Hacker's keyboard on my Android tablet, started 'Termux and ran:

apt update
apt install emacs

I then started emacs. In the Emacs scratch buffer I wrote "http://www.google.com" and invoked 'browse-url-at-point. It said "No usable browser found".

I did some investigating of this subject on the Internet, but so far have found nothing helpful.

The table is a HP Touchpad running Android 5.1.1 via CyanogenMod version "12.1-20160109-SNAPSOT-jcsullins-tenderloin.

Added after reading the comment by Jack, and further investigation:

For a while I thought that turning on root access on my HP Touchpad (running CyogenMod Android 12) and using command "su" was necessary, but someone referred me to "termux-open-url" and its source code suggested to me to add "--user 0" to what Jack suggested. My first test was to run the command

am start --user 0 -a android.intent.action.VIEW -d http://www.google.com

in the Termux terminal window. That worked. I then started up Emacs inside Termux and issued the same command inside the shell buffer. That also worked.

2 Answers 2

2

Based on this adding something like this to your config should work:

(advice-add 'browse-url-default-browser :override
            (lambda (url &rest args)
              (start-process-shell-command "open-url" nil (concat "am start -a android.intent.action.VIEW -d " url))))
1
  • A revision of my question explains that adding "--user 0" to the command that Jack suggests is a way of avoiding having to enable root access and use of command "su"--as I had earlier thought. Sep 7, 2016 at 19:50
1
 (setq browse-url-browser-function 'browse-url-xdg-open)

seems to make things open up in the right browser for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.