Archives For Emacs

GNU Emacs text editor released version 29.1 few days ago. Here’s how to install it in current Ubuntu releases.

According to the release note. Emacs 29.1 features:

  • Supports “pure GTK” (PGTK) build
  • Uses XInput 2 on X for input events
  • Uses tree-sitter parsers for several programming modes
  • Includes LSP client called Eglot
  • Includes the use-package package
  • Can access SQLite databases using sqlite3 library
  • Can display WebP images using libwebp library
  • Faster editing of files with very long lines
  • Better support for drag-and-drop on X
  • Pixel-precise scrolling with touchpad support
  • Enhanced support for editing and displaying Emoji
  • Support for Unicode 15.0 and many new scripts
  • Many enhancements of help and completion commands
  • Numerous enhancements to Image Dired
  • Double-buffering on MS-Windows

How to install Emacs 29.1 in Ubuntu:

GNU Emacs editor is easy to install in Ubuntu Linux with few different ways. Choose any one that you prefer!

Option 1: Snap package

For Ubuntu 20.04, Ubuntu 22.04 and higher, simply launch Ubuntu Software, then search and install GNU Emacs from Snap Store. Though, it’s a Snap package runs in sandbox.

Option 2: Ubuntu PPA

For those prefer the classic .deb package format, Debian upstream has built the new release package. And, I backported it into this PPA with support for for Ubuntu 22.04, Ubuntu 20.04 and Ubuntu 23.04.

NOTE: The PPA package is just no-change backport without testing! It may or may not work in your case!

First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:ubuntuhandbook1/emacs

Type user password (no asterisk feedback) when it asks and hit Enter to continue.

Then, either open Software Updater (Update Manager) to upgrade the package if an old version was installed.

Or, run the command below instead to install/update the Emacs package:

sudo apt install emacs emacs-common

Linux Mint user needs to run sudo apt update first to manually refresh package cache.

Option 3: Flatpak package

Emacs is also available to install as Flatpak package. Though, at the moment of writing, the package is still at v28.2. Check it HERE.

Uninstall Emacs 29.1

For the snap package, also use Ubuntu Software to remove it. Or, run command in terminal:

sudo snap remove --purge emacs

For the package installed from Ubuntu PPA, open terminal (Ctrl+Alt+T) and run command:

  • purge the PPA as well as downgrade Emacs to stock version:
    sudo apt install ppa-purge && sudo ppa-purge ppa:ubuntuhandbook1/emacs
  • Or, simply remove Emacs by running command:
    sudo apt remove --autoremove emacs emacs-common

    As well, remove the PPA either from “Software & Updates -> Other Software” or by running command:

    sudo add-apt-repository --remove ppa:ubuntuhandbook1/emacs

GNU Emacs text editor 27.2 was released as a new maintenance release.

Emacs 27.2 is a bug-fix release with no new features. According to the changelog, it changed the behavior of the user option ‘resize-mini-frames‘. If set to a non-nil value which isn’t a function, resize the mini frame using the new function ‘fit-mini-frame-to-buffer’ which won’t skip leading or trailing empty lines of the buffer.

Emacs now ignores modifier keys when IME input is used. By default, pressing Ctrl, Shift, and Alt keys while using IME input will no longer apply the modifiers to the produced characters, as there are IMEs which use keys with modifiers to input some characters. Customize the variable ‘w32-ignore-modifiers-on-IME-input’ to nil to get back the old behavior.

And the user option ‘tramp-completion-reread-directory-timeout’ is now obsolete.

How to Install Gnu Emacs in Ubuntu:

For those prefer the classic apt repository, keep an eye on the Kevin Kelley’s PPA, though it’s not been updated at the moment of writing.

For those do not like Flatpak and Snap packages, here’s also a step by step guide building Emacs from source tarball.

Emacs is also available as the containerized Snap package, which is however at version 27.1 at the moment.

The community maintained Flatpak package has built Emacs 27.2 for Linux users. Ubuntu 20.04 and higher users can open terminal and run following commands one by one to install it:

  • Install flatpak framework if you don’t have it:
    sudo apt install flatpak

  • Add flathub repository which hosts the flatpak packages:
    flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

  • Finally install Emacs flatpak package:
    flatpak install flathub org.gnu.emacs

(Optional) To remove the flatpak package, simply run command in terminal:

flatpak uninstall org.gnu.emacs

GNU Emacs text editor 26.3 was released last night. Here’s how to install it in Ubuntu 18.04 and higher.

Emacs 26.3 is a maintenance release contains following changes:

  • New GPG key for GNU ELPA package signature checking.
  • New option ‘help-enable-completion-auto-load’, allows disabling the new feature introduced in Emacs 26.1 which loads files during completion of ‘C-h f’ and ‘C-h v’ according to ‘definition-prefixes’.
  • Emacs now supports the new Japanese Era name.

How to Install Emacs 26.3 in Ubuntu 18.04 and higher:

Emacs 26.3 has made into Snap Store as containerized snap package. For Ubuntu 18.04 and higher, simply search for and install it via Ubuntu Software.

For those prefer native Ubuntu .deb package, this PPA repository contains the most recent Emacs packages for Ubuntu 16.04, Ubuntu 18.04 and higher. Emacs 26.3 packages should be made into the PPA in a few days.

This quick tutorial shows how to install the latest GNU Emacs 26.1 in Ubuntu 16.04, Ubuntu 18.04, Ubuntu 18.10, Linux Mint 18,x, 19.x, and their derivatives.

While Ubuntu ships old versions in its universe repositories and don’t provide future updates, a stable PPA repository maintained by Kevin Kelley contains the 26.1 packages with mailutils, systemd, and xwidgets support for all current Ubuntu releases.

1. Open terminal either via Ctrl+Alt+T keyboard shortcut or by searching for “Terminal” from start menu. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:kelleyk/emacs

Type user password (no asterisk feedback due to security reason) when prompts and hit Enter.

2. Then install Emacs26 either via Synaptic package manager, or by running following commands one by one in terminal:

sudo apt update

sudo apt install emacs26

For text-only interface, replace emacs26 with emacs26-nox in the last command. And Ubuntu 18.04 and higher can skip apt update command.

Once installed, open emacs from your system application launcher and enjoy!

How to Remove:

To remove Emacs26, open terminal and run commands:

sudo apt remove --autoremove emacs26 emacs26-nox

The PPA can be removed by going to Software & Updates -> Other Software tab.

How to Install GNU Emacs 25.1 in Ubuntu 16.04

Last updated: September 18, 2016

emacs-icon245

GNU Emacs text editor finally reached the 25.1 release last night. Here’s how you can install it in Ubuntu 16.04 and Ubuntu 16.10.

Emacs 25.1 release highlights:

  • Emacs can now load shared/dynamic libraries (modules)
  • Experimental support for Cairo drawing
  • Enhanced network security (TLS/SSL certificate validity and the like)
  • New minor mode ‘electric-quote-mode’ for using curved quotes as you type
  • Character folding support in isearch.el
  • Xwidgets: a new feature for embedding native widgets inside Emacs buffers
  • New and improved facilities for inserting Unicode characters

gnu-emacs-25-1

How to install Emacs 25.1 in Ubuntu 16.04:

Besides installing the latest snapshot via the daily build PPA, it’s easy to build the 25.1 stable release by following the steps below one by one:

Remove previous Emacs if any before getting started:

1. Open terminal (Ctrl+Alt+T) and run command to install build tools:

sudo apt install build-essential checkinstall

Type in your password (no visual feedback) when it asks and hit Enter.

install-build-tools

2. Then install the build dependencies via command:

sudo apt-get build-dep emacs24

emacs-build-deps

1. Emacs 24 and 25 use the same build dependencies.

2. For those who have upgraded Intel driver using Intel Graphics Update Tool for Linux, like me, you won’t be able to install these dependencies. You need to downgrade the intel graphcs driver first.

3. Now download the source at ftp.gnu.org/gnu/emacs/, then extract:

emacs25-source

4. Open terminal and navigate to the “emacs-25.1” folder via command (or select “Open in terminal” from its context menu):

cd ~/Downloads/emacs-25.1

navigate-emacs-folder

5. In the same terminal window, once you’re in the source folder, run the commands below one by one:

./configure

make

For the default GTK version in Ubuntu 16.04, there’s a known bug for multiple displays.

6. Finally use checkinstall command to create .deb and install Emacs 25.1:

sudo checkinstall

While running the command, answer on screen questions, e.g., install docs, type package description, change package name, version, etc.

Emacs checkinstall

Once done, Emacs 25.1 is installed on your system and you can remove it anytime by running the command in the prompt with sudo privilege:

emacs-install-success

In my case it’s:

sudo dpkg -r emacs-25

And the last command create a .deb package in the source folder, and it can be used in another Ubuntu machine to install Emacs 25.1 (need to manually install dependencies via step 2).

Finally, run command emacs to launch the text editor, or launch it from Unity Dash (App Launcher) at next login (or next boot).