Running Doom Emacs on Android
Do you use org-mode for all your notes and are also unhappy with the lack of a nice android app to view and edit them in? Luckily someone else made a blog post1 detailing how one could install doom emacs on android.
Without it, I certainly would not have managed to do it myself.
Even though it is a bit dated it still worked mostly. Which is why I will focus more on the part after the bare setup - making emacs more usable on a phone.
Making it work
There were a few things which I had to do differently to get it working.
In the post there is a link2 to the required custom apks. However those were not working for android 16. Maybe you get lucky and they are fixed now but I found these3 to be working instead.
On the sourceforge page2 you can find a pretty extensive FAQ that is quite helpful. Without it I probably would not have been able to fix evil (or at least not that fast).
In section 10. I found a fix for my problem. Just put the following in your android specific section of your config:
;; fix evil
(setq overriding-text-conversion-style 'nil)
Making it (more) usable
Keyboard
Since emacs is keyboard driven and utilizes special keys which are not on most android keyboards I would highly recommend Unexpected Keyboard4.
It takes a bit to get used to it, but it is absolutely worth it because of one key feature: custom layouts. There even is a website5 where you can very easily create your own layouts. But best of all it supports sending key sequences from one key press.
I use it for shortcuts like M-x or C-c.
Below is the layout I am using and if you would like to use it you can find it here.
To import a custom layout first tap on the layout you are currently using in the settings or add another layout. Either way, scroll down to the bottom were the custom layout option is “hidden”.
After that just paste in the layout text and you are done.
UX improvements
I would highly recommend using touchpad-scroll-mode6.
With this package scrolling feels sooo much smoother and intuitive since it implements momentum based scrolling.
Personally I use it in combination with ultra-scroll7 but using the built-in pixel-scroll-precision-mode should suffice.
These are my settings:
(setq touch-screen-precision-scroll 1)
(setq touchpad-ultra-scroll t)
(setq touchpad-frame-rate 120)
(setq touchpad-momentum-decay 0.95)
What I would also recommend is to always display the on-screen keyboard when clicking on the buffer. Otherwise you might end up stuck.
(setq touch-screen-display-keyboard 1)
Using dired on a screen with little horizontal space is quite frustrating because the file details located on the left side take up most if not all space.
Theoretically there is a way to disable those details, but I could not get it to work no matter what I tried.
This is why I am using dirvish with the following settings:
(setq dirvish-default-layout '(0 1 0))
You can also remap the volume buttons which I find quite handy for switching between buffers.
(map! :n "<volume-up>" #'next-buffer)
(map! :n "<volume-down>" #'previous-buffer)
fixing latex previews
It took quite a while for me to fix latex previews which is why there might be some steps missing.
First of all you will obviously have to install latex. The termux wiki has a good page for that.
After installing all the gazillion tex packages test whether emacs knows about latex. To test this open an eshell and type latex.
If latex is not found, add your texlive installation to exec-path.
(add-to-list 'exec-path "/data/data/com.termux/files/usr/bin/texlive")
For me, it still wasn’t working at this point and it kept saying “Please adjust ‘dvipng’ of ‘org-preview-latex-process-alist’.”
Which I did (and also switched to dvisvgm but that for another reason):8
(let ((svg (cdr (assoc 'dvisvgm org-preview-latex-process-alist))))
(plist-put svg :latex-compiler
'("latex -interaction nonstopmode -output-directory %o %F"))
(plist-put svg :image-converter
'("dvisvgm %F --no-fonts --exact-bbox --scale=%S --output=%O"))
)
The only modification to the default values is using %F, the absolute path, instead of %f, the relative path. It did not fix the problem but might be useful to someone.
Whilst trying to manually convert the .tex files to .dvi and then to .png I discoverd that emacs could not find some files but termux could. This lead to me trying to symlink the necessary directories to the right places which ended up not working.
The real problem was that in termux some environment variables were set (TEXMFLOCAL and TEXMFROOT) but not in emacs.
The following fixes that:
(setenv "TEXMFLOCAL" "/data/data/com.termux/files/usr/share/texlive/texmf-local" )
(setenv "TEXMFROOT" "/data/data/com.termux/files/usr/share/texlive/2026")
After that latex previews were working but they were wayyyy too small.
To fix that i switched to dvisvgm and increased the scale.
(after! org
(when (string-equal system-type "android")
;;relevant part
(setq org-format-latex-options
(plist-put org-format-latex-options :scale 20.0))
)
)
It is still not perfect
With all these changes emacs becomes much more pleasant to use. But there is most certainly room for improvement.
The scrolling for example is still not quite as nice as in native apps.
And as I discovered, resizing of windows with touchpad-scroll-mode enabled is not possible via touch.
Also the startup time can be a bit annoying. Which might be a good opportunity to optimzie your config. But even then it will probably still take around 1 second.
As a workaround I keep emacs running in the background, which works if at least one buffer is open and battery optimisations are disabled. This way there is no delay when opening emacs.