Git Product home page Git Product logo

emacs.d's Introduction

emacs.d

https://dl.dropboxusercontent.com/u/508427/imgs/richard-stallman.jpg

Getting Started

Version call_emacs-d-version().

First things first, we need to setup load paths and get any packages that don’t live in ELPA installed. For convenience, this is handled by Pallet and Cask.

Installing Cask

Installing Cask can be done via a provided installation script, or via Homebrew.

curl -fsSkL https://raw.github.com/cask/cask/master/go | python

My preferred method is to clone the Cask repository and update my $PATH.

[[ -d ~/.cask ]] ||
  git clone git://github.com/cask/cask.git ~/.cask

Benchmarks

In order to keep track of how expensive each piece of our Emacs configuration is, we measure require.

(defun jcf-time-subtract-millis (b a)
  (* 1000.0 (float-time (time-subtract b a))))

(defvar jcf-require-times nil
  "A list of (FEATURE . LOAD-DURATION). LOAD-DURATION is the time
  taken in milliseconds to load FEATURE.")

(defadvice require
  (around build-require-times (feature &optional filename noerror) activate)
  "Note in `jcf-require-times' the time taken to require each feature."
  (let* ((already-loaded (memq feature features))
         (require-start-time (and (not already-loaded) (current-time))))
    (prog1
        ad-do-it
      (when (and (not already-loaded) (memq feature features))
        (add-to-list 'jcf-require-times
                     (cons feature
                           (jcf-time-subtract-millis (current-time)
                                                           require-start-time))
                     t)))))

Dependencies

Cask supports installing dependencies via the main package archives and package.el, and importantly will clone packages from repository URLs.

When installing via a repository the format we need to use is as follows:

(depends-on name fetcher url)

To fetch an imaginary package called bicycle via Git you could use the following incantation of depends-on:

(depends-on "bicycle" :git "git://github.com/bicycle/bicycle.git")

fetcher must be one of the values in ~cask-fetchers~, which at the time of writing consists of:

  • :bzr
  • :cvs
  • :darcs
  • :git
  • :hg
  • :svn

There are two open issues related to installing Org using Cask related to the following issues.

Essentially, the issue is that packages that are already installed are ignored, regardless of where they came from. This means Org mode, which comes shipped with Emacs won’t be installed.

The workaround according to #169 is to install org-plus-contrib.

See the Cask file for a list of all packages.

init.el

Our init.el needs to pull in the packages installed by Cask before we kick things off.

(require 'cask "~/.cask/cask.el")
(cask-initialize)
(require 'pallet)
(pallet-mode t)

With all of our packages available we can start configuration. To keep things manageable configuration is split up into a number of files.

cl

Require some common-lisp functions and macros straight away.

(require 'cl)

OS X

There are a number of packages and configurations that only make sense on OS X. Although I don’t use Emacs on Linux very often, and never on Windows it makes sense to ensure Emacs will run in these environments.

(defconst *is-a-mac* (eq system-type 'darwin))

Load Org files

To give you an idea of why, my original literate Emacs config racked up over 3000 lines in a single Org file.

(require 'org-install)
(require 'ob-tangle)

(defvar jcf-config-dir
  (file-name-directory (or load-file-name (buffer-file-name))))

(defun jcf-load-org (s)
  (org-babel-load-file
   (expand-file-name (format "init-%s.org" s) jcf-config-dir)))

(add-hook
 'after-init-hook
 (lambda ()
   (jcf-load-org "defuns")
   (jcf-load-org "ubiquitous")
   (jcf-load-org "genesis")
   (jcf-load-org "presentation")
   (jcf-load-org "evil")
   (jcf-load-org "helm")
   (when *is-a-mac*
     (jcf-load-org "osx"))
   (jcf-load-org "org")
   (jcf-load-org "packages")
   (jcf-load-org "window-management")
   (jcf-load-org "version-control")
   (jcf-load-org "languages")
   (jcf-load-org "sessions")
   (jcf-load-org "locales")

   (jcf-log-startup-time)))

emacs.d's People

Contributors

dcorking avatar demon386 avatar mattfidler avatar ozanmakes avatar purcell avatar skaes avatar

Watchers

 avatar  avatar  avatar

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.