“Learn Emacs the right way”

When you have read this book you will understand Emacs

Image of the Mastering Emacs book cover
  • 314 pages
  • Updated for Emacs 28
  • PDF & ePub
  • Free Updates
  • Available in English and Japanese
  • Learn Emacs from the ground up. In the Mastering Emacs book you will learn all the concepts that take weeks, months or even years to truly learn. All in one place.

    “Emacs is too hard to learn!”

    Emacs is the best and most flexible tool for personal productivity. Mastering Emacs is the best book about learning Emacs. Bar none. Carlo Fusco More testimonials   →

    It's a common refrain, but Emacs is the product of 40 years of continuous effort to build an extensible, self-documenting text editor. With that, comes complexity; but also freedoms that no other IDE or editor can give you. This book will teach you, from the ground up, how to learn and use Emacs.

    If you're serious about learning Emacs, you will need a guide to help you come to grips with a number of alien concepts, like Emacs's unique key bindings, its terminology, and why anyone would use a language like LISP to extend it.
    Despite its long history, Emacs remains as relevant today as it did when it was first created. When you read this book, I will teach you why Emacs is so powerful; how you can achieve the confidence and skills needed to accomplish anything; and why people use and extend Emacs after all these years.

    Is Mastering Emacs right for me?

    Mastering Emacs − and Emacs in general − is a great tool for everyone, despite its pedigree as a tool for programmers.
    A large core of my readers are academics, scientists, and knowledge workers: they use Emacs for a wide range of work. If you're in technology, then Emacs is, of course, an obvious choice. But my book is interest-agnostic: you will come away with an excellent understanding of Emacs regardless of why you're using Emacs in your daily life.

    Mastering Emacs is intended for both beginners and intermediate users.

    Exploring & Learning about Emacs

    What good is an editor with tens of thousands of commands if you can never find what you are looking for? What sets Emacs apart from every other IDE or editor on the market is its dedication to self-documentation. Every part of Emacs is searchable — and therefore discoverable — but knowing how to ask Emacs the right questions is essential knowledge.
    In the book you will learn how to ask Emacs the right questions you're likely to encounter:

    Describing what something does
    Almost every facet of Emacs is well-documented and accessible — once you learn how to ask the right questions. It's all too easy to get stuck, and not realize that Emacs can help you answer your most salient questions. This is especially true once you start customizing Emacs; and who better to answer your questions than Emacs itself?
    Even after more than 20 years of using Emacs, the book "Mastering Emacs" gives me structured and new insights into the things I use daily. The book, as well as the web site, are mandatory resources for every active Emacs user. Alan Pavičić, Software Developer More testimonials   →
    Forgetting Key Bindings
    Learn about key bindings, key maps and key prefixes. Emacs knows exactly what command does what, and the keys it's bound to. But you need to know how to ask it the right questions.
    Mastering Emacs will teach you how to connect the dots between commands and their key bindings. Whether the answer is on the tip of your tongue, or if you're simply exploring.
    Learning about new features
    Emacs has thousands of commands, and all of them serve a purpose. But knowing how to author text won't help you if you want to code in your favorite programming language; manipulate files and directories; or use Emacs's builtin command shell or terminal emulator.
    In the Mastering Emacs book I will walk you through all the different ways that you can use Emacs's own self-documenting features to learn how to accomplish new things in unfamiliar areas.
    Try Mastering Emacs for Free

    Unique Terminology & Concepts

    I have been using Emacs intensely since 1990 and I have read much about it. Nevertheless, even after 30 years of experience, Mickey's book taught me many new and very useful things about Emacs. Mickey has skillfully organized the contents of this book to describe the concepts of Emacs in a compact form that elegantly takes the reader from beginner to expert level. I highly recommend this book. It is a pleasure to read. I believe it is the best book about Emacs you can get your hands on! Dr. Frank Ernst, Professor. More testimonials   →

    Emacs has its own names and concepts that predate most other computing paradigms. The end result is that new users are left confused wondering why Emacs behaves so differently. Usually, it's because Emacs's way of doing things is better for power users, not beginners.
    I will show you why Emacs is so different and why these features work the way they do. I will also teach you why they're generally better and worth learning:

    The Kill Ring
    Learn why Emacs never formally adopted the clipboard concept you're familiar with already, and why Emacs's system is so much more powerful. The kill ring (as it's known) is embedded into most editing commands, and supplants the concept of deleting text by instead adding text to a circular ring of clipboard entries — but why?
    You will learn why Emacs bucks the trend of every other editor, and why it's a superior system to everything else you've used before. Or, if you prefer, how to disable it and revert to the classic clipboard.
    Selecting Text
    Text selection is another area where Emacs distinguishes itself. Selecting text is a two-pronged approach involving Emacs's point and mark. The mark is especially important as it's not only one side of a selection rectangle, but also an important beacon that helps you navigate when you move around.
    Undoing Text
    Emacs's undo ring is circular, making it nearly impossible to lose information, as when you undo or redo, that action is itself stored as an undoable action in Emacs's undo ring.
    The undo ring is another example of where Emacs deviates from other editors; though it requires more effort to learn and understand, it offers significant advantages.
    Escape Meta Alt Control Shift
    Chorded key bindings are one of Emacs's defining characteristics. They let you do more with less. They also add complexity, and it's a common source of frustration for new users.
    You will learn all there is to know about how (and why) Emacs is one of the few editors to adopt this paradigm, and how you can get the most out of it.
    Windows, Buffers and Frames
    Emacs is itself a sophisticated tiling window manager. Emacs's display is split into subdivisions (called windows) when Emacs wants to tell you something, or when you explicitly ask it to. For new users, it's yet another layer of complexity if you're not already familiar with that paradigm.
    Furthermore, Emacs also supports frames — Emacs's term for what everyone else calls windows — that adds yet another dimension to consider.
    And to top it all off, there is Emacs's idea of buffers, the main way you interface with Emacs when you read and write text.

    I have a humanities background and am anything but an accomplished programmer. But I got into using Emacs as my main text editor (using Markdown). Mastering Emacs was easy to follow, even as a beginner, but it also covers an extensive array of advanced techniques and tricks. If you want to understand Emacs but are feeling lost, this is an excellent guide. John Carter Wood More testimonials   →

    Movement & Editing

    Moving around and editing text is a large part of what we do in a text editor. If you've ever found yourself limited by the editing capabilities of your current tool, you'll love what you can do in Emacs. Emacs has a complex web of key bindings and commands that seamlessly combine movement and editing to greatly speed up your workflow — whether that's writing prose or code.
    How — and, crucially, why — Emacs's movement and editing workflow is unchanged after nearly forty years, and why it'll easily stand up to what other editors can do today, is a core part of the book.

    Navigating and Editing by Syntactic Units
    One of Emacs's strengths is that regardless of the environment you operate in — whether it's programming, writing notes, or editing config files — Emacs will present a unified set of commands and key bindings that you can rely on to consistently help you move around and edit text.
    Searching and Indexing
    Learn how to quickly navigate files and text with Emacs's array of builtin tools. Simple-sounding though it might be, Emacs's search features are flexible, unobtrusive, and powerful.
    And when that is not enough, learn how Emacs can seamlessly call out to external tools like grep and friends and integrate the output inside Emacs.
    Beautifully written, concise, and fully up to date - a must for any Emacs user. Nick Higham More testimonials   →
    Recording and Playing back Keyboard Macros
    Emacs has the most advanced keyboard macro system of any editor. You can combine nearly all user actions you can make in Emacs into a replayable macro that you can invoke at leisure.
    Text Manipulation
    Use Emacs to shape text or code. Whether it's filtering or keeping lines of strings of text that match regular expressions; deleting, merging and cycling whitespace; transposing text to fix typos; or using Emacs's text expansion features to automate tedium.
    Try Mastering Emacs for Free

    Workflow

    Seamlessly combining disparate tools is one of Emacs's hallmark abilities. Most Emacs users end up altering their workflows so they interact with most external tools through Emacs.
    Mastering Emacs covers a handful of use cases to whet your appetite:

    Running your own Shell inside Emacs
    Emacs can seamlessly run a shell like bash inside Emacs, so you can leverage the power of Emacs like free-form search indexing and keyboard navigation.
    I found Mastering Emacs at the beginning of my Emacs journey. I'd read the documentation, many blog posts, but nothing was helping me actually understand the how & why of Emacs, and using it day-to-day, until I read Mastering Emacs. Now, I use Emacs every day and am very comfortable with it, thanks to this book James Hebden More testimonials   →
    Manipulating Files and Directories
    Emacs has Dired, a sophisticated directory editor with hundreds of commands for bulk editing — like (un)compressing files, altering permissions, renaming, deleting, moving and copying — and many more specialized commands (like image thumbnail browsing) that all but replaces the need for your terminal.
    Browsing and Editing Unstructured Text
    Easily traverse log files and automatically reload them when they change. Highlight text of interest with Emacs's highlighters.
    Remote File Editing
    Use Emacs's builtin remote editing capabilities to seamlessly edit files using a dozen different protocols, from SSH to Android Debug Bridge. Emacs will transparently edit the file as though it were local, and handle all the hard work. Combine the transparent editing with all the previously mentioned features to supercharge your remote editing workflows.
    Why manipulate files on a distant server from the commandline when you could do it from your local Emacs?

    Frequently Asked Questions

    Is Mastering Emacs available in print?
    No − it is ePub and PDF only. However, the PDF was designed for print and screen. It's in standard 6x9 book format, and thus suitable for print-on-demand services. You have my permission to print the book for yourself, if you so choose.
    Can I read Mastering Emacs in other languages?
    Yes, you can! Thanks to USAMI Kenta and AYANOKOJI Takesi, you can read Mastering Emacs in Japanese also. It is available as a free download once you purchase the book.
    Is Mastering Emacs useful for me if I am not a programmer?
    A resounding yes! Many of my readers work in fields as diverse as law, academia, book authoring, manufacturing, and finance. Emacs is not just a programmers' text editor, though it is definitely good at that.
    You're going to love exploring all the productivity options available to Emacs users once you have mastered Emacs.
    I'm already using Emacs − is Mastering Emacs right for me?
    Most likely, yes. Unless you're familiar with all the topics covered in the Table of Contents, then Mastering Emacs will add value and improve your knowledge of Emacs.
    There are many who have used Emacs for decades − see the testimonials − who found the book invaluable as it helped them crystallize things about Emacs they did not consider or know about before.
    Do I have to pay for updates?
    Nope! Updates are free. You'll receive an email when a new version is released.
    What if I don't learn anything?
    You will! But, if you're not happy, you can have a no-questions-asked refund up to 30 days after your purchase. However, I am confident you'll love the book!

    Table of Contents

    1. Introduction
      1. Thank You
      2. 2022 Edition Update
        1. Emacs in the Future
      3. 2020 Edition Update
      4. Intended Audience
      5. What You’ll Learn
    2. The Way of Emacs
      1. Guiding Philosophy
        1. LISP?
        2. Extensibility
      2. Important Conventions
        1. The Buffer
        2. The Window and the Frame
        3. The Point and Mark
        4. Killing, Yanking and CUA
        5. .emacs.d, init.el, and .emacs
        6. Major Modes and Minor Modes
    3. First Steps
      1. Installing and Starting Emacs
        1. Starting Emacs
      2. The Emacs Interface
      3. Keys
        1. Caps Lock as Control
        2. M-x: Execute Extended Command
        3. M-S-x: Execute Extended Command for Buffer
        4. Universal Arguments
        5. Discovering and Remembering Keys
      4. Configuring Emacs
        1. The Customize Interface
        2. Evaluating Elisp Code
        3. The Package Manager
        4. Color Themes
      5. Getting Help
        1. The Info Manual
        2. Apropos
        3. The Describe System
    4. The Theory of Movement
      1. The Basics
        1. C-x C-f: Find file
        2. C-x C-s: Save Buffer
        3. C-x C-c: Exit Emacs
        4. C-x b: Switch Buffer
        5. C-x k: Kill Buffer
        6. ESC ESC ESC: Keyboard Escape
        7. C-/: Undo
      2. Window Management
        1. Working with Other Windows
      3. Frame Management
      4. Tab Bars and Tab Lines
        1. Tab Bar Mode
        2. Tab Line Mode
      5. Elemental Movement
        1. Navigation Keys
        2. Moving by Character
        3. Moving by Line
        4. Moving by Word
        5. Moving by S-Expressions
        6. Other Movement Commands
        7. Scrolling
      6. Bookmarks and Registers
      7. Selections and Regions
        1. Selection Compatibility Modes
        2. Setting the Mark
      8. Searching and Indexing
        1. Isearch: Incremental Search
        2. Occur: Print and Edit lines matching an expression
        3. Imenu: Jump to definitions
        4. Helm: Incremental Completion and Selection
        5. IDO: Interactively DO Things
        6. Grep: Searching the file system
      9. Other Movement Commands
      10. Conclusion
    5. The Theory of Editing
      1. Killing and Yanking Text
        1. Killing versus Deleting
        2. Yanking Text
      2. Transposing Text
        1. C-t: Transpose Characters
        2. M-t: Transpose Words
        3. C-M-t: Transpose S-expressions
        4. Other Transpose Commands
      3. Filling and Commenting
        1. Filling
        2. Commenting
      4. Search and Replace
        1. Case Folding
        2. Regular Expressions
      5. Changing Case
      6. Counting Things
      7. Text Manipulation
        1. Editable Occur
        2. Deleting Duplicates
        3. Flushing and Keeping Lines
        4. Copying and Killing Matching Lines
        5. Joining and Splitting Lines
        6. Whitespace Commands
      8. Keyboard Macros
        1. Basic Commands
        2. Advanced Commands
      9. Text Expansion
        1. Abbrev
        2. DAbbrev and Hippie Expand
      10. Indenting Text and Code
        1. TAB: Indenting the Current Line
        2. Indenting Regions
      11. Sorting and Aligning
        1. Sorting
        2. Aligning
      12. Other Editing Commands
        1. Zapping Characters
        2. Spell Checking
        3. Quoted Insert
    6. The Practicals of Emacs
      1. Exploring Emacs
        1. Reading the Manual
        2. Using Apropos
        3. C-h: Exploring Prefix keys
        4. C-h k: Describe what a key does
        5. C-h m: Finding mode commands
        6. M-S-x: Execute Extended Command for Buffer
      2. Project Management
      3. Xref: Cross-References in Emacs
      4. Working with Log Files
        1. Browsing Other Files
      5. Tramp: Remote File Editing
        1. The Default Directory and Remote Editing
        2. Multi-Hops and User Switching
      6. EWW: Emacs Web Wowser
      7. Dired: Files and Directories
        1. Navigation
        2. Marking and Unmarking
        3. Operations
        4. Working Across Directories
      8. Shell Commands
        1. Compiling in Emacs
      9. Shells in Emacs
        1. M-x shell: Shell Mode
        2. M-x ansi-term: Terminal Emulator
        3. M-x eshell: Emacs’s Shell
    7. Conclusion
      1. Other Resources
        1. Third-Party Packages and Tools
        2. Communities
    Mastering Emacs is the single best book on Emacs that I know of. It tells you what you need to know, and what you didn't know you needed to know, and it does it clearly and comprehensibly. I am now on version 4 of this work which is updated regularly with each new major version. I find something new to try every time I pick it up. This is a good book for helping the beginner to get started, and a great book for helping the more advanced user to discover new tools and opportunities. Britt Anderson More testimonials   →

    After Mastering Emacs…

    When you've read Mastering Emacs you'll have a solid understanding of Emacs and how and why it works the way it does. You'll be empowered with the knowledge required to ask Emacs questions — I cannot stress how important that is!
    You'll also have a superb understanding of every core part of Emacs's editing and movement capabilities; how they work together with all aspects of Emacs, like its kill ring; and how to accomplish most of any task you'd want to do with Emacs.

    And if you're not 100% satisfied you can have your money back.

    $49.99 Buy Now