UEmacs/PK

Revision as of 13:21, 13 August 2019 by Mhan (talk | contribs) (utilize testedon template)

uEmacs/PK is the editor of choice for Linus Torvalds. His updates are available at uEmacs/PK Git repo site. Linus' latest post on it can be found here.

Frankly, it's a minimalist's text editor with very little eye-candies, such as syntax highlighting and other visual aids. A simple help text is available. Basic Emacs-compatible key bindings seems to be in effect, but use it at your own risk. If you zealously follow Linux kernel coding style and worship Linus in general like many others, this may just be your dream editor since you'd be vicariously living the experience of how Linus spent a significant portion of his programmer life.

Note this part of his commit message from 2/22/2013.

... I really should just learn another editor, rather than continue to polish this turd.

  • Last tested on Ubuntu 12.04.4 Precise, uEmacs v4.0.15 (2013-02-22)
  • Difficulty: 2/10
  • Time: less than 2 minutes
  • Version: 4.0.15


Compiling

When I first ran make on the source, it resulted in the following after many warning messages:

  CC       tcap.o
tcap.c:16:20: fatal error: curses.h: No such file or directory
compilation terminated.
make: *** [tcap.o] Error 1

You need to install ncurses-dev virtual package for that curses.h file. I don't think ncurses-bin or ncurses-base packages are needed, and they're usually installed already if you've installed a package that depends on those. This is also called ncurses-devel on RHEL, Fedora, or CentOS Linux and other RH-derived, or RPM-based distributions.

$ sudo aptitude install ncurses-dev

Run the make again and it should result in a successful compilation with an executable file called em.

mhan@brahms:~/src/uemacs$ make
  CC       tcap.o
  CC       termio.o
  CC       vmsvt.o
  CC       vt52.o
  CC       window.o
  CC       word.o
  CC       names.o
  CC       globals.o
  CC       version.o
  CC       usage.o
  CC       wrapper.o
  CC       utf8.o
  LINK     em
mhan@brahms:~/src/uemacs$

If you plan on using it indefinitely you may want to either execute sudo make install, or move it to your ~/bin/ or /usr/local/bin/. Copy over emacs.* (.ps, .rc, .hlp) over to the same target location.

Default Keybindings

If you have the help file in the correct location you should be able to browse through it for these. You can also figure it out from bind.c source file. This list may still be a work-in-progress, so please feel free to add to this by pinging me via this site. I normally respond very quickly.

Application

Esc ? Help text

Ctrl x d Suspend uEmacs/PK into the background. Run fg 1 to return, and then press Esc Enter Ctrl l.

Ctrl x + c quit (while holding onto Ctrl type X and then C, this is usually referred to as separate Ctrl sequence of keys as in Ctrl x Ctrl c)

Alt z Save all and quick exit

Ctrl g Abort a command in progress

File operations

Ctrl x + f Find file

Ctrl x + v View file

Ctrl x + d Save

Ctrl x + w Write as

Ctrl x + i Insert file

Ctrl x n Change file name. Saving immediately after this command doesn't save the file for some reason. You have to make some changes first and then save the file. If you want to change the file name and save at the same time use Ctrl x + w.

Editing

Ctrl m Newline

Ctrl j Newline and indent

Alt u Capitalize (to the end of current word)

Ctrl u [Enter a number] [whatever key you want to repeat] repeat a key

Ctrl k Cut line from cursor to the end of line (stored in clipboard)

Ctrl y Paste from clipboard

Ctrl d Delete a character forward

Alt d Delete a word

Ctrl o Insert a newline forward

Ctrl i Insert a tab

Ctrl c Insert a space forward

Ctrl t Swap with a character in front

Navigating

[cursor keys] Move around

Ctrl f Char forward

Ctrl b Char backward

Alt f Word forward

Alt b Word backward

Ctrl a Beginning of line (this will not work if you're using a session manager or a multiplexer that binds Ctrl a already (i.e. Screen or Byobu))

Ctrl e End of line

Ctrl p Previous line

Ctrl n Next line

Ctrl + Alt f Go to the matching bracket

Alt g Go to line

Alt p Previous paragraph

Alt n Next paragraph

Ctrl z Previous half page

Ctrl v Next half page

Alt + Shift , or Alt < Beginning of file

Alt + Shift . or Alt > End of file

Ctrl + x n Move the viewing screen down by one line

Ctrl + x p Move the viewing screen up by one line

Searching

Ctrl x s case-insensitive search

Viewing

Ctrl x + v Open a file in viewing mode

Ctrl l Clear and redraw

Modes

Ctrl x m Add mode

Ctrl x + m Delete mode

Alt m Add global mode

Ctrl + Alt m Delete global mode

Available modes

OVER Overwrite, don't insert

WRAP Automatic carriage return

VIEW View only, don't change

CMODE C program indenting

EXACT Match case in search

MAGIC Match patterns in search

^ $ Beginning and end of line

. Any character

\c Character c

c* Any number of character c

[ ] Character class

Miscellaneous

Ctrl + Alt k brings up unbind-key @todo

Alt x seems to be a command mode(?) similar to Esc in Vim