mnewt / dotemacs

An Emacs configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An Emacs Configuration

About

This is my ~/.emacs.d directory. My primary mode of operating is macOS GUI so things work best on that. It is also compatible (but will have more bugs) with running from a terminal, Linux, and Windows.

screenshot.png

Goals

Always fast and responsive.

Nothing should produce unnecessary lag, waiting, or clunkiness. Remote use cases like TRAMP and ssh have been ironed out through heavy use.

The appearance should be functional and attractive.

For maximum concentration and ergonomics, there should be no extraneous information. Strip away any distracting lines or unnecessary UI elements.

Optimize startup time.

Slow startup is a barrier to improving this config and it just makes me feel bad. On my machine Emacs starts it up in about 0.8 seconds.

All interfaces should be uniform.

ivy and company are the two main ways to find stuff.

Use normal Emacs key bindings, enhance where appropriate.

Then mix in the most common macOS key bindings so things like s-c and s-w work like in the rest of the OS. I work heavily with macOS applications like Mail, Calendar, Messages, MS Outlook, Firefox. So it’s important that the basic key bindings in those applications have a translation in Emacs. Keep things as consistent and idiomatic as possible while merging these two disparate binding systems.

Extensive customization but no excess.

If I’m not using a package, it’s out. But I guess I use a lot of packages. About 180 at last count. Dependencies bump it up to about 210.

Custom Emacs build.

Check out the setup script. It builds Emacs from the latest master to enjoy benefits such as performance improvements, better macOS compatibility, image viewing, modules like libvterm and pdf-tools, and new features like js-jsx-mode and Jansson support (see GNU Emacs NEWS, or better yet, M-x view-emacs-news).

Reproducible and portable configuration

It should work the same way on each machine out of the box with as little fuss as possible.

Frequent updates.

I update frequently and often pick up new functionality from Emacs master.

Utilize use-package and straight.el for as much configuration as possible.

Defer loading non-core packages until they are needed. Straight is an amazing package management system that does everything better than package.el.

Features

A nice mode-line.

It’s a customized version of mood-line.

Custom theming system.

Quickly (and completely!) switch between light and dark, or any other themes. A key part of this is realizing that many packages have dependencies on the theme so it is not nearly enough to call load-theme. So there is some additional logic to automatically change as much as possible and use a hook to do the rest.

Editing

Highlights include

Environment support.

macOS doesn’t hand its applications much in terms of standard UNIX environment configuration. I have a customized setup to initialize the environment by running bash --login and pulling in its environment variables. The details are handled in my non-Emacs dotfiles.

Eshell.

There is nothing like Eshell. It is truly amazing the way it enables powerful new ways to handle remote systems administration. There are extensive customizations to make it seamless with the rest of the environment and UI.

File operations and Dired.

Make the uniquely powerful Dired more comfortable, informative, and reliable. Heavily reliant on the awesome dired-hacks collection.

Persistence.

Manage window configuration and buffer persistence using perspective, undo, command completions, recent files, etc.

Navigation.

Some innovative intra- and extra- buffer navigation strategies. Check out winner-wrong-window for an example.

Version control.

Magit and more. But mostly magit.

Language support.

Other nice things

  • Automatic code formatting, mostly with Apheleia
  • flycheck
  • Log viewing - Docker, systemd, and others
  • Nested language support with fence-edit

Supported Emacs versions

Attempts have been made to make this config compatible with 27+. However, they are half-hearted and some features are 28+ or maybe even 29+ only.

Install

  1. Clone the repo:
    git clone https://github.com/mnewt/dotemacs.git ~/.emacs.d
        
    1. Install Emacs

    You can install Emacs using your method of choice but I build it from source:

    ~/.emacs.d/bin/build-emacs
        
    1. Start Emacs. The first run will install lots of stuff so it will take a few minutes.

Emacs Build

You can build Emacs with support for compiling packages to machine code using GCCEmacs. As of Emacs 28, this is an optional feature that seems to work pretty well. Currently, I’m using homebrew-emacs-plus.

See the install-emacs-plus script for how I build Emacs on macOS.

See TODO.org.

License

The Free Software Foundation may control certain pieces of this by virtue of them being contributed to Emacs or a package in ELPA. The rest is basically in the public domain. See the LICENSE file for details.

About

An Emacs configuration

License:The Unlicense


Languages

Language:Emacs Lisp 94.3%Language:Shell 4.1%Language:YASnippet 1.3%Language:Swift 0.3%