Surprisingly, Emacs on Android is pretty good

254 pointsposted a month ago
by harryday

25 Comments

rrix2

a month ago

Specifically for org, and specifically for org-roam, it's pretty good, but not good enough. It's not as good as desktop emacs, and it's also somehow not as good as a 1st class android app.

the fdroid build of emacs doesn't really work very well with my org-roam, so i use a termux build,,, well nix-on-droid+emacs-overlay... and it's fine, for capture and recall. but i'm not authoring a lot of text with it. a custom extra-keys in the termux config so that your common emacs keybindings are on screen in a tool bar can get you close to a point-and-click interface... but you don't really have a good "swipe" input or voice input to input text efficiently, it's a character interface, a TUI, which is actually not what you want on a phone, you want a word-based interface. so when i want to do org-mode right now, i pull a unihertz titan 2 out of my pocket. without a sim card, the titan battery lasts for about three days unless i fire up an nix devShell & lsp server on it.

calc-mode is my default android calculator tho.

tbh don't listen to me, though: i've been teaching myself 8vim[1] and building a markdown document graph database in my free time. don't listen to ~any emacs user's opinion with any authority, we all have found our own local minima, our opinions and advice usually aren't so useful to each other

I didn't know about modified-bar-mode, though, that's neat.

[1] https://f-droid.org/packages/inc.flide.vi8/

devinprater

a month ago

> Moments like these are truly a testament to Emacs' dedication to an accessible editor.

Ah, accessible. Word with a different meanings, and for me, in this sense, it's not helpful at all. Fortunately I managed to get Emacs talking with Speechd-el in Termux. Speechd-el is a poor man's Emacspeak. But it does seem to work. Well besides pressing SPC doesn't read the new text that scrolled onscreen, but if I have to, I can hook it.

rmunn

a month ago

What's the experience like pressing Ctrl+Shift+Meta+key shortcuts with those virtual keyboard apps? I assume they turn Ctrl, Shift, etc. into toggles so that you tap Ctrl, tap Shift, tap Meta, tap the shortcut key. But that's still four taps. (I know many of Emacs's commands have fewer modifiers than that, but I don't know which ones since even on a full keyboard I prefer the Vim control scheme so I never learned Emacs in much depth at all). Is that annoying, or is it easy enough to do that the annoyance fades into the background?

Also, is there a preconfigured config for Android that can be downloaded so that you don't have to spend too much time in the Customize mode to get started? (I'm assuming, though the article didn't go into detail, that much of the reason for spending time in Customize would be to remap some of those shortcuts to be easier to type on a virtual keyboard, e.g. fewer modifiers).

timonoko

a month ago

Ultimate .emacs on termux, note python-hook

  (menu-bar-mode -1)
  (setq inhibit-splash-screen t)
  (setq inhibit-startup-echo-area-message t)
  (global-set-key "å" 'hippie-expand)
  (global-set-key "∆" 'toggle-truncate-lines)
  (global-set-key (kbd "<f12>") 'toggle-truncate-lines)
  (xterm-mouse-mode 1)
  (global-set-key (kbd "<mouse-5>") 'scroll-up-command)
  (global-set-key (kbd "<mouse-4>") 'scroll-down-command) ;
  (global-set-key (kbd "<wheel-up>") 'scroll-up-command)
  (global-set-key (kbd "<wheel-down>") 'scroll-down-command) ;
  (setq case-fold-search t)
  (setq-default truncate-lines t)
  (setq sort-fold-case t)
  (autoload 'scad-mode "scad-mode" "A major mode for editing OpenSCAD code." t)
  (add-to-list 'auto-mode-alist '("\\.scad$" . scad-mode))
  (require 'scad-preview)
  (global-set-key (kbd "Å") 'dabbrev-expand)
  
  (add-hook 'python-mode-hook 'whitespace-mode)
  (setq whitespace-line-column 128)
  (custom-set-faces
   '(default ((t (:background "#000000" :foreground "#ffffff"))))
   '(whitespace-space ((t (:background "black" :foreground "blue"))))
   '(whitespace-tab ((t (:background "black" :foreground "blue"))))
   '(whitespace-newline ((t (:background "black" :foreground "blue"))))
   '(whitespace-empty ((t (:background "black" :foreground "grey50")))))

zingar

a month ago

Caveat: all this is on iOS:

The only reason I want emacs on my phone is the one thing I don’t have: I want my org notes to be on both desktop and mobile. But syncing files across both has been dreadful, even in paid apps: duplicates everywhere and I constantly have to rechoose the files in a file finder UI. So my reminders are not just ever present for the time when they’re relevant, they’re just “not there” unless I take a lot of manual steps (if I’m lucky only) once a day.

sroerick

a month ago

I'm a little embarrassed by my current workflow, which is:

A. Emacs and org mode on my laptop

B. Neovim to do development via SSH on my dedicated Hetzner box, because my laptop is too potato for dev

C. A bash script to push up any random notes I have up to the server

I have used sshfs, syncthing and unison in the past, but never quite got the workflow for either to click.

After about 13 years of trying I still am not as functional as most Dropbox users. I just can't stand Dropbox.

PopePompus

a month ago

There is a third option (in addition to the native app and Termux) to get emacs running. The recently added (to at least Pixel phones) "Terminal" app runs a standard Debian distribution inside a VM. emacs can be installed there in exactly the same way it would be on any other Debian machine.

deng

a month ago

The nice thing is that Emacs 30.1 now has much better support for touchscreen events. It will take some time for packages to make use of that, but at least it is now possible. For instance, you should now be able to increase/decrease text size by pinching.

sasaf5

a month ago

I have been using Emacs+git on termux on an Android phone for more than 5 years.

I don't even use a third party software-keyboard, I just use termux's special key bar. To set it up, add the following to ~/.termux/termux.properties

  extra-keys = [['TAB','CTRL','ALT','ESC','HOME','END','LEFT','UP','DOWN','RIGHT']]
This has been enough for using org mode in everyday life tasks, and I don't need to keep swapping keyboards.

timonoko

a month ago

@grok solved the termux being too dark problem:

In .bashrc:

  # Full brightness on entry
  termux-brightness 255
  
  # Auto-brightness based on light sensor on exit 
  LIGHT_VALUE=$(termux-sensor -s stk3a5x_als -n 1 | jq '.. | .values? | select(. != null) | .[0]')
  if [ -n "$LIGHT_VALUE" ]; then
      if (( $(echo "$LIGHT_VALUE > 1000" | bc -l) )); then
   trap 'termux-brightness auto' exit
      else
   trap 'termux-brightness 50' exit
      fi
  fi

akshatjiwan

a month ago

I was quite surprised too to learn how well terminal apps work on Android. Termux is amazing.

zelphirkalt

a month ago

I tried installing Emacs on Android and then realized: How on earth am I even gonna input all the special key combos that I use for things in Emacs?

I figure it is impossible, without a special keyboard installed and even then it gets cumbersome to quickly input something like C-x C-s for saving a file. I am not motivated enough, to come up with a whole different shortcut system, just for rare if ever Emacs on phone use.

anthk

a month ago

GNUs under Emacs it's the only FOSS Usenet client out there for Android.

iib

a month ago

For small edits, has anybody configured a leader-key scheme? Something like Doom Emacs has with space as a leader.

It seems to me to be the best possible configuration for Emacs on Android (on a phone) and I was wondering if I should invest time in such a solution.

strokes-mode.el would also be very nice, but apparently it doesn't have touchscreen support.

s20n

a month ago

I've been using Emacs 30 on my android tablet for a few months now with a bluetooth keyboard. Needless to say, you can't really leverage eglot so it's basically a no-go for any meaningful software development. I've been using it for org-mode and it is fantastic for that.

a-dub

a month ago

termux is actually a pretty good little linux distro. i still keep wondering if the vm/container thing they shipped in recent versions of android for pixel will subsume it.

i was really hoping that with the display port over usb-c out that appeared in pixel 9 that there would be a useful desktop that could potentially support laptop replacement, but it seems all the desktop mode, termux and termux with x over vnc (or whatever it is) seem not quite mature. could be cool though, although, maybe better if there were a wireless link for the display and a way to have it not interfere with the phone being a phone.

krupan

a month ago

I've been using emacs in terminal mode inside termux for a few years and it's not bad. Full GUI emacs would be nice, I'll have to give this a try

procaryote

a month ago

I do termux and emacs on android because a bunch of small use cases are easier to do that way than navigate the app store

spit2wind

a month ago

My computer died a few months ago and Emacs on Android has carried me through well. Still able to do development on the go. Amazing, amazing work by the Emacs dev!

The Unexpected Keyboard is a great addition, but even with the stock Android keyboard, it's totally usable. Of course, it helps to add things to menus and remap the volume keys.

You can add buttons to the toolbar with something like:

  (tool-bar-add-item "spell"
                   'eval-last-sexp
                   'eval-last-sexp
                   :help "Eval last sexp")

  (tool-bar-add-item "back-arrow"
                   'xref-pop-marker-stack
                   'xref-pop-marker-stack
                   :help "Previous Definition")

  (tool-bar-add-item "fwd-arrow"
                   'xref-find-definitions
                   'xref-find-definitions
                   :help "Find Definitions")
There are many icons bundled with Emacs that you can reuse: https://cgit.git.savannah.gnu.org/cgit/emacs.git/tree/etc/im...

You can remove toolbar buttons:

  (tool-bar-add-item-from-menu 'find-file "")
Otherwise, you can add to menus:

  (define-key global-map
            [menu-bar edit expand]
            '("Expand word" . dabbrev-expand))
Remapping the volume keys is super handy, especially when you change the behavior by mode or buffer:

  (global-set-key (kbd "<volume-down>") 'fill-paragraph)

  (global-set-key (kbd "<volume-up>") 'my-runner)

  (defun my-runner ()
  (interactive)
  (cond ((equal major-mode 'org-mode)
         (call-interactively (local-key-binding (kbd "C-c C-c"))))
        ((equal major-mode 'emacs-lisp-mode)
         (save-buffer)
         (call-interactively 'eval-defun))
        ((string= (my-get-file-name)
                  "/data/data/org.gnu.emacs/files/.emacs.d/my_python_file.py")
         (save-buffer)
         (with-current-buffer (shell "*shell*")
           (my-send-string
            "python /data/data/org.gnu.emacs/files/.emacs.d/my_python_file.py"
            t
            "*shell*")
         ))
        (t
         (message "Undefined action"))
        ))
Redefining the fill column is handy to set appropriate text wrapping:

C-x f runs the command set-fill-column

Otherwise, the menu for Lime Wrapping in this buffer is super helpful.

I set my init to load up Dired so that I'm met with my project directory and am ready to go.

It's hard for me to think of another editor having my back like Emacs has. Again, amazing work by the community!

jamesfisher

a month ago

F-Droid website is awful for a curious visitor. Serves me a .apk with no further instructions. What am I supposed to do with that?

greggh

a month ago

(Travels back to the 90s)

Pretty good for Emacs*

Long live VI.

zeeeeeebo

a month ago

Now I want to see how it performs in android 16 desktop mode

SanjayMehta

a month ago

Well duh, I first used emacs on a lowly 386 running a variant of unix.

Today's SOCs are much more powerful.