How to Install Emacs on Raspberry Pi

I just got my Raspberry Pi up and running on Raspbian, and was finding nano, the pre-installed text editor a bit lacking.  I’ve been using Emacs since college, and decided to get it up and running on my Pi.  It turns out that it’s quite simple to install GNU Emacs:

$ sudo apt-get install emacs

If the above command fails and complains of missing packages, try

$ sudo apt-get upgrade

and then retry installing emacs (thanks to Tom Sargent for this tip).

Emacs users typically prefer their ctrl keys to reside where the Caps Lock key typically resides on most PC keyboards.  To swap the left Ctrl and Caps Lock keys, edit /etc/default/keyboard, and find the line XKBOPTIONS line.  If it’s currently empty, just replace it with

XKBOPTIONS=”ctrl:swapcaps”

if the line already has some other options in it, simply separate the options with a comma, e.g.:

XKBOPTIONS=”compose:rwin,ctrl:swapcaps”

To make the change effective, type:

$ sudo dpkg-reconfigure -phigh console-setup

They keyswap will persist across reboots, and works in both virtual text consoles, and X-windows.

There are 4 Comments to "How to Install Emacs on Raspberry Pi"

  • tom sargent says:

    I couldn’t get “apt-get install emacs” to work – it complained about missing packages. I finally got it to work by doing an apt-get upgrade first. No source that I could find mentioned doing this. It’s not unreasonable. Did you have to do an upgrade too, or did I miss something else. (I didn’t see the start-up instructions for the Pi mentioning doing an upgrade.)

    • lincomatic says:

      I don’t recall having to do an upgrade first, but it’s been a while, and I might have done it, and forgotten about it. I will update the instructions. Thank you.

  • DaveX says:

    Try tramp-mode to use a remote emacs to access your RPi:

    C-x C-f /192.168.102.60: …..

    but it’s nicer with ssh-agent, etc.,

    Then you can use your normal desktop/laptop emacs setup to work on remote file.

Write a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>