GNU Emacs needs a virtual keyboard

~929 words. ~4 minutes.

tags: emacs

I mean this more generally as in everywhere GNU Emacs is available, but especially the recent Android port.

If you are like most people, you have probably had to edit text on a mobile phone. And then you must be aware of how the virtual keyboard is not just used for entering characters into the text area, but it in fact assists the user while editing the text, through auto completions, cursor movement through the keyboard, and so forth and so on.

Now I would guess most of you haven't tried GNU Emacs on Android for any extended amount of time, but from my time seriously using it on Android (for the past 3 months, mostly for Org-Agenda and friends). I can say that it is actually pretty useful(and able), and IMO is the best org client on Android. The trick to using it on Android is not disabling the GUI elements (like the menu-bar, tool-bar, and the likes), these elements are really useful and you can do many complex editing operations using them, you can even go further, by creating your own menu-bar items, tool-bar icons, etc.

Though, one could say this is generally true for Emacs, too many people ask beginners to disable the helpful menu-bar and tool-bar.

There is also an especially useful GUI element called the modifier-bar-mode,

Toggle display of the modifier bar.

When enabled, a small tool bar will be displayed next to the tool
bar containing items bound to
‘tool-bar-event-apply-control-modifier’ and its related commands,
which see.

This is a global minor mode.  If called interactively, toggle the
‘Modifier-Bar mode’ mode.  If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is ‘toggle’.  Enable the
mode if ARG is nil, omitted, or is a positive number.  Disable the mode
if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer,
evaluate ‘(default-value 'modifier-bar-mode)’.

The mode’s hook is called both when the mode is enabled and when it is
disabled.

(fn &optional ARG)

What it does is expose the Ctrl, Shift, Meta, Alt (Yes, they are different.), Super, and Hyper keys as buttons on this modifier-bar. This is very similar to what Termux does. And also very useful (though I still use the unexpected keyboard in conjunction with this).

The need for a full fledged keyboard is further demonstrated by this development. The Emacs virtual keyboard would be a natural extension of the idea.

Emacs' virtual keyboard could be made very dynamic, changing its keys/buttons according to the mode we are in. For example, when we are in Org-Mode, we could have specialized keys for it!


This is not something that has not been tried before, take a look at calc-keypad,

Invoke the Calculator in "visual keypad" mode.
This is most useful in the X window system.
In this mode, click on the Calc "buttons" using the left mouse button.
Or, position the cursor manually and do M-x calc-keypad-press.

(fn &optional INTERACTIVE)

This is how it looks currently,

----+----+--Calc---+----+----1
FLR |CEIL|RND |TRNC|CLN2|FLT |
----+----+----+----+----+----|
 LN |EXP |    |ABS |IDIV|MOD |
----+----+----+----+----+----|
SIN |COS |TAN |SQRT|y^x |1/x |
----+----+----+----+----+----|
  ENTER  |+/- |EEX |UNDO| <- |
-----+---+-+--+--+-+---++----|
 INV |  7  |  8  |  9  |  /  |
-----+-----+-----+-----+-----|
 HYP |  4  |  5  |  6  |  *  |
-----+-----+-----+-----+-----|
EXEC |  1  |  2  |  3  |  -  |
-----+-----+-----+-----+-----|
 OFF |  0  |  .  | PI  |  +  |
-----+-----+-----+-----+-----+

Here, they just look like regular text, but maybe using Emacs' buttons would look better, the task is making it standardized and easy to add, like how Org-Mode does its own ad hoc transient-like menus, but now with transient, it is easier to make such menus and all the menus look similar, so the same muscle memory is utilized in of all of these menus coming from different packages.

When Emacs has its own toolkit (some day I hope), the virtual keyboard would get even more powerful!


What if we also made it possible for Emacs to be used as the keyboard on Android, so that it is possible to edit texts using Emacs on any text area anywhere on the operating system? This would be analogous to emacs-everywhere or tinee on GNU/Linux systems, though would probably be better integrated with the rest of the operating system.


All these are just thoughts I have had for a while, that I finally decided to put on buffer. I don't have plans on working on this in the near future, but if someone else is interested I would love to see it being realized.

Author: tusharhero

emailreplace [at] with @, and put the domain for username, and vice versa: sdf.org [at] tusharhero

© tusharhero 2024-2025, check licenses page for details.

Date: 2025-10-27 Mon 19:14

Emacs 31.0.50 (Org mode 9.7.11)