Comment by spit2wind

3 days 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!