Git Product home page Git Product logo

dotemacs's Introduction

dotemacs

This is my personal KISS Emacs config.

intro

There are many emacs configs, what makes this one different?

kiss

This is a keep it simple stupid config. It is built with 3 simple building blocks; small enough that it is white magic instead of black magic.

simple building block 1

(defun require-package (package)
  "Ensures that PACKAGE is installed."
  (unless (or (package-installed-p package)
              (require package nil 'noerror))
    (unless (assoc package package-archive-contents)
      (package-refresh-contents))
    (package-install package)))

The code here is self-explanatory. This is how you declare what packages you want to install and use. This was taken from Purcell's config.

simple building block 2

(defalias 'after 'with-eval-after-load)

with-eval-after-load lets you defer execution of code until after a feature has been loaded. This is used extensively throughout the config, so an alias is set up for ease of use. This is what keeps the config loading fast.

Another useful feature is that it can also be used to run code if a package has been installed by using -autoloads; e.g.

(after 'magit
  ;; execute after magit has been loaded
  )
(after "magit-autoloads")
  ;; execute if magit is installed/available
  )

This was taken from milkypostman.

simple building block 3

At the bottom of the init.el is the following gem:

(cl-loop for file in (directory-files config-directory t)
  when (string-match "\\.el$" file)
  do (load file)))

Basically, it finds anything in config/ and loads it. If you want to add additional configuration for a new language, simply create new-language.el in config/ and it will automatically be loaded. One exception is init-boot.el, which is always loaded first.

other building blocks

bindings in one place

Another decision is to keep all keybindings in one place: init-bindings.el. Because of this, things like use-package aren't particularly useful here because it doesn't add much value over (require-package) and after.

Keybindings are the single most differentiating factor between configs. By defining them in one place, if you want to use/fork this config, you can simply change the bindings to your liking and still use all the other preconfigured packages as is. If you're not an Evil user, delete init-evil.el and you will get a pure Emacs experience.

lazy installation of major mode packages

By combining after, require-package, and auto-mode-alist, packages are installed only when necessary. If you never open a Javascript file, none of those packages will be installed.

install

git clone https://github.com/bling/dotemacs.git ~/.emacs.d

disclaimer

here be dragons.

license

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.