How to Install GNU Emacs on Linux Mint 21 or 20

If you aim to install GNU Emacs on Linux Mint 21 or the older stable release of Linux Mint 20, you’re in for a treat. GNU Emacs is more than a text editor—it’s a comprehensive integrated development environment (IDE) that’s been empowering users since its creation by Richard Stallman for the GNU project. It’s renowned for its extensibility, full suite of features, and cross-platform availability.

Here’s what makes GNU Emacs a standout choice:

  • Extensibility: Emacs is incredibly customizable, thanks to its design around the Lisp programming language. Users can tailor the editor to their specific workflows.
  • Feature-Rich: It goes beyond text editing, offering tools like a file manager, news reader, and calendar, plus support for macros to streamline tasks.
  • IDE Support: Emacs shines as an IDE with syntax coloring, documentation, and debugging tools for various programming languages.
  • Cross-Platform Use: It runs on Linux, BSD, macOS, and Windows, allowing a consistent user experience across different systems.

For Linux Mint enthusiasts, GNU Emacs is a perfect match:

  • Enhanced Productivity: Emacs consolidates tools and programming environments into one platform, streamlining your workflow.
  • Seamless Integration: As a Unix-like system, Linux Mint pairs well with Emacs, ensuring a smooth and efficient user experience.
  • Robust Community: The active communities around Linux Mint and GNU Emacs provide strong support and continual enhancements.

With this background, our upcoming guide will walk you through the installation process of GNU Emacs on Linux Mint 21 or Linux Mint 20, equipping you with a powerful tool that can transform your computing experience.

Install GNU Emacs on Linux Mint 21 or 20 via APT

Step 1: Refresh Linux Mint System Packages

As we set the stage for the installation of GNU Emacs, it’s crucial that we initially update our Linux Mint package inventory. By doing so, we ensure that our system is in sync with the latest packages, thus preventing any potential issues related to outdated packages. Apply the following commands in your terminal to achieve this:

sudo apt update
sudo apt upgrade

The sudo apt update command retrieves the newest updates from the repositories while sudo apt upgrade applies these updates, ensuring your system packages are up-to-date.

Step 2: Deciding on the Suitable APT Installation Approach

GNU Emacs installation using APT boils down to two primary methods.

Method 1: Installing GNU Emacs Directly from Linux Mint’s Repository

This approach is the simplest and is often advised, particularly for Long Term Support (LTS) distributions. Although the version installed may not be the absolute latest, it is assumed to be stable and compatible with your system, minimizing the risk of any potential disruptions.

To install the default version of GNU Emacs from the Linux Mint repositories, input the following command in your terminal:

sudo apt install emacs

Method 2: Installing GNU Emacs using PPA

The alternate method of installing Emacs using APT involves the addition of a Personal Package Archive (PPA). For this guide, we’ll utilize the PPA offered by Kevin Kelley. The advantage of this PPA lies in its flexibility — it accommodates builds for Emacs 28, 27, 26, and 25, which can be particularly helpful if you need a specific version of Emacs.

The first step in this process involves importing the PPA into your system with the command below:

sudo add-apt-repository ppa:kelleyk/emacs -y

After the PPA has been added, it’s essential to refresh your system once again using sudo apt update. This step allows your system to acknowledge the newly added PPA and incorporate it into its package sources:

sudo apt update

To browse the Emacs versions available in this PPA, you can use the following command:

sudo apt-cache show emacs* | grep "Version"

For most users, the latest version, Emacs version 28, will likely be the preferred choice. To install this version, execute the following command:

sudo apt install emacs28

It’s important to mention that if you’re operating in a headless environment, such as a Linux Mint server, you’ll only be able to install the terminal variant of Emacs. This can be done using the command:

sudo apt install emacs28-nox

The term ‘nox’ in emacs28-nox represents ‘no X’, indicating the lack of a graphical interface. Hence, this version of Emacs operates solely within your terminal, making it optimal for server environments.

Install GNU Emacs on Linux Mint 21 or 20 via Flatpak and Flathub

The following section details an alternate approach to installing GNU Emacs utilizing Flatpak, a novel package management system. Flatpak promotes an encapsulated environment where applications are run in isolation from the rest of the system. This method accrues several benefits, including heightened security, improved compatibility, and effortless distribution of applications.

Step 1: Enabling Flathub Repository For GNU Emacs

Before delving into the installation of GNU Emacs through Flatpak, it is a prerequisite to enable the Flathub repository. Flathub serves as a primary reservoir for Flatpak applications. To incorporate the Flathub repository into your Flatpak configuration, execute the following command:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

This command opens the doors to a vast array of applications, inclusive of GNU Emacs, that are disseminated through Flathub.

Step 2: Install GNU Emacs via Flatpak Command

With the Flathub repository in place, the stage is set for installing GNU Emacs. The flatpak install command enables this:

flatpak install flathub org.gnu.emacs -y

On execution of the command above, the most recent version of GNU Emacs will be installed from the Flathub repository, thus providing you access to the extensive capabilities of this flexible text editor.

Launch GNU Emacs (GUI or Terminal)

Now that we’ve walked you through the installation process, it’s time to learn how to launch GNU Emacs on your Linux Mint system. This process can be completed via the terminal or the graphical user interface (GUI), depending on your preference.

Terminal Launch: Regular Installation

If you have opted for a regular installation (not using Flatpak), launching GNU Emacs from the terminal is straightforward. Enter the following command:

emacs

This command summons GNU Emacs and opens it in a new window. Alternatively, you may need to use:

emacs-{version number}

Terminal Launch: Flatpak Installation

On the other hand, if you installed GNU Emacs using Flatpak, the launching command changes slightly. You will need to run the following command in your terminal:

flatpak run org.gnu.emacs

This command launches the GNU Emacs application installed in the isolated Flatpak environment. Note that the Flatpak version of applications may run somewhat differently due to the sandboxing techniques applied for better security and compatibility.

GUI Launch

For users who prefer using the mouse and visual cues, GNU Emacs can be launched via the Linux Mint menu as well. Here’s the path to follow:

Click on the Linux Mint Menu button > Programming > Emacs

By clicking on the Emacs icon under the ‘Programming’ category, you open GNU Emacs and are ready to start working on your text editing tasks.

Clickable GNU Emacs application icon on the Linux Mint desktop.Pin
Click the GNU Emacs icon on your Linux Mint desktop to start coding!

First-Time Tips with GNU Emacs on Linux Mint 21 or 20

Emacs is a powerful, extensible text editor favored by programmers, writers, and tech enthusiasts. As a first-time user of Linux Mint, you’re stepping into a world where efficiency and customization blend to enhance your productivity. Here’s how to get the most out of GNU Emacs.

General GNU Emacs Tips with Linux Mint

  • Familiarize with Emacs Keybindings: Emacs is renowned for its robust set of keyboard shortcuts. Start by learning the basics like Ctrl-x Ctrl-f to open a file, and Ctrl-x Ctrl-s to save it. Memorizing these will save you time in the long run.
  • Explore Emacs Tutorial: Press Ctrl-h t to access the built-in tutorial. It’s a comprehensive guide to start your Emacs journey and is tailored to your Emacs installation.
  • Use the Emacs Manual: For more profound understanding, the Emacs manual is your go-to resource. Access it by typing Ctrl-h r and dive into the extensive documentation.

GNU Emacs Customizations with Linux Mint

  • Emacs as an IDE: Customize Emacs to behave like an Integrated Development Environment (IDE) by installing packages like use-package, company, flycheck, and more. Each serves a purpose like auto-completion, syntax checking, etc.
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
(package-install 'use-package)
  • Personalize Your Workspace: Tailor your workspace by editing your .emacs or init.el file. You can set your preferred font, theme, and even keybindings. For example, to set a default font:
(set-frame-font "DejaVu Sans Mono-10" nil t)
  • Organize with Emacs Directories: Use Ctrl-x d to navigate directories within Emacs. It’s an efficient way to manage files without leaving the editor.

Other GNU Emacs Tips with Linux Mint

  • Emacs Lisp (Elisp): Emacs is powered by its programming language, Elisp. Learning the basics can significantly enhance what you can do with Emacs. Start with simple tasks like writing a function to insert the current date:
(defun insert-current-date () (interactive)
  (insert (format-time-string "%Y-%m-%d")))
  • Extend with Packages: The M-x package-list-packages command opens a world of extensions. From project management tools to games, you can enhance your Emacs experience according to your needs.
  • Backup Your Configuration: Your .emacs or init.el file is central to your Emacs experience. Keep a backup on a service like GitHub. This practice also eases transitioning to a new system or restoring your setup.

By embracing these tips, your proficiency with GNU Emacs will grow. Remember, Emacs is more than just an editor; it’s a way to streamline your workflow and personalize your computing environment.

GNU Emacs desktop graphical user interface on a Linux Mint system.Pin
Explore the features of GNU Emacs with its full desktop GUI on Linux Mint.
GNU Emacs running in nox mode within the Linux Mint terminal.Pin
Experience the power of GNU Emacs in nox mode within the Linux Mint terminal.

Manage GNU Emacs on Linux Mint 21 or 20

Update GNU Emacs

Keeping your software up-to-date is crucial to benefiting from the latest features and security patches. The command to update GNU Emacs varies based on the installation method you used initially.

APT Update Method For GNU Emacs

If you installed GNU Emacs via APT, you could update it along with all other APT-managed packages on your system by running the following command in the terminal:

sudo apt upgrade && sudo apt upgrade

This command first updates the list of available packages (sudo apt update) and then upgrades all installed packages to their latest versions (sudo apt upgrade). Frequent execution of this command is highly recommended, especially for novice Linux users, to keep your system in optimal condition.

Flatpak Update Method For GNU Emacs

If you opted to install GNU Emacs via Flatpak, you would need to use the following command to update it:

flatpak update

This command will update all Flatpak applications, including GNU Emacs, to their latest versions.

Remove GNU Emacs From Linux Mint

If you no longer require GNU Emacs on your system, it’s straightforward to remove it. Again, the command to uninstall it depends on your original installation method.

APT Remove Method For GNU Emacs

If you installed GNU Emacs using APT, you can remove it using the following command:

sudo apt remove emacs

Once you’ve removed the software, if you’re sure you won’t be using it again, it’s good practice to remove the added PPA. Use the following command to do so:

sudo add-apt-repository --remove ppa:kelleyk/emacs -y

Flatpak Remove Method For GNU Emacs

For those who installed GNU Emacs via Flatpak, use the following command to uninstall it:

flatpak uninstall --delete-data org.gnu.emacs

This command removes the application and all its associated data, freeing up your system resources.

Conclusion: Mastering GNU Emacs on Linux Mint

This guide has equipped you with the essentials for managing GNU Emacs on your Linux Mint system. From installation to customization, you’ve learned how to make this powerful editor work for you. With the ability to tailor GNU Emacs to your workflow, you’re now set to enhance your productivity in coding and text editing. Keep this guide handy to ensure your setup is continually optimized for your evolving needs.

Leave a Comment


Your Mastodon Instance
Share to...